Updated on 2026-08-14
This commit is contained in:
parent
8af068b74b
commit
fc319f2b70
17 changed files with 518 additions and 68 deletions
|
|
@ -0,0 +1,11 @@
|
|||
package com.tangem.domain.pushnotificationpreferences
|
||||
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.pushnotificationpreferences.repository.WalletPushNotificationPreferencesRepository
|
||||
|
||||
class IsPushNotificationFirstActivationDoneUseCase(
|
||||
private val repository: WalletPushNotificationPreferencesRepository,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(userWalletId: UserWalletId): Boolean = repository.isFirstActivationDone(userWalletId)
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.tangem.domain.pushnotificationpreferences
|
||||
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.pushnotificationpreferences.repository.WalletPushNotificationPreferencesRepository
|
||||
|
||||
class MarkPushNotificationFirstActivationDoneUseCase(
|
||||
private val repository: WalletPushNotificationPreferencesRepository,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(userWalletId: UserWalletId) = repository.markFirstActivationDone(userWalletId)
|
||||
}
|
||||
|
|
@ -6,12 +6,18 @@ import com.tangem.domain.pushnotificationpreferences.models.PushNotificationCate
|
|||
import com.tangem.domain.pushnotificationpreferences.models.WalletPushNotificationPreferences
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
/** Per-wallet push notification preferences. In-memory cache, not persisted. */
|
||||
/** Per-wallet push notification preferences. Values are cached in-memory; the first-activation flag is persisted. */
|
||||
interface WalletPushNotificationPreferencesRepository {
|
||||
|
||||
/** Warms up the cache for [userWalletId]. No-op if already cached. */
|
||||
suspend fun preload(userWalletId: UserWalletId)
|
||||
|
||||
/** Whether the first push-permission activation has already run for [userWalletId]. Persisted. */
|
||||
suspend fun isFirstActivationDone(userWalletId: UserWalletId): Boolean
|
||||
|
||||
/** Marks the first push-permission activation as done for [userWalletId]. */
|
||||
suspend fun markFirstActivationDone(userWalletId: UserWalletId)
|
||||
|
||||
fun observePreferences(userWalletId: UserWalletId): Flow<WalletPushNotificationPreferences>
|
||||
|
||||
/** Updates a single [category]; full-replace PUT under the hood. On failure cache is untouched. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue