Skip to content

Commit

Permalink
ui: use ErrorMessages consistently
Browse files Browse the repository at this point in the history
Signed-off-by: Jason A. Donenfeld <[email protected]>
  • Loading branch information
zx2c4 committed Apr 4, 2023
1 parent e683e5b commit b1324e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import android.util.AttributeSet
import android.widget.Toast
import androidx.preference.Preference
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)
Expand Down Expand Up @@ -48,7 +49,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()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
}

Expand Down

0 comments on commit b1324e2

Please sign in to comment.