diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1df73d76e699..8998ff7d7c3f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -90,15 +90,12 @@ - - - + + diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt index 06fa5442ec2f..7ff8aa11aa03 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt @@ -1,9 +1,6 @@ package net.mullvad.mullvadvpn.compose.screen import android.content.Context -import android.content.Intent -import android.net.Uri -import android.util.Log import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn @@ -17,20 +14,26 @@ import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import kotlinx.coroutines.launch import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.component.MullvadCircularProgressIndicatorMedium import net.mullvad.mullvadvpn.compose.component.MullvadMediumTopBar +import net.mullvad.mullvadvpn.compose.component.MullvadSnackbar import net.mullvad.mullvadvpn.compose.component.NavigateBackIconButton import net.mullvad.mullvadvpn.compose.component.drawVerticalScrollbar +import net.mullvad.mullvadvpn.compose.util.createCopyToClipboardHandle import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.lib.theme.Dimens import net.mullvad.mullvadvpn.lib.theme.color.AlphaScrollbar @@ -57,13 +60,30 @@ fun ViewLogsScreen( ) { val context = LocalContext.current + val snackbarHostState = remember { SnackbarHostState() } val scope = rememberCoroutineScope() + val clipboardHandle = createCopyToClipboardHandle(snackbarHostState = snackbarHostState) Scaffold( + snackbarHost = { + SnackbarHost( + snackbarHostState, + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + ) + }, topBar = { MullvadMediumTopBar( title = stringResource(id = R.string.view_logs), navigationIcon = { NavigateBackIconButton(onBackClick) }, actions = { + val clipboardToastMessage = stringResource(R.string.copied_logs_to_clipboard) + IconButton( + onClick = { clipboardHandle(uiState.text(), clipboardToastMessage) } + ) { + Icon( + painter = painterResource(id = R.drawable.icon_copy), + contentDescription = null + ) + } IconButton(onClick = { scope.launch { shareText(context, uiState.text()) } }) { Icon(imageVector = Icons.Default.Share, contentDescription = null) } diff --git a/android/lib/resource/src/main/res/values/strings.xml b/android/lib/resource/src/main/res/values/strings.xml index f3b0b0d157fa..b10dd68ce372 100644 --- a/android/lib/resource/src/main/res/values/strings.xml +++ b/android/lib/resource/src/main/res/values/strings.xml @@ -243,4 +243,5 @@ We are currently verifying your purchase, this might take some time. Your time will be added if the verification is successful. Connecting... Verifying purchase... + Copied logs to clipboard diff --git a/gui/locales/messages.pot b/gui/locales/messages.pot index 09529d0ebaac..08ecb96c0470 100644 --- a/gui/locales/messages.pot +++ b/gui/locales/messages.pot @@ -1711,6 +1711,9 @@ msgstr "" msgid "Copied Mullvad account number to clipboard" msgstr "" +msgid "Copied logs to clipboard" +msgstr "" + msgid "Copied to clipboard" msgstr ""