mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 03:18:23 +00:00
Add loading indicator when sending crash and translation reports
Send button now triggers the existing full-screen progress overlay so users get visual feedback while the relay publish (or clipboard hand-off) is in flight, matching the FeedbackScreen behavior.
This commit is contained in:
@@ -59,6 +59,7 @@ fun CrashReportScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
account: Account,
|
||||
onDismiss: () -> Unit,
|
||||
onLoading: (Boolean) -> Unit = {},
|
||||
) {
|
||||
val initialStack = remember { Amber.instance.pendingCrashReport ?: "" }
|
||||
var editedStack by remember { mutableStateOf(initialStack) }
|
||||
@@ -115,12 +116,15 @@ fun CrashReportScreen(
|
||||
Button(
|
||||
modifier = Modifier.weight(1f),
|
||||
onClick = {
|
||||
if (editedStack.isBlank()) return@Button
|
||||
onLoading(true)
|
||||
ReportSender.send(
|
||||
account = account,
|
||||
report = editedStack,
|
||||
clipboard = clipboardManager,
|
||||
onDone = {
|
||||
Amber.instance.pendingCrashReport = null
|
||||
onLoading(false)
|
||||
onDismiss()
|
||||
},
|
||||
)
|
||||
|
||||
@@ -989,6 +989,9 @@ fun MainScreen(
|
||||
navController.navController.navigateUp()
|
||||
}
|
||||
},
|
||||
onLoading = {
|
||||
isLoading = it
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
@@ -1009,6 +1012,9 @@ fun MainScreen(
|
||||
navController.navController.navigateUp()
|
||||
}
|
||||
},
|
||||
onLoading = {
|
||||
isLoading = it
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -72,6 +72,7 @@ fun TranslationReportScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
account: Account,
|
||||
onDismiss: () -> Unit,
|
||||
onLoading: (Boolean) -> Unit = {},
|
||||
) {
|
||||
val initialMessage = remember { Amber.instance.pendingTranslationReport.value ?: "" }
|
||||
var editedMessage by remember { mutableStateOf(initialMessage) }
|
||||
@@ -129,6 +130,7 @@ fun TranslationReportScreen(
|
||||
modifier = Modifier.weight(1f),
|
||||
onClick = {
|
||||
val report = editedMessage.ifBlank { return@Button }
|
||||
onLoading(true)
|
||||
if (BuildFlavorChecker.isOfflineFlavor()) {
|
||||
Amber.instance.applicationIOScope.launch(Dispatchers.Main) {
|
||||
try {
|
||||
@@ -141,9 +143,11 @@ fun TranslationReportScreen(
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
Amber.instance.startActivity(intent)
|
||||
Amber.instance.pendingTranslationReport.value = null
|
||||
onLoading(false)
|
||||
onDismiss()
|
||||
} catch (_: Exception) {
|
||||
Amber.instance.pendingTranslationReport.value = null
|
||||
onLoading(false)
|
||||
onDismiss()
|
||||
}
|
||||
}
|
||||
@@ -171,6 +175,7 @@ fun TranslationReportScreen(
|
||||
)
|
||||
}
|
||||
Amber.instance.pendingTranslationReport.value = null
|
||||
onLoading(false)
|
||||
onDismiss()
|
||||
delay(10000)
|
||||
client.disconnect()
|
||||
|
||||
Reference in New Issue
Block a user