Updated on 2026-08-14
This commit is contained in:
parent
74e286f57b
commit
c55274f40f
7 changed files with 68 additions and 1 deletions
|
|
@ -1099,6 +1099,7 @@
|
|||
<string name="unlock_wallet_description_full">Use %s or scan a card/ring to have access to your wallet</string>
|
||||
<string name="unsupported_wc_version">Connection failed: This dApp uses Wallet Connect version 1.0, which is not supported. Please ensure the dApp supports Wallet Connect version 2.0 to connect successfully.</string>
|
||||
<string name="user_push_notification_agreement_argument_one">Stay up to date with the latest features and news</string>
|
||||
<string name="user_push_notification_agreement_argument_three">Get notified of incoming transactions</string>
|
||||
<string name="user_push_notification_agreement_argument_two">Be the first to know about new promotions</string>
|
||||
<string name="user_push_notification_agreement_header">Would you like to use\nPush-notifications?</string>
|
||||
<string name="user_wallet_list_add_button">Add new wallet</string>
|
||||
|
|
|
|||
31
core/ui/src/main/res/drawable/ic_notifications_24.xml
Normal file
31
core/ui/src/main/res/drawable/ic_notifications_24.xml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12.5,3H11.5C7.022,3 4.782,3 3.391,4.391C2,5.782 2,8.022 2,12.5C2,16.978 2,19.218 3.391,20.609C4.782,22 7.022,22 11.5,22C15.978,22 18.218,22 19.609,20.609C21,19.218 21,16.978 21,12.5V11.5"
|
||||
android:strokeWidth="1.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M22,5.5C22,7.433 20.433,9 18.5,9C16.567,9 15,7.433 15,5.5C15,3.567 16.567,2 18.5,2C20.433,2 22,3.567 22,5.5Z"
|
||||
android:strokeWidth="1.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M7,11H11"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M7,16H15"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
|
|
@ -38,6 +38,7 @@ dependencies {
|
|||
|
||||
/** Domain module */
|
||||
implementation(projects.domain.settings)
|
||||
implementation(projects.domain.notifications.toggles)
|
||||
|
||||
/** Feature modules */
|
||||
implementation(projects.features.pushNotifications.api)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.tangem.features.pushnotifications.impl
|
|||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import com.tangem.core.decompose.context.AppComponentContext
|
||||
|
|
@ -25,6 +27,7 @@ internal class DefaultPushNotificationsComponent @AssistedInject constructor(
|
|||
@Composable
|
||||
override fun Content(modifier: Modifier) {
|
||||
val activity = LocalContext.current.findActivity()
|
||||
val state by model.state.collectAsState()
|
||||
BackHandler(onBack = { activity.finish() })
|
||||
NavigationBar3ButtonsScrim()
|
||||
PushNotificationsScreen(
|
||||
|
|
@ -32,6 +35,7 @@ internal class DefaultPushNotificationsComponent @AssistedInject constructor(
|
|||
onNeverRequest = model::onNeverRequest,
|
||||
onAllowPermission = model::onAllowPermission,
|
||||
onDenyPermission = model::onDenyPermission,
|
||||
showNotificationsInfo = state.showInfoAboutNotifications,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,15 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler
|
|||
import com.tangem.core.analytics.models.AnalyticsParam
|
||||
import com.tangem.core.decompose.di.ModelScoped
|
||||
import com.tangem.core.decompose.model.Model
|
||||
import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles
|
||||
import com.tangem.domain.settings.NeverRequestPermissionUseCase
|
||||
import com.tangem.domain.settings.NeverToInitiallyAskPermissionUseCase
|
||||
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
|
||||
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
|
||||
import com.tangem.features.pushnotifications.impl.presentation.state.PushNotificationsUM
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -23,8 +27,17 @@ internal class PushNotificationsModel @Inject constructor(
|
|||
private val neverToInitiallyAskPermissionUseCase: NeverToInitiallyAskPermissionUseCase,
|
||||
private val appRouter: AppRouter,
|
||||
private val analyticHandler: AnalyticsEventHandler,
|
||||
private val notificationsFeatureToggles: NotificationsFeatureToggles,
|
||||
) : Model(), PushNotificationsClickIntents {
|
||||
|
||||
private val _state = MutableStateFlow(
|
||||
PushNotificationsUM(
|
||||
showInfoAboutNotifications = notificationsFeatureToggles.isNotificationsEnabled,
|
||||
),
|
||||
)
|
||||
|
||||
val state = _state.asStateFlow()
|
||||
|
||||
override fun onRequest() {
|
||||
analyticHandler.send(
|
||||
PushNotificationAnalyticEvents.ButtonAllow(AnalyticsParam.ScreensSources.Stories),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package com.tangem.features.pushnotifications.impl.presentation.state
|
||||
|
||||
data class PushNotificationsUM(
|
||||
val showInfoAboutNotifications: Boolean = false,
|
||||
)
|
||||
|
|
@ -18,6 +18,7 @@ internal fun PushNotificationsScreen(
|
|||
onNeverRequest: () -> Unit,
|
||||
onAllowPermission: () -> Unit,
|
||||
onDenyPermission: () -> Unit,
|
||||
showNotificationsInfo: Boolean,
|
||||
) {
|
||||
val requestPushPermission = requestPushPermission(
|
||||
onAllow = onAllowPermission,
|
||||
|
|
@ -37,7 +38,18 @@ internal fun PushNotificationsScreen(
|
|||
R.drawable.ic_storefront_24,
|
||||
resourceReference(R.string.user_push_notification_agreement_argument_two),
|
||||
),
|
||||
),
|
||||
).let { baseItems ->
|
||||
if (showNotificationsInfo) {
|
||||
baseItems.add(
|
||||
ShowcaseItemModel(
|
||||
R.drawable.ic_notifications_24,
|
||||
resourceReference(R.string.user_push_notification_agreement_argument_three),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
baseItems
|
||||
}
|
||||
},
|
||||
primaryButton = ShowcaseButtonModel(
|
||||
buttonText = resourceReference(R.string.common_allow),
|
||||
onClick = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue