ソースを参照

ui: wizard: Handle download success

Turns out when you test only errors you forget things can actually
succeed...
Peter Cai 1 年間 前
コミット
700578a369

+ 6 - 5
app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardProgressFragment.kt

@@ -113,18 +113,19 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
                     is EuiccChannelManagerService.ForegroundTaskState.Done -> {
                         hideProgressBar()
 
-                        // Change the state of the last InProgress item to Error
+                        state.downloadError =
+                            it.error as? LocalProfileAssistant.ProfileDownloadException
+
+                        // Change the state of the last InProgress item to success (or error)
                         progressItems.forEachIndexed { index, progressItem ->
                             if (progressItem.state == ProgressState.InProgress) {
-                                progressItem.state = ProgressState.Error
+                                progressItem.state =
+                                    if (state.downloadError == null) ProgressState.Done else ProgressState.Error
                             }
 
                             adapter.notifyItemChanged(index)
                         }
 
-                        state.downloadError =
-                            it.error as? LocalProfileAssistant.ProfileDownloadException
-
                         isDone = true
                         refreshButtons()
                     }