ui: use ErrorMessages consistently
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
9fa8ca8c77
commit
b8f649d1cb
@ -14,6 +14,7 @@ import android.widget.Toast
|
|||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import com.wireguard.android.BuildConfig
|
import com.wireguard.android.BuildConfig
|
||||||
import com.wireguard.android.R
|
import com.wireguard.android.R
|
||||||
|
import com.wireguard.android.util.ErrorMessages
|
||||||
|
|
||||||
class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(context, attrs) {
|
class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(context, attrs) {
|
||||||
override fun getSummary() = context.getString(R.string.donate_summary)
|
override fun getSummary() = context.getString(R.string.donate_summary)
|
||||||
@ -33,7 +34,7 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont
|
|||||||
try {
|
try {
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, ErrorMessages[e], Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,6 +16,7 @@ import com.wireguard.android.R
|
|||||||
import com.wireguard.android.backend.Backend
|
import com.wireguard.android.backend.Backend
|
||||||
import com.wireguard.android.backend.GoBackend
|
import com.wireguard.android.backend.GoBackend
|
||||||
import com.wireguard.android.backend.WgQuickBackend
|
import com.wireguard.android.backend.WgQuickBackend
|
||||||
|
import com.wireguard.android.util.ErrorMessages
|
||||||
import com.wireguard.android.util.lifecycleScope
|
import com.wireguard.android.util.lifecycleScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -34,7 +35,7 @@ class VersionPreference(context: Context, attrs: AttributeSet?) : Preference(con
|
|||||||
try {
|
try {
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, ErrorMessages[e], Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user