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-02 15:37:55 +0200 |
commit | 45a2b4660945f709edc9670fcfc06af838cbdeb4 (patch) | |
tree | 0a921fb12a2fd5d3e48a671ac070aafd12135b1a | |
parent | 4003e6862c3c76e6b72dc5219f8189bc0d1ba0fa (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() } } |