Skip to content

Commit ee71cb5

Browse files
bmc08gtclaude
andcommitted
chore: remove deprecated BaseViewModel
Migrate BaseAccessKeyViewModel and SeedInputViewModel to extend ViewModel() directly, inlining the getString() helper. Delete the now-unused BaseViewModel — the last RxJava-era vestige. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c039e23 commit ee71cb5

3 files changed

Lines changed: 12 additions & 36 deletions

File tree

apps/flipcash/features/login/src/main/kotlin/com/flipcash/app/login/seed/SeedInputViewModel.kt

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import com.getcode.manager.BottomBarManager
1818
import com.getcode.navigation.core.CodeNavigator
1919
import com.getcode.opencode.managers.MnemonicManager
2020
import com.getcode.util.resources.ResourceHelper
21-
import com.getcode.view.BaseViewModel
21+
import androidx.lifecycle.ViewModel
2222
import dagger.hilt.android.lifecycle.HiltViewModel
2323
import kotlinx.coroutines.CoroutineScope
2424
import kotlinx.coroutines.Dispatchers
@@ -47,7 +47,7 @@ class SeedInputViewModel @Inject constructor(
4747
private val userFlags: UserFlagsCoordinator,
4848
private val resources: ResourceHelper,
4949
private val mnemonicManager: MnemonicManager,
50-
) : BaseViewModel(resources) {
50+
) : ViewModel() {
5151
val uiFlow = MutableStateFlow(SeedInputUiModel())
5252
private val mnemonicCode = mnemonicManager.mnemonicCode
5353

@@ -99,8 +99,8 @@ class SeedInputViewModel @Inject constructor(
9999
.onFailure {
100100
if (it is AuthManager.AuthManagerException.TimelockUnlockedException) {
101101
BottomBarManager.showAlert(
102-
getString(R.string.error_title_timelockUnlocked),
103-
getString(R.string.error_description_timelockUnlocked)
102+
resources.getString(R.string.error_title_timelockUnlocked),
103+
resources.getString(R.string.error_description_timelockUnlocked)
104104
)
105105
navigator.popAll()
106106
} else {
@@ -118,8 +118,8 @@ class SeedInputViewModel @Inject constructor(
118118
}.onFailure {
119119
setState(isLoading = false, isSuccess = false, isContinueEnabled = false)
120120
BottomBarManager.showError(
121-
getString(R.string.error_title_loginFailed),
122-
getString(R.string.error_description_loginFailed)
121+
resources.getString(R.string.error_title_loginFailed),
122+
resources.getString(R.string.error_description_loginFailed)
123123
)
124124
}
125125
} else {
@@ -157,8 +157,8 @@ class SeedInputViewModel @Inject constructor(
157157
is SelectCredentialError.UserCancelled -> { /* no op */ }
158158
else -> {
159159
BottomBarManager.showError(
160-
getString(R.string.error_title_selectCredential),
161-
getString(R.string.error_description_selectCredential)
160+
resources.getString(R.string.error_title_selectCredential),
161+
resources.getString(R.string.error_description_selectCredential)
162162
)
163163
}
164164
}
@@ -175,15 +175,6 @@ class SeedInputViewModel @Inject constructor(
175175
}
176176
}
177177

178-
override fun setIsLoading(isLoading: Boolean) {
179-
uiFlow.update {
180-
it.copy(
181-
isLoading = isLoading,
182-
continueEnabled = false
183-
)
184-
}
185-
}
186-
187178
private fun getValidCount(userWordList: List<String>, mnemonicWordList: List<String>): Int {
188179
return userWordList.filter { it in mnemonicWordList }.size
189180
}

apps/flipcash/shared/accesskey/src/main/kotlin/com/flipcash/app/accesskey/BaseAccessKeyViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import com.getcode.theme.White
2727
import com.getcode.ui.utils.toAGColor
2828
import com.getcode.util.resources.ResourceHelper
2929
import com.getcode.utils.decodeBase64
30-
import com.getcode.view.BaseViewModel
30+
import androidx.lifecycle.ViewModel
3131
import com.getcode.view.LoadingSuccessState
3232
import kotlinx.coroutines.CoroutineScope
3333
import kotlinx.coroutines.Dispatchers
@@ -66,7 +66,7 @@ abstract class BaseAccessKeyViewModel(
6666
private val mediaScanner: MediaScanner,
6767
userManager: UserManager,
6868
private val qrCodeGenerator: QRCodeGenerator
69-
) : BaseViewModel(resources) {
69+
) : ViewModel() {
7070
val uiFlow = MutableStateFlow(AccessKeyUiModel())
7171

7272
init {
@@ -177,7 +177,7 @@ abstract class BaseAccessKeyViewModel(
177177
drawPaint(paintBackground)
178178
}
179179

180-
val topTextChunks = getString(R.string.subtitle_accessKeySnapshotWarning)
180+
val topTextChunks = resources.getString(R.string.subtitle_accessKeySnapshotWarning)
181181
.split(" ", "\n")
182182
.chunked(7)
183183
.map { it.joinToString(" ") }
@@ -253,7 +253,7 @@ abstract class BaseAccessKeyViewModel(
253253
text = accessKeyText[1]
254254
)
255255

256-
val bottomTextChunks = getString(R.string.subtitle_accessKeySnapshotDescription)
256+
val bottomTextChunks = resources.getString(R.string.subtitle_accessKeySnapshotDescription)
257257
.split(" ")
258258
.chunked(8)
259259
.map { it.joinToString(" ") }

ui/navigation/src/main/kotlin/com/getcode/view/BaseViewModel.kt

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)