Updated on 2026-08-14
This commit is contained in:
parent
a0f6e4a008
commit
6c8b59c569
12 changed files with 288 additions and 66 deletions
|
|
@ -37,4 +37,10 @@ interface WalletsRepository {
|
|||
suspend fun enableNFT(userWalletId: UserWalletId)
|
||||
|
||||
suspend fun disableNFT(userWalletId: UserWalletId)
|
||||
|
||||
@Throws
|
||||
suspend fun isNotificationsEnabled(userWalletId: UserWalletId, force: Boolean): Boolean
|
||||
|
||||
@Throws
|
||||
suspend fun setNotificationsEnabled(userWalletId: UserWalletId, isEnabled: Boolean)
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.tangem.domain.wallets.usecase
|
||||
|
||||
import arrow.core.Either
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.domain.wallets.repository.WalletsRepository
|
||||
|
||||
class GetIsNotificationsEnabledUseCase(
|
||||
private val walletsRepository: WalletsRepository,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(userWalletId: UserWalletId, force: Boolean): Either<Throwable, Boolean> = Either.catch {
|
||||
walletsRepository.isNotificationsEnabled(
|
||||
userWalletId = userWalletId,
|
||||
force = force,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.tangem.domain.wallets.usecase
|
||||
|
||||
import arrow.core.Either
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.domain.wallets.repository.WalletsRepository
|
||||
|
||||
class SetNotificationsEnabledUseCase(
|
||||
private val walletsRepository: WalletsRepository,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(userWalletId: UserWalletId, isEnabled: Boolean): Either<Throwable, Unit> =
|
||||
Either.catch {
|
||||
walletsRepository.setNotificationsEnabled(
|
||||
userWalletId = userWalletId,
|
||||
isEnabled = isEnabled,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue