mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
desktop: in-app update functionality (#4443)
* desktop: in-app update functionality * without Android * refactor * working windows * tabs vs spaces * better working mac * changes * repo * undo manifest changes * changes * changes * unneeded changes * revert * new line * fix update notice * different way * changes to mac logic * changes to mac logic * more * update strings --------- Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
This commit is contained in:
committed by
GitHub
parent
3e873fcb32
commit
670bf34ff5
@@ -8,10 +8,12 @@ import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.pointer.*
|
||||
import chat.simplex.common.model.ChatController.appPrefs
|
||||
import chat.simplex.common.platform.*
|
||||
import chat.simplex.common.platform.DesktopPlatform
|
||||
import chat.simplex.common.showApp
|
||||
import chat.simplex.common.views.helpers.*
|
||||
import chat.simplex.common.views.onboarding.OnboardingStage
|
||||
import kotlinx.coroutines.*
|
||||
import java.io.File
|
||||
|
||||
@@ -20,6 +22,7 @@ fun main() {
|
||||
//System.setProperty("skiko.renderApi", "SOFTWARE")
|
||||
initHaskell()
|
||||
runMigrations()
|
||||
setupUpdateChecker()
|
||||
initApp()
|
||||
tmpDir.deleteRecursively()
|
||||
tmpDir.mkdir()
|
||||
@@ -75,6 +78,31 @@ private fun initHaskell() {
|
||||
override fun desktopScrollBar(state: ScrollState, modifier: Modifier, scrollBarAlpha: Animatable<Float, AnimationVector1D>, scrollJob: MutableState<Job>, reversed: Boolean) {
|
||||
DesktopScrollBar(rememberScrollbarAdapter(scrollState = state), modifier, scrollBarAlpha, scrollJob, reversed)
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun desktopShowAppUpdateNotice() {
|
||||
fun showNoticeIfNeeded() {
|
||||
if (
|
||||
!chatModel.controller.appPrefs.appUpdateNoticeShown.get()
|
||||
&& chatModel.controller.appPrefs.onboardingStage.get() == OnboardingStage.OnboardingComplete
|
||||
&& chatModel.chats.size > 3
|
||||
&& chatModel.activeCallInvitation.value == null
|
||||
) {
|
||||
appPrefs.appUpdateNoticeShown.set(true)
|
||||
showAppUpdateNotice()
|
||||
}
|
||||
}
|
||||
// Will show notice if chats were loaded before that moment and number of chats > 3
|
||||
LaunchedEffect(Unit) {
|
||||
showNoticeIfNeeded()
|
||||
}
|
||||
// Will show notice if chats were loaded later (a lot of chats/slow query) and number of chats > 3
|
||||
KeyChangeEffect(chatModel.chats.size) { oldSize ->
|
||||
if (oldSize == 0) {
|
||||
showNoticeIfNeeded()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user