diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-04-02 15:26:18 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-04-04 15:31:52 +0200 |
commit | 3e9ddd87203899a11e6887e448bf4510cb2b9e8a (patch) | |
tree | 5975ba71df39a1907947dc9191f6186e27d1cb39 | |
parent | 9e33d9e56b180ff8b18ceaecbdc54e192e6557b5 (diff) |
ui: never throw on link clicks
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt | 5 | ||||
-rw-r--r-- | ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt b/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt index 57202c81..8a9916a9 100644 --- a/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt +++ b/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt @@ -6,11 +6,11 @@ package com.wireguard.android.preference import android.app.AlertDialog -import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent import android.net.Uri import android.util.AttributeSet +import android.widget.Toast import androidx.preference.Preference import com.wireguard.android.BuildConfig import com.wireguard.android.R @@ -32,7 +32,8 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont intent.data = Uri.parse("https://www.wireguard.com/donations/") try { context.startActivity(intent) - } catch (ignored: ActivityNotFoundException) { + } catch (e: Throwable) { + Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show() } } }
\ No newline at end of file diff --git a/ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt b/ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt index 31c751d2..9993936a 100644 --- a/ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt +++ b/ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt @@ -4,11 +4,11 @@ */ package com.wireguard.android.preference -import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent import android.net.Uri import android.util.AttributeSet +import android.widget.Toast import androidx.preference.Preference import com.wireguard.android.Application import com.wireguard.android.BuildConfig @@ -33,7 +33,8 @@ class VersionPreference(context: Context, attrs: AttributeSet?) : Preference(con intent.data = Uri.parse("https://www.wireguard.com/") try { context.startActivity(intent) - } catch (_: ActivityNotFoundException) { + } catch (e: Throwable) { + Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show() } } |