Skip to content

Commit

Permalink
Report number of successful imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Feb 17, 2023
1 parent f0755d3 commit f1cb2e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,22 @@ internal object BackupHandler {
)
}
val progressStep = 50 / backup.pins.size
var imports = 0
backup.pins.forEach {
savePinFile(context, it.fileName, it.pinTable, it.siid)
val imported = savePinFile(context, it.fileName, it.pinTable, it.siid)
if (imported) imports += 1
progressBar.progress = progressBar.progress + progressStep
progressNote.text = context.getString(
R.string.dialog_import_state_saving,
progressBar.progress + progressStep
)
}
progressBar.progress = 100
progressNote.text = context.getString(R.string.dialog_import_state_finished)
progressNote.text = context.getString(
R.string.dialog_import_state_finished,
imports,
backup.pins.size
)
progressDialog.dialogReference.setCancelable(true)
} catch (e: Exception) {
e.printStackTrace()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<string name="dialog_import_title">PIN Import</string>
<string name="dialog_import_state_retrieving">%d\%% - Reading backup file…</string>
<string name="dialog_import_state_saving">%d\%% - Saving restored content…</string>
<string name="dialog_import_state_finished">100% - PIN import completed</string>
<string name="dialog_import_state_finished">100\%% - PIN import completed\n%1$d of %2$d PINs imported</string>
<string name="dialog_import_error">Import error</string>
<string name="dialog_image_title">PIN table image</string>
<string name="dialog_image_message">Are you sure?\n\nYou are about to save this unencrypted PIN table to %s.</string>
Expand Down

0 comments on commit f1cb2e3

Please sign in to comment.