summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2023-04-04 13:42:29 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2023-04-04 20:53:42 +0200
commitb8f649d1cb0d441b274597dc40a200bed4d703e3 (patch)
tree9b6df0664e50fc519c592ea7d81fe0ba1f85e11f /ui/src/main
parent9fa8ca8c77e0e9bec9818ee5e9505e821428e31e (diff)
ui: use ErrorMessages consistently
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main')
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt3
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt3
2 files changed, 4 insertions, 2 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 8a9916a9..ae2c1c91 100644
--- a/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt
+++ b/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt
@@ -14,6 +14,7 @@ import android.widget.Toast
import androidx.preference.Preference
import com.wireguard.android.BuildConfig
import com.wireguard.android.R
+import com.wireguard.android.util.ErrorMessages
class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(context, attrs) {
override fun getSummary() = context.getString(R.string.donate_summary)
@@ -33,7 +34,7 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont
try {
context.startActivity(intent)
} catch (e: Throwable) {
- Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
+ Toast.makeText(context, ErrorMessages[e], 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 9993936a..7d997e8a 100644
--- a/ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt
+++ b/ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt
@@ -16,6 +16,7 @@ import com.wireguard.android.R
import com.wireguard.android.backend.Backend
import com.wireguard.android.backend.GoBackend
import com.wireguard.android.backend.WgQuickBackend
+import com.wireguard.android.util.ErrorMessages
import com.wireguard.android.util.lifecycleScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -34,7 +35,7 @@ class VersionPreference(context: Context, attrs: AttributeSet?) : Preference(con
try {
context.startActivity(intent)
} catch (e: Throwable) {
- Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
+ Toast.makeText(context, ErrorMessages[e], Toast.LENGTH_SHORT).show()
}
}