This commit is contained in:
Andrew 2024-06-12 13:13:21 +09:30
parent 9d3ef2758d
commit 7dcefb4847
4 changed files with 30 additions and 17 deletions

View File

@ -32,8 +32,10 @@ import kotlinx.coroutines.launch
import network.loki.messenger.R
import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.onboarding.messagenotifications.startMessageNotificationsActivity
import org.thoughtcrime.securesms.ui.AppTheme
import org.thoughtcrime.securesms.ui.LocalDimensions
import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.base
import org.thoughtcrime.securesms.ui.baseBold
import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode
@ -41,6 +43,7 @@ import org.thoughtcrime.securesms.ui.components.OutlineButton
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
import org.thoughtcrime.securesms.ui.components.SessionTabRow
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.util.start
import javax.inject.Inject
private const val TAG = "LinkDeviceActivity"
@ -66,6 +69,7 @@ class LinkDeviceActivity : BaseActionBarActivity() {
lifecycleScope.launch {
viewModel.eventFlow.collect {
startMessageNotificationsActivity()
startLoadingActivity(it.mnemonic)
finish()
}
@ -110,7 +114,11 @@ class LinkDeviceActivity : BaseActionBarActivity() {
@Preview
@Composable
fun PreviewRecoveryPassword() = RecoveryPassword(state = LinkDeviceState())
fun PreviewRecoveryPassword() {
PreviewTheme(R.style.Classic_Dark) {
RecoveryPassword(state = LinkDeviceState())
}
}
@Composable
fun RecoveryPassword(state: LinkDeviceState, onChange: (String) -> Unit = {}, onContinue: () -> Unit = {}) {
@ -150,8 +158,8 @@ fun RecoveryPassword(state: LinkDeviceState, onChange: (String) -> Unit = {}, on
textId = R.string.continue_2,
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(horizontal = LocalDimensions.current.marginLarge, vertical = 20.dp)
.width(200.dp),
.padding(vertical = 20.dp)
.fillMaxWidth(),
onClick = onContinue
)
}

View File

@ -23,12 +23,10 @@ import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import network.loki.messenger.R
import org.session.libsession.utilities.AppTextSecurePreferences
import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.dependencies.ConfigFactory
import org.thoughtcrime.securesms.onboarding.messagenotifications.MessageNotificationsActivity
import org.thoughtcrime.securesms.onboarding.messagenotifications.startMessageNotificationsActivity
import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivity
import org.thoughtcrime.securesms.ui.AppTheme

View File

@ -10,9 +10,9 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.MaterialTheme
@ -38,6 +38,7 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.home.HomeActivity
import org.thoughtcrime.securesms.notifications.PushRegistry
import org.thoughtcrime.securesms.ui.AppTheme
import org.thoughtcrime.securesms.ui.LocalDimensions
import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
import org.thoughtcrime.securesms.ui.base
@ -103,12 +104,12 @@ fun MessageNotificationsScreen(
setEnabled: (Boolean) -> Unit = {},
onContinue: () -> Unit = {}
) {
Column(Modifier.padding(horizontal = 32.dp)) {
Column(Modifier.padding(horizontal = LocalDimensions.current.marginMedium)) {
Spacer(Modifier.weight(1f))
Text(stringResource(R.string.notificationsMessage), style = MaterialTheme.typography.h4)
Spacer(Modifier.height(16.dp))
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = MaterialTheme.typography.base)
Spacer(Modifier.height(16.dp))
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
NotificationRadioButton(
R.string.activity_pn_mode_fast_mode,
R.string.activity_pn_mode_fast_mode_explanation,
@ -117,7 +118,7 @@ fun MessageNotificationsScreen(
selected = state.pushEnabled,
onClick = { setEnabled(true) }
)
Spacer(Modifier.height(16.dp))
Spacer(Modifier.height(LocalDimensions.current.marginExtraSmall))
NotificationRadioButton(
R.string.activity_pn_mode_slow_mode,
R.string.activity_pn_mode_slow_mode_explanation,
@ -131,10 +132,10 @@ fun MessageNotificationsScreen(
modifier = Modifier
.contentDescription(R.string.AccessibilityId_continue)
.align(Alignment.CenterHorizontally)
.width(262.dp),
.fillMaxWidth(),
onClick = onContinue
)
Spacer(modifier = Modifier.height(12.dp))
Spacer(modifier = Modifier.height(LocalDimensions.current.marginExtraExtraSmall))
}
}

View File

@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
@ -56,6 +57,7 @@ import kotlinx.coroutines.flow.buffer
import kotlinx.coroutines.flow.filter
import network.loki.messenger.R
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.ui.LocalDimensions
import org.thoughtcrime.securesms.ui.base
import java.util.concurrent.Executors
@ -101,11 +103,15 @@ fun MaybeScanQrCode(
)
}
} else {
OutlineButton(
stringResource(R.string.cameraGrantAccess),
modifier = Modifier.align(Alignment.Center),
onClick = { cameraPermissionState.run { launchPermissionRequest() } }
)
Box(modifier = Modifier.fillMaxSize().padding(LocalDimensions.current.marginLarge)) {
OutlineButton(
stringResource(R.string.cameraGrantAccess),
modifier = Modifier
.align(Alignment.Center)
.fillMaxWidth(),
onClick = { cameraPermissionState.run { launchPermissionRequest() } }
)
}
}
}
}