Skip to content

Commit

Permalink
fix: handle nested exception (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-95 authored May 4, 2022
1 parent 50e7104 commit 2586be3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,24 @@ class FirstActivity : AppCompatActivity(), View.OnClickListener,
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName")))
} catch (e: ActivityNotFoundException) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=$packageName")
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=$packageName")
)
)
)
} catch (e: ActivityNotFoundException) {
val builder = AlertDialog.Builder(this)
builder.setTitle(getString(R.string.google_play_intent_error_title))
builder.setMessage(getString(R.string.google_play_intent_error_message))

builder.setPositiveButton(getString(R.string.ok)) { _, _ ->
}
val dialog = builder.create()
dialog.setCancelable(false)
dialog.show()
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
<string name="userDataDoesNotMatch">Dati anagrafici non congruenti</string>
<string name="scan_mode_fragment_title">Modalità di verifica della <b>Certificazione</b></string>
<string name="confirm_scan_mode_button">Conferma</string>
<string name="google_play_intent_error_title">Impossibile aprire Google Play</string>
<string name="google_play_intent_error_message">Errore nell\'apertura della pagina di VerificaC19 su Google Play. Apri lo store manualmente per aggiornare l\'app.</string>

<string name="no_permissions_granted_camera_title">Permessi fotocamera necessari</string>
<string name="no_permissions_granted_camera_message">VerificaC19 necessita di accedere alla fotocamera del telefono. Apri le impostazioni per autorizzare l\'app.</string>
Expand Down

0 comments on commit 2586be3

Please sign in to comment.