mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 10:58:23 +00:00
Use applicationIOScope for account export
- Replace `rememberCoroutineScope` with `Amber.instance.applicationIOScope` in `ExportAllAccountsScreen`. - Ensure export operations persist even if the screen is decomposed during the process.
This commit is contained in:
@@ -32,7 +32,6 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||||
@@ -49,6 +48,7 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.text.input.VisualTransformation
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.greenart7c3.nostrsigner.Amber
|
||||||
import com.greenart7c3.nostrsigner.LocalPreferences
|
import com.greenart7c3.nostrsigner.LocalPreferences
|
||||||
import com.greenart7c3.nostrsigner.R
|
import com.greenart7c3.nostrsigner.R
|
||||||
import com.greenart7c3.nostrsigner.service.AccountExportService
|
import com.greenart7c3.nostrsigner.service.AccountExportService
|
||||||
@@ -73,7 +73,6 @@ fun ExportAllAccountsScreen(
|
|||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val scope = rememberCoroutineScope()
|
|
||||||
var isLoading by remember { mutableStateOf(false) }
|
var isLoading by remember { mutableStateOf(false) }
|
||||||
var exportProgress by remember { mutableStateOf("") }
|
var exportProgress by remember { mutableStateOf("") }
|
||||||
var accountCount by remember { mutableIntStateOf(0) }
|
var accountCount by remember { mutableIntStateOf(0) }
|
||||||
@@ -97,7 +96,7 @@ fun ExportAllAccountsScreen(
|
|||||||
ActivityResultContracts.CreateDocument("application/octet-stream"),
|
ActivityResultContracts.CreateDocument("application/octet-stream"),
|
||||||
) { uri ->
|
) { uri ->
|
||||||
uri?.let {
|
uri?.let {
|
||||||
scope.launch(Dispatchers.IO) {
|
Amber.instance.applicationIOScope.launch {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
exportProgress = context.getString(R.string.preparing_export)
|
exportProgress = context.getString(R.string.preparing_export)
|
||||||
|
|
||||||
@@ -328,7 +327,7 @@ fun ExportAllAccountsScreen(
|
|||||||
showConfirmationDialog = true
|
showConfirmationDialog = true
|
||||||
},
|
},
|
||||||
onError = { _, message ->
|
onError = { _, message ->
|
||||||
scope.launch {
|
Amber.instance.applicationIOScope.launch(Dispatchers.Main) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
message,
|
message,
|
||||||
|
|||||||
Reference in New Issue
Block a user