fix start chat alert

This commit is contained in:
Avently
2024-11-22 15:53:52 +07:00
parent b767e7c1b4
commit b275d3c063
2 changed files with 6 additions and 9 deletions
@@ -25,6 +25,10 @@ import dev.icerock.moko.resources.compose.stringResource
@Composable
fun ModalData.ChooseServerOperators(onboarding: Boolean, close: () -> Unit) {
LaunchedEffect(Unit) {
prepareChatBeforeFinishingOnboarding()
}
CompositionLocalProvider(LocalAppBarHandler provides rememberAppBarHandler()) {
ModalView({}, showClose = false, endButtons = {
IconButton({ (if (onboarding) ModalManager.fullscreen else ModalManager.start).showModal { ChooseServerOperatorsInfoView() } }) {
@@ -295,9 +299,6 @@ private fun AcceptConditionsButton(
private fun continueToNextStep(onboarding: Boolean, close: () -> Unit) {
if (onboarding) {
appPrefs.onboardingStage.set(if (appPlatform.isAndroid) OnboardingStage.Step4_SetNotificationsMode else OnboardingStage.OnboardingComplete)
if (appPlatform.isDesktop) {
startChatIfNeeded()
}
} else {
close()
}
@@ -308,10 +309,6 @@ private fun continueToSetNotificationsAfterAccept() {
ModalManager.fullscreen.showModalCloseable(showClose = false) { SetNotificationsMode(chatModel) }
}
private fun startChatIfNeeded() {
prepareChatBeforeNotificationsSetup()
}
private fun enabledOperators(operators: List<ServerOperator>, selectedOperatorIds: Set<Long>): List<ServerOperator>? {
val ops = ArrayList(operators)
if (ops.isNotEmpty()) {
@@ -25,7 +25,7 @@ import chat.simplex.res.MR
@Composable
fun SetNotificationsMode(m: ChatModel) {
LaunchedEffect(Unit) {
prepareChatBeforeNotificationsSetup()
prepareChatBeforeFinishingOnboarding()
}
CompositionLocalProvider(LocalAppBarHandler provides rememberAppBarHandler()) {
@@ -99,7 +99,7 @@ fun <T> SelectableCard(currentValue: State<T>, newValue: T, title: String, descr
Spacer(Modifier.height(14.dp))
}
fun prepareChatBeforeNotificationsSetup() {
fun prepareChatBeforeFinishingOnboarding() {
// No visible users but may have hidden. In this case chat should be started anyway because it's stopped on this stage with hidden users
if (chatModel.users.any { u -> !u.user.hidden }) return
withBGApi {