Updated on 2026-08-14

This commit is contained in:
Tangem 2024-06-17 13:17:56 +05:00
parent dd6d478c4f
commit 7f131732ff
14 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,20 @@
package com.tangem.tap.common.settings
import android.content.Intent
import android.net.Uri
import android.provider.Settings
import com.tangem.core.navigation.settings.SettingsManager
import com.tangem.tap.foregroundActivityObserver
import com.tangem.tap.withForegroundActivity
internal class IntentSettingsManager : SettingsManager {
override fun openSettings() {
foregroundActivityObserver.withForegroundActivity { activity ->
val openSettingsIntent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", activity.packageName, null),
)
activity.startActivity(openSettingsIntent)
}
}
}

View file

@ -3,10 +3,12 @@ package com.tangem.tap.di
import android.content.Context
import com.tangem.core.navigation.feedback.FeedbackManager
import com.tangem.core.navigation.finisher.AppFinisher
import com.tangem.core.navigation.settings.SettingsManager
import com.tangem.core.navigation.share.ShareManager
import com.tangem.core.navigation.url.UrlOpener
import com.tangem.tap.common.feedback.ProxyFeedbackManager
import com.tangem.tap.common.finisher.AndroidAppFinisher
import com.tangem.tap.common.settings.IntentSettingsManager
import com.tangem.tap.common.share.IntentShareManager
import com.tangem.tap.common.url.CustomTabsUrlOpener
import dagger.Module
@ -35,4 +37,8 @@ internal object UtilsModule {
@Provides
@Singleton
fun provideAppFinisher(@ApplicationContext context: Context): AppFinisher = AndroidAppFinisher(context)
@Provides
@Singleton
fun provideSettingsManager(): SettingsManager = IntentSettingsManager()
}

View file

@ -42,5 +42,9 @@
{
"name": "DETAILS_REDESIGN_ENABLED",
"version": "undefined"
},
{
"name": "PUSH_NOTIFICATIONS_ENABLED",
"version": "undefined"
}
]

View file

@ -0,0 +1,5 @@
package com.tangem.core.navigation.settings
class DummySettingsManager : SettingsManager {
override fun openSettings() { /* no-op */ }
}

View file

@ -0,0 +1,5 @@
package com.tangem.core.navigation.settings
interface SettingsManager {
fun openSettings()
}

View file

@ -43,6 +43,7 @@ dependencies {
/** Other libraries */
implementation(deps.compose.accompanist.systemUiController)
implementation(deps.compose.accompanist.permission)
implementation(deps.material)
implementation(deps.compose.shimmer)
implementation(deps.kotlin.immutable.collections)

View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,15 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
id("configuration")
}
android {
namespace = "com.tangem.features.pushnotifications.api"
}
dependencies {
/** AndroidX */
implementation(deps.androidx.fragment.ktx)
}

View file

@ -0,0 +1,9 @@
package com.tangem.features.pushnotifications.api.featuretoggles
/**
* Push notifications feature toggles
*/
interface PushNotificationsFeatureToggles {
/** Availability of push notifications */
val isRedesignedSendEnabled: Boolean
}

View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,42 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
alias(deps.plugins.kotlin.kapt)
alias(deps.plugins.hilt.android)
id("configuration")
}
android {
namespace = "com.tangem.feature.pushnotifications.impl"
}
dependencies {
/** AndroidX */
implementation(deps.androidx.fragment.ktx)
implementation(deps.androidx.activity.compose)
/** Compose */
implementation(deps.compose.foundation)
implementation(deps.compose.accompanist.systemUiController)
implementation(deps.compose.accompanist.permission)
/** Other dependencies */
implementation(deps.timber)
implementation(deps.arrow.core)
implementation(deps.kotlin.immutable.collections)
/** Core modules */
implementation(projects.core.ui)
implementation(projects.core.featuretoggles)
/** Domain module */
implementation(projects.domain.settings)
/** Feature modules */
implementation(projects.features.pushNotifications.api)
/** DI */
implementation(deps.hilt.android)
implementation(project(":core:navigation"))
kapt(deps.hilt.kapt)
}

View file

@ -0,0 +1,24 @@
package com.tangem.features.pushnotifications.impl.di
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
import com.tangem.features.pushnotifications.api.featuretoggles.PushNotificationsFeatureToggles
import com.tangem.features.pushnotifications.impl.featuretoggles.DefaultPushNotificationsFeatureToggles
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
/**
* DI module provides implementation of [PushNotificationsFeatureToggles]
*/
@Module
@InstallIn(SingletonComponent::class)
internal object PushNotificationsFeatureTogglesModule {
@Provides
@Singleton
fun provideSendFeatureToggles(featureTogglesManager: FeatureTogglesManager): PushNotificationsFeatureToggles {
return DefaultPushNotificationsFeatureToggles(featureTogglesManager = featureTogglesManager)
}
}

View file

@ -0,0 +1,11 @@
package com.tangem.features.pushnotifications.impl.featuretoggles
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
import com.tangem.features.pushnotifications.api.featuretoggles.PushNotificationsFeatureToggles
internal class DefaultPushNotificationsFeatureToggles(
private val featureTogglesManager: FeatureTogglesManager,
) : PushNotificationsFeatureToggles {
override val isRedesignedSendEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled("PUSH_NOTIFICATIONS_ENABLED")
}

View file

@ -180,6 +180,9 @@ include(":features:details:impl")
include(":features:disclaimer:api")
include(":features:disclaimer:impl")
include(":features:push-notifications:api")
include(":features:push-notifications:impl")
// endregion Feature modules
// region Domain modules