diff --git a/apps/multiplatform/common/build.gradle.kts b/apps/multiplatform/common/build.gradle.kts index 91c41e562a..1d7eb6b3c7 100644 --- a/apps/multiplatform/common/build.gradle.kts +++ b/apps/multiplatform/common/build.gradle.kts @@ -95,6 +95,7 @@ kotlin { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.7.1") implementation("com.github.Dansoftowner:jSystemThemeDetector:3.6") + implementation("org.slf4j:slf4j-simple:2.0.7") } } val desktopTest by getting diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/AppLock.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/AppLock.kt index fdc1969411..7228f4ebf4 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/AppLock.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/AppLock.kt @@ -6,8 +6,7 @@ import androidx.compose.material.Surface import androidx.compose.runtime.mutableStateOf import androidx.compose.ui.Modifier import chat.simplex.common.model.* -import chat.simplex.common.platform.Log -import chat.simplex.common.platform.TAG +import chat.simplex.common.platform.* import chat.simplex.common.views.helpers.* import chat.simplex.common.views.localauth.SetAppPasscodeView import chat.simplex.common.views.usersettings.* @@ -41,17 +40,25 @@ object AppLock { text = generalGetString(MR.strings.la_notice_to_protect_your_information_turn_on_simplex_lock_you_will_be_prompted_to_complete_authentication_before_this_feature_is_enabled), confirmText = generalGetString(MR.strings.la_notice_turn_on), onConfirm = { + laNoticeShown.set(true) withBGApi { // to remove this call, change ordering of onConfirm call in AlertManager - showChooseLAMode(laNoticeShown) + if (appPlatform.isAndroid) { + showChooseLAMode() + } else { + AlertManager.shared.hideAlert() + setPasscode() + } } + }, + onDismiss = { + AlertManager.shared.hideAlert() } ) } } - private fun showChooseLAMode(laNoticeShown: SharedPreference) { + private fun showChooseLAMode() { Log.d(TAG, "showLANotice") - laNoticeShown.set(true) AlertManager.shared.showAlertDialogStacked( title = generalGetString(MR.strings.la_lock_mode), text = null, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/CreateSimpleXAddress.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/CreateSimpleXAddress.kt index b8eb064b8c..84d1ae639d 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/CreateSimpleXAddress.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/CreateSimpleXAddress.kt @@ -57,8 +57,13 @@ fun CreateSimpleXAddress(m: ChatModel) { } }, nextStep = { - m.controller.appPrefs.onboardingStage.set(OnboardingStage.Step4_SetNotificationsMode) - m.onboardingStage.value = OnboardingStage.Step4_SetNotificationsMode + val next = if (appPlatform.isAndroid) { + OnboardingStage.Step4_SetNotificationsMode + } else { + OnboardingStage.OnboardingComplete + } + m.controller.appPrefs.onboardingStage.set(next) + m.onboardingStage.value = next }, ) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt index 1e69d92c22..8248194ebc 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt @@ -41,6 +41,7 @@ fun SimpleXInfoLayout( .fillMaxSize() .verticalScroll(rememberScrollState()) .padding(start = DEFAULT_PADDING , end = DEFAULT_PADDING, top = DEFAULT_PADDING), + horizontalAlignment = Alignment.CenterHorizontally ) { Box(Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 10.dp), contentAlignment = Alignment.Center) { SimpleXLogo() @@ -48,9 +49,11 @@ fun SimpleXInfoLayout( Text(stringResource(MR.strings.next_generation_of_private_messaging), style = MaterialTheme.typography.h2, modifier = Modifier.padding(bottom = 48.dp).padding(horizontal = 36.dp), textAlign = TextAlign.Center) - InfoRow(painterResource(MR.images.privacy), MR.strings.privacy_redefined, MR.strings.first_platform_without_user_ids, width = 80.dp) - InfoRow(painterResource(MR.images.shield), MR.strings.immune_to_spam_and_abuse, MR.strings.people_can_connect_only_via_links_you_share) - InfoRow(painterResource(if (isInDarkTheme()) MR.images.decentralized_light else MR.images.decentralized), MR.strings.decentralized, MR.strings.opensource_protocol_and_code_anybody_can_run_servers) + Column { + InfoRow(painterResource(MR.images.privacy), MR.strings.privacy_redefined, MR.strings.first_platform_without_user_ids, width = 80.dp) + InfoRow(painterResource(MR.images.shield), MR.strings.immune_to_spam_and_abuse, MR.strings.people_can_connect_only_via_links_you_share) + InfoRow(painterResource(if (isInDarkTheme()) MR.images.decentralized_light else MR.images.decentralized), MR.strings.decentralized, MR.strings.opensource_protocol_and_code_anybody_can_run_servers) + } Spacer(Modifier.fillMaxHeight().weight(1f)) diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/DesktopApp.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/DesktopApp.kt index f4ce0aae6f..81e506a258 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/DesktopApp.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/DesktopApp.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.window.* import chat.simplex.common.model.ChatController import chat.simplex.common.model.ChatModel +import chat.simplex.common.platform.desktopPlatform import chat.simplex.common.ui.theme.SimpleXTheme import chat.simplex.common.views.helpers.FileDialogChooser import kotlinx.coroutines.* @@ -24,7 +25,10 @@ import java.io.File val simplexWindowState = SimplexWindowState() fun showApp() = application { - val windowState = rememberWindowState(placement = WindowPlacement.Floating, width = 1366.dp, height = 768.dp) + // For some reason on Linux actual width will be 10.dp less after specifying it here. If we specify 1366, + // it will show 1356. But after that we can still update it to 1366 by changing window state. Just making it +10 now here + val width = if (desktopPlatform.isLinux()) 1376.dp else 1366.dp + val windowState = rememberWindowState(placement = WindowPlacement.Floating, width = width, height = 768.dp) simplexWindowState.windowState = windowState Window(state = windowState, onCloseRequest = ::exitApplication, onKeyEvent = { if (it.key == Key.Escape && it.type == KeyEventType.KeyUp) { diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Platform.desktop.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Platform.desktop.kt index 0a49ed5beb..8fabcf8285 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Platform.desktop.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Platform.desktop.kt @@ -14,6 +14,8 @@ enum class DesktopPlatform(val libPath: String, val libExtension: String, val co WINDOWS_X86_64("/libs/windows-x86_64", "dll", System.getenv("AppData") + File.separator + "SimpleX", System.getenv("AppData") + File.separator + "SimpleX"), MAC_X86_64("/libs/mac-x86_64", "dylib", unixConfigPath, unixDataPath), MAC_AARCH64("/libs/mac-aarch64", "dylib", unixConfigPath, unixDataPath); + + fun isLinux() = this == LINUX_X86_64 || this == LINUX_AARCH64 } private fun detectDesktopPlatform(): DesktopPlatform {