Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/src/main/java/to/bitkit/data/SettingsStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ data class SettingsData(
val isPinEnabled: Boolean = false,
val isPinOnLaunchEnabled: Boolean = false,
val isBiometricEnabled: Boolean = false,
val isPinOnIdleEnabled: Boolean = false,
val isPinForPaymentsEnabled: Boolean = false,
val isDevModeEnabled: Boolean = false,
val showWidgets: Boolean = true,
Expand All @@ -109,7 +108,6 @@ data class SettingsData(
fun SettingsData.resetPin() = this.copy(
isPinEnabled = false,
isPinOnLaunchEnabled = true,
isPinOnIdleEnabled = false,
isPinForPaymentsEnabled = false,
isBiometricEnabled = false,
)
24 changes: 11 additions & 13 deletions app/src/main/java/to/bitkit/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import kotlinx.serialization.Serializable
import to.bitkit.androidServices.LightningNodeService
import to.bitkit.androidServices.LightningNodeService.Companion.CHANNEL_ID_NODE
import to.bitkit.ui.components.AuthCheckView
import to.bitkit.ui.components.InactivityTracker
import to.bitkit.ui.components.IsOnlineTracker
import to.bitkit.ui.components.ToastOverlay
import to.bitkit.ui.onboarding.CreateWalletWithPassphraseScreen
Expand Down Expand Up @@ -96,18 +95,17 @@ class MainActivity : FragmentActivity() {
val isAuthenticated by appViewModel.isAuthenticated.collectAsStateWithLifecycle()

IsOnlineTracker(appViewModel)
InactivityTracker(appViewModel, settingsViewModel) {
ContentView(
appViewModel = appViewModel,
walletViewModel = walletViewModel,
blocktankViewModel = blocktankViewModel,
currencyViewModel = currencyViewModel,
activityListViewModel = activityListViewModel,
transferViewModel = transferViewModel,
settingsViewModel = settingsViewModel,
backupsViewModel = backupsViewModel,
)
}

ContentView(
appViewModel = appViewModel,
walletViewModel = walletViewModel,
blocktankViewModel = blocktankViewModel,
currencyViewModel = currencyViewModel,
activityListViewModel = activityListViewModel,
transferViewModel = transferViewModel,
settingsViewModel = settingsViewModel,
backupsViewModel = backupsViewModel,
)

AnimatedVisibility(
visible = !isAuthenticated,
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/to/bitkit/ui/components/AuthCheckScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ fun AuthCheckScreen(

val isPinOnLaunchEnabled by settings.isPinOnLaunchEnabled.collectAsStateWithLifecycle()
val isBiometricEnabled by settings.isBiometricEnabled.collectAsStateWithLifecycle()
val isPinOnIdleEnabled by settings.isPinOnIdleEnabled.collectAsStateWithLifecycle()
val isPinForPaymentsEnabled by settings.isPinForPaymentsEnabled.collectAsStateWithLifecycle()

AuthCheckView(
Expand All @@ -40,11 +39,6 @@ fun AuthCheckScreen(
navController.popBackStack()
}

AuthCheckAction.TOGGLE_PIN_ON_IDLE -> {
settings.setIsPinOnIdleEnabled(!isPinOnIdleEnabled)
navController.popBackStack()
}

AuthCheckAction.TOGGLE_PIN_FOR_PAYMENTS -> {
settings.setIsPinForPaymentsEnabled(!isPinForPaymentsEnabled)
navController.popBackStack()
Expand All @@ -70,7 +64,6 @@ fun AuthCheckScreen(
object AuthCheckAction {
const val TOGGLE_PIN_ON_LAUNCH = "TOGGLE_PIN_ON_LAUNCH"
const val TOGGLE_BIOMETRICS = "TOGGLE_BIOMETRICS"
const val TOGGLE_PIN_ON_IDLE = "TOGGLE_PIN_ON_IDLE"
const val TOGGLE_PIN_FOR_PAYMENTS = "TOGGLE_PIN_FOR_PAYMENTS"
const val DISABLE_PIN = "DISABLE_PIN"
const val NAV_TO_RESET = "NAV_TO_RESET"
Expand Down
102 changes: 0 additions & 102 deletions app/src/main/java/to/bitkit/ui/components/InactivityTracker.kt

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/java/to/bitkit/ui/settings/SecuritySettingsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ fun SecuritySettingsScreen(
val isPinEnabled by settings.isPinEnabled.collectAsStateWithLifecycle()
val isPinOnLaunchEnabled by settings.isPinOnLaunchEnabled.collectAsStateWithLifecycle()
val isBiometricEnabled by settings.isBiometricEnabled.collectAsStateWithLifecycle()
val isPinOnIdleEnabled by settings.isPinOnIdleEnabled.collectAsStateWithLifecycle()
val isPinForPaymentsEnabled by settings.isPinForPaymentsEnabled.collectAsStateWithLifecycle()
val enableSwipeToHideBalance by settings.enableSwipeToHideBalance.collectAsStateWithLifecycle()
val hideBalanceOnOpen by settings.hideBalanceOnOpen.collectAsStateWithLifecycle()
Expand All @@ -54,7 +53,6 @@ fun SecuritySettingsScreen(
isPinEnabled = isPinEnabled,
isPinOnLaunchEnabled = isPinOnLaunchEnabled,
isBiometricEnabled = isBiometricEnabled,
isPinOnIdleEnabled = isPinOnIdleEnabled,
isPinForPaymentsEnabled = isPinForPaymentsEnabled,
enableSwipeToHideBalance = enableSwipeToHideBalance,
hideBalanceOnOpen = hideBalanceOnOpen,
Expand All @@ -76,11 +74,6 @@ fun SecuritySettingsScreen(
onSuccessActionId = AuthCheckAction.TOGGLE_PIN_ON_LAUNCH,
)
},
onPinOnIdleClick = {
navController.navigateToAuthCheck(
onSuccessActionId = AuthCheckAction.TOGGLE_PIN_ON_IDLE,
)
},
onPinForPaymentsClick = {
navController.navigateToAuthCheck(
onSuccessActionId = AuthCheckAction.TOGGLE_PIN_FOR_PAYMENTS,
Expand Down Expand Up @@ -114,7 +107,6 @@ private fun Content(
isPinEnabled: Boolean,
isPinOnLaunchEnabled: Boolean,
isBiometricEnabled: Boolean,
isPinOnIdleEnabled: Boolean,
isPinForPaymentsEnabled: Boolean,
enableSwipeToHideBalance: Boolean,
hideBalanceOnOpen: Boolean,
Expand All @@ -124,7 +116,6 @@ private fun Content(
onPinClick: () -> Unit = {},
onChangePinClick: () -> Unit = {},
onPinOnLaunchClick: () -> Unit = {},
onPinOnIdleClick: () -> Unit = {},
onPinForPaymentsClick: () -> Unit = {},
onUseBiometricsClick: () -> Unit = {},
onSwipeToHideBalanceClick: () -> Unit = {},
Expand Down Expand Up @@ -198,12 +189,6 @@ private fun Content(
onClick = onPinOnLaunchClick,
modifier = Modifier.testTag("EnablePinOnLaunch"),
)
SettingsSwitchRow(
title = stringResource(R.string.settings__security__pin_idle),
isChecked = isPinOnIdleEnabled,
onClick = onPinOnIdleClick,
modifier = Modifier.testTag("EnablePinOnIdle"),
)
SettingsSwitchRow(
title = stringResource(R.string.settings__security__pin_payments),
isChecked = isPinForPaymentsEnabled,
Expand Down Expand Up @@ -244,7 +229,6 @@ private fun Preview() {
isPinEnabled = true,
isPinOnLaunchEnabled = true,
isBiometricEnabled = false,
isPinOnIdleEnabled = false,
isPinForPaymentsEnabled = false,
enableSwipeToHideBalance = true,
hideBalanceOnOpen = false,
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/java/to/bitkit/viewmodels/SettingsViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,6 @@ class SettingsViewModel @Inject constructor(
}
}

val isPinOnIdleEnabled = settingsStore.data.map { it.isPinOnIdleEnabled }
.asStateFlow(initialValue = false)

fun setIsPinOnIdleEnabled(value: Boolean) {
viewModelScope.launch {
settingsStore.update { it.copy(isPinOnIdleEnabled = value) }
}
}

val isPinForPaymentsEnabled = settingsStore.data.map { it.isPinForPaymentsEnabled }
.asStateFlow(initialValue = false)

Expand Down
6 changes: 6 additions & 0 deletions app/src/test/java/to/bitkit/repositories/ActivityRepoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
import org.mockito.kotlin.wheneverBlocking
import to.bitkit.data.AppCacheData
import to.bitkit.data.AppDb
import to.bitkit.data.CacheStore
import to.bitkit.data.dto.PendingBoostActivity
import to.bitkit.services.CoreService
import to.bitkit.test.BaseUnitTest
import to.bitkit.utils.AddressChecker
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNull
Expand All @@ -33,6 +35,8 @@ class ActivityRepoTest : BaseUnitTest() {
private val coreService: CoreService = mock()
private val lightningRepo: LightningRepo = mock()
private val cacheStore: CacheStore = mock()
private val addressChecker: AddressChecker = mock()
private val db: AppDb = mock()

private lateinit var sut: ActivityRepo

Expand Down Expand Up @@ -71,6 +75,8 @@ class ActivityRepoTest : BaseUnitTest() {
coreService = coreService,
lightningRepo = lightningRepo,
cacheStore = cacheStore,
addressChecker = addressChecker,
db = db
)
}

Expand Down