Skip to content

Commit 25f16eb

Browse files
committed
fix: use new launchScan flow
1 parent 43e757d commit 25f16eb

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

app/src/main/java/to/bitkit/ui/ContentView.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ import to.bitkit.viewmodels.RestoreState
190190
import to.bitkit.viewmodels.SettingsViewModel
191191
import to.bitkit.viewmodels.TransferViewModel
192192
import to.bitkit.viewmodels.WalletViewModel
193-
import kotlin.time.Duration.Companion.milliseconds
194193

195194
@Suppress("CyclomaticComplexMethod")
196195
@Composable

app/src/main/java/to/bitkit/ui/sheets/QrScanningSheet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import to.bitkit.viewmodels.AppViewModel
1111
@Composable
1212
fun QrScanningSheet(appViewModel: AppViewModel) {
1313
Content(
14-
onBack = { appViewModel.hideSheet() },
14+
onBack = { appViewModel.hideScannerSheet() },
1515
onScanSuccess = { appViewModel.onScannerSheetResult(it) },
1616
)
1717
}

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,10 +2143,15 @@ class AppViewModel @Inject constructor(
21432143
handler(data)
21442144
}
21452145
} else {
2146-
onScanResult(data, startDelay = SCREEN_TRANSITION_DELAY)
2146+
launchScan(source = ScanSource.SCANNER_SHEET, data = data, startDelay = SCREEN_TRANSITION_DELAY)
21472147
}
21482148
}
21492149

2150+
fun hideScannerSheet() {
2151+
scanResultHandler = null
2152+
hideSheet()
2153+
}
2154+
21502155
fun showSheet(sheetType: Sheet) {
21512156
viewModelScope.launch {
21522157
_currentSheet.value?.let {
@@ -2402,6 +2407,7 @@ class AppViewModel @Inject constructor(
24022407
private enum class ScanSource(val label: String) {
24032408
PASTE("paste"),
24042409
SCAN_RESULT("scan result"),
2410+
SCANNER_SHEET("scanner sheet"),
24052411
ADDRESS_CONTINUE("address continue"),
24062412
DEEPLINK("deeplink"),
24072413
}

0 commit comments

Comments
 (0)