diff options
Diffstat (limited to 'android/src/main')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/NotificationWithUrl.kt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/NotificationWithUrl.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/NotificationWithUrl.kt new file mode 100644 index 0000000000..4257f8d2a6 --- /dev/null +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/NotificationWithUrl.kt @@ -0,0 +1,21 @@ +package net.mullvad.mullvadvpn.ui.notification + +import android.content.Context +import android.content.Intent +import android.net.Uri + +abstract class NotificationWithUrl( + protected val context: Context, + urlId: Int +) : InAppNotification() { + private val url = Uri.parse(context.getString(urlId)) + + protected val openUrl: suspend () -> Unit = { + context.startActivity(Intent(Intent.ACTION_VIEW, url)) + } + + init { + onClick = openUrl + showIcon = true + } +} |
