ui: never throw on link clicks

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2023-04-02 15:26:18 +02:00
parent 9e33d9e56b
commit 3e9ddd8720
2 changed files with 6 additions and 4 deletions

View File

@ -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()
}
}
}

View File

@ -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()
}
}