Skip to content

Commit

Permalink
Merge pull request #64 from Efimj/enhancement/purchase-screen
Browse files Browse the repository at this point in the history
Enhancement/purchase screen
  • Loading branch information
Efimj committed Jul 3, 2024
2 parents 1001352 + 994a4de commit ce21de0
Show file tree
Hide file tree
Showing 26 changed files with 750 additions and 320 deletions.
797 changes: 628 additions & 169 deletions app/src/main/java/com/jobik/shkiper/screens/purchase/PurchaseScreen.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import javax.inject.Inject

data class PurchaseScreenState(
val purchases: List<ProductDetails> = emptyList(),
val subscription: ProductDetails? = null,
val subscriptions: List<ProductDetails> = emptyList(),
val showGratitude: Boolean = false,
)

Expand All @@ -38,7 +38,7 @@ class PurchaseViewModel @Inject constructor(
init {
_screenState.value = _screenState.value.copy(
purchases = billingClient.productDetails.value,
subscription = if (billingClient.subscriptionsDetails.value.isNotEmpty()) billingClient.subscriptionsDetails.value.first() else null,
subscriptions = billingClient.subscriptionsDetails.value,
)
billingClient.registerPurchaseCallback(this)
}
Expand Down Expand Up @@ -91,7 +91,11 @@ class PurchaseViewModel @Inject constructor(
subscriptionOfferDetails: SubscriptionOfferDetails,
activity: Activity
) {
val billingResult = billingClient.makePurchaseSubscription(activity, productDetails, subscriptionOfferDetails)
val billingResult = billingClient.makePurchaseSubscription(
activity,
productDetails,
subscriptionOfferDetails
)
}

fun checkIsProductPurchased(productId: String): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private fun DevSupportSettings(
settingsViewModel: SettingsViewModel,
navController: NavController
) {
SettingsGroup(header = stringResource(R.string.Support), accent = true) {
SettingsGroup(header = stringResource(R.string.support), accent = true) {
SettingsItem(
modifier = Modifier.heightIn(min = 50.dp),
icon = Icons.Outlined.Stars,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ import androidx.annotation.Keep
@Keep
object AppProducts {
//Product IDs
const val CupOfTea = "cup_of_tea"
const val SweetsForMyCat = "sweets_for_my_cat"
const val GymMembership = "gym_membership"
const val Product_1 = "product_1"
const val Product_2 = "product_2"

//Subscriptions IDs
const val SimpleSubscription = "simple_subscription"
const val Monthly = "simple-monthly"
const val Yearly = "simple-yearly"

val ListOfProducts = listOf(
CupOfTea,
SweetsForMyCat,
GymMembership
Product_1,
Product_2,
)
val ListOfSubscriptions = listOf(
SimpleSubscription,
Expand Down

This file was deleted.

11 changes: 11 additions & 0 deletions app/src/main/java/com/jobik/shkiper/util/ContextUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.jobik.shkiper.util

import android.app.UiModeManager
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build
import com.jobik.shkiper.util.settings.Localization
import java.util.Locale
Expand Down Expand Up @@ -49,4 +51,13 @@ object ContextUtils {
configuration.setLayoutDirection(locale)
return context.createConfigurationContext(configuration)
}

fun hasInternetConnection(context: Context): Boolean {
val connectivityManager =
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetwork = connectivityManager.activeNetwork ?: return false
val networkCapabilities =
connectivityManager.getNetworkCapabilities(activeNetwork) ?: return false
return networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
}
}
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/ic_btc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1dp"
android:height="1dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:pathData="M16,16m-16,0a16,16 0,1 1,32 0a16,16 0,1 1,-32 0"
android:fillColor="#f7931a"
android:fillType="evenOdd"/>
<path
android:pathData="M23.189,14.02c0.314,-2.096 -1.283,-3.223 -3.465,-3.975l0.708,-2.84l-1.728,-0.43l-0.69,2.765c-0.454,-0.114 -0.92,-0.22 -1.385,-0.326l0.695,-2.783L15.596,6l-0.708,2.839c-0.376,-0.086 -0.746,-0.17 -1.104,-0.26l0.002,-0.009l-2.384,-0.595l-0.46,1.846s1.283,0.294 1.256,0.312c0.7,0.175 0.826,0.638 0.805,1.006l-0.806,3.235c0.048,0.012 0.11,0.03 0.18,0.057l-0.183,-0.045l-1.13,4.532c-0.086,0.212 -0.303,0.531 -0.793,0.41c0.018,0.025 -1.256,-0.313 -1.256,-0.313l-0.858,1.978l2.25,0.561c0.418,0.105 0.828,0.215 1.231,0.318l-0.715,2.872l1.727,0.43l0.708,-2.84c0.472,0.127 0.93,0.245 1.378,0.357l-0.706,2.828l1.728,0.43l0.715,-2.866c2.948,0.558 5.164,0.333 6.097,-2.333c0.752,-2.146 -0.037,-3.385 -1.588,-4.192c1.13,-0.26 1.98,-1.003 2.207,-2.538m-3.95,5.538c-0.533,2.147 -4.148,0.986 -5.32,0.695l0.95,-3.805c1.172,0.293 4.929,0.872 4.37,3.11m0.535,-5.569c-0.487,1.953 -3.495,0.96 -4.47,0.717l0.86,-3.45c0.975,0.243 4.118,0.696 3.61,2.733"
android:fillColor="#fff"
android:fillType="nonZero"/>
</vector>
38 changes: 38 additions & 0 deletions app/src/main/res/drawable/ic_eth.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1dp"
android:height="1dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:pathData="M16,16m-16,0a16,16 0,1 1,32 0a16,16 0,1 1,-32 0"
android:fillColor="#627eea"
android:fillType="evenOdd"/>
<path
android:pathData="M16.498,4v8.87l7.497,3.35z"
android:fillColor="#fff"
android:fillAlpha="0.602"
android:fillType="nonZero"/>
<path
android:pathData="M16.498,4L9,16.22l7.498,-3.35z"
android:fillColor="#fff"
android:fillType="nonZero"/>
<path
android:pathData="M16.498,21.968v6.027L24,17.616z"
android:fillColor="#fff"
android:fillAlpha="0.602"
android:fillType="nonZero"/>
<path
android:pathData="M16.498,27.995v-6.028L9,17.616z"
android:fillColor="#fff"
android:fillType="nonZero"/>
<path
android:pathData="m16.498,20.573l7.497,-4.353l-7.497,-3.348z"
android:fillColor="#fff"
android:fillAlpha="0.2"
android:fillType="nonZero"/>
<path
android:pathData="m9,16.22l7.498,4.353v-7.701z"
android:fillColor="#fff"
android:fillAlpha="0.602"
android:fillType="nonZero"/>
</vector>
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/ic_usdt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1dp"
android:height="1dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:pathData="M16,16m-16,0a16,16 0,1 1,32 0a16,16 0,1 1,-32 0"
android:fillColor="#26a17b"
android:fillType="evenOdd"/>
<path
android:pathData="M17.922,17.383v-0.002c-0.11,0.008 -0.677,0.042 -1.942,0.042c-1.01,0 -1.721,-0.03 -1.971,-0.042v0.003c-3.888,-0.171 -6.79,-0.848 -6.79,-1.658c0,-0.809 2.902,-1.486 6.79,-1.66v2.644c0.254,0.018 0.982,0.061 1.988,0.061c1.207,0 1.812,-0.05 1.925,-0.06v-2.643c3.88,0.173 6.775,0.85 6.775,1.658c0,0.81 -2.895,1.485 -6.775,1.657m0,-3.59v-2.366h5.414V7.819H8.595v3.608h5.414v2.365c-4.4,0.202 -7.709,1.074 -7.709,2.118c0,1.044 3.309,1.915 7.709,2.118v7.582h3.913v-7.584c4.393,-0.202 7.694,-1.073 7.694,-2.116c0,-1.043 -3.301,-1.914 -7.694,-2.117"
android:fillColor="#fff"
android:fillType="evenOdd"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">Über Shkiper</string>

<string name="Support">Unterstützung</string>
<string name="support">Unterstützung</string>

<string name="AboutAppDescription">Erstellen, organisieren, erinnern. Ihr perfekter Begleiter für Aufgaben, Notizen und Erinnerungen – schlicht, schön und immer griffbereit.</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<string name="DonateBannerHeader">Did you like the Shkiper?</string>
<string name="DonateBannerBody">Support the developer with a coin!</string>
<string name="AboutNotepad">About Shkiper</string>
<string name="Support">Support</string>
<string name="support">Support</string>
<string name="AboutAppDescription">Create, organize, remember. Your perfect companion for tasks, notes, and reminders – simple, beautiful, and always at hand.</string>
<string name="Contact">Contact</string>
<string name="ChooseEmailClient">Choose an Email client:</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">Acerca de Shkiper</string>

<string name="Support">Apoyo</string>
<string name="support">Apoyo</string>

<string name="AboutAppDescription">Crea, organiza, recuerda. Tu compañero perfecto para tareas, notas y recordatorios: sencillo, bonito y siempre a mano.</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">À propos de Shkiper</string>

<string name="Support">Soutien</string>
<string name="support">Soutien</string>

<string name="AboutAppDescription">Créez, organisez, mémorisez. Votre compagnon idéal pour les tâches, les notes et les rappels – simple, beau et toujours à portée de main.</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">Tentang Shkiper</string>

<string name="Support">Mendukung</string>
<string name="support">Mendukung</string>

<string name="AboutAppDescription">Buat, atur, ingat. Teman sempurna Anda untuk tugas, catatan, dan pengingat – sederhana, cantik, dan selalu siap sedia.</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">A proposito di Shkiper</string>

<string name="Support">Supporto</string>
<string name="support">Supporto</string>

<string name="AboutAppDescription">Crea, organizza, ricorda. Il tuo compagno perfetto per attività, appunti e promemoria: semplice, bello e sempre a portata di mano.</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">シュキパーについて</string>

<string name="Support">サポート</string>
<string name="support">サポート</string>

<string name="AboutAppDescription">作成、整理、記憶。タスク、メモ、リマインダーの完璧なパートナー – シンプルで美しく、いつでも手元にあります。</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">Sobre Shkiper</string>

<string name="Support">Apoiar</string>
<string name="support">Apoiar</string>

<string name="AboutAppDescription">Crie, organize, lembre-se. Seu companheiro perfeito para tarefas, anotações e lembretes – simples, bonito e sempre à mão.</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<string name="DonateBannerHeader">Нравится Shkiper?</string>
<string name="DonateBannerBody">Поддержите разработчика монеткой!</string>
<string name="AboutNotepad">Про Shkiper</string>
<string name="Support">Поддержать</string>
<string name="support">Поддержать</string>
<string name="AboutAppDescription">Создавайте, организовывайте и запоминайте. Ваш идеальный спутник для дел, заметок
и напоминаний – простой, красивый и всегда под рукой.
</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-th/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

<string name="AboutNotepad">เกี่ยวกับ ชคิเปอร์</string>

<string name="Support">สนับสนุน</string>
<string name="support">สนับสนุน</string>

<string name="AboutAppDescription">สร้าง จัดระเบียบ จดจำ เพื่อนที่สมบูรณ์แบบของคุณสำหรับงาน บันทึกย่อ และการเตือนความจำ เรียบง่าย สวยงาม และพร้อมเสมอ</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
<string name="DonateBannerHeader">Shkiper\'ı beğendiniz mi?</string>
<string name="DonateBannerBody">Geliştiriciye bir kuruşla destek olun!</string>
<string name="AboutNotepad">Shkiper hakkında</string>
<string name="Support">Destek</string>
<string name="support">Destek</string>
<string name="AboutAppDescription">Yarat, organize et, hatırla. Görevler, notlar ve hatırlatmalar için mükemmel arkadaşınız – basit, güzel ve her zaman elinizin altında.</string>
<string name="Contact">İletişim</string>
<string name="ChooseEmailClient">Bir e-posta istemcisi seçin:</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<string name="DonateBannerHeader">Подобається Shkiper?</string>
<string name="DonateBannerBody">Підтримайте розробника монетою!</string>
<string name="AboutNotepad">Про Shkiper</string>
<string name="Support">Підтримати</string>
<string name="support">Підтримати</string>
<string name="AboutAppDescription">Створюйте, упорядковуйте, запам’ятовуйте. Ваш ідеальний компаньйон для завдань, нотаток і нагадувань – простий, красивий і завжди під рукою.</string>
<string name="Contact">Зв\'язатися</string>
<string name="ChooseEmailClient">Виберіть поштовий клієнт:</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<string name="DonateBannerHeader">Bạn có thích Shkiper không?</string>
<string name="DonateBannerBody">Hãy ủng hộ nhà phát triển bằng một coin!</string>
<string name="AboutNotepad">Về Shkiper</string>
<string name="Support">Hỗ trợ</string>
<string name="support">Hỗ trợ</string>
<string name="AboutAppDescription">Tạo, tổ chức, ghi nhớ. Người bạn đồng hành hoàn hảo của bạn cho các công việc, ghi chú và lời nhắc – đơn giản, đẹp mắt và luôn trong tầm tay.</string>
<string name="Contact">Liên hệ</string>
<string name="ChooseEmailClient">Chọn ứng dụng Email:</string>
Expand Down
Loading

0 comments on commit ce21de0

Please sign in to comment.