diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt index 5ce261ac03b7..a25c30e4e1e2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt @@ -1,8 +1,5 @@ package net.mullvad.mullvadvpn.compose.dialog.payment -import android.app.Activity -import android.content.Context -import android.content.ContextWrapper import androidx.compose.material3.AlertDialog import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -20,13 +17,13 @@ import androidx.compose.ui.tooling.preview.Preview import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.result.ResultBackNavigator import com.ramcosta.composedestinations.spec.DestinationStyle -import kotlinx.coroutines.flow.collect import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.button.PrimaryButton import net.mullvad.mullvadvpn.compose.component.MullvadCircularProgressIndicatorMedium import net.mullvad.mullvadvpn.lib.payment.model.ProductId import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.lib.theme.color.AlphaDescription +import net.mullvad.mullvadvpn.util.getActivity import net.mullvad.mullvadvpn.viewmodel.PaymentUiSideEffect import net.mullvad.mullvadvpn.viewmodel.PaymentViewModel import org.koin.androidx.compose.koinViewModel @@ -222,11 +219,3 @@ fun PaymentDialog( } ) } - -private fun Context.getActivity(): Activity? { - return when (this) { - is Activity -> this - is ContextWrapper -> this.baseContext.getActivity() - else -> null - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/extension/ContextExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/extension/ContextExtensions.kt deleted file mode 100644 index f747ae169dd7..000000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/extension/ContextExtensions.kt +++ /dev/null @@ -1,11 +0,0 @@ -package net.mullvad.mullvadvpn.ui.extension - -import android.content.ClipData -import android.content.ClipboardManager -import android.content.Context - -fun Context.copyToClipboard(content: String, clipboardLabel: String) { - val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager - val clipData = ClipData.newPlainText(clipboardLabel, content) - clipboard.setPrimaryClip(clipData) -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ContextExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ContextExtensions.kt new file mode 100644 index 000000000000..fd004562a342 --- /dev/null +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ContextExtensions.kt @@ -0,0 +1,13 @@ +package net.mullvad.mullvadvpn.util + +import android.app.Activity +import android.content.Context +import android.content.ContextWrapper + +fun Context.getActivity(): Activity? { + return when (this) { + is Activity -> this + is ContextWrapper -> this.baseContext.getActivity() + else -> null + } +}