forked from geode-sdk/android-launcher
only notify launcher update when not visible elsewhere
This commit is contained in:
3 files changed
+9
-5
No files matched your search
@@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.IntrinsicSize
|
import androidx.compose.foundation.layout.IntrinsicSize
|
||||||
import androidx.compose.foundation.layout.displayCutoutPadding
|
import androidx.compose.foundation.layout.displayCutoutPadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.ListItem
|
import androidx.compose.material3.ListItem
|
||||||
@@ -27,7 +26,6 @@ import androidx.compose.runtime.mutableStateOf
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -54,10 +52,8 @@ fun determineDisplayedCards(context: Context, geodeFailed: Boolean = false): Lis
|
|||||||
}
|
}
|
||||||
|
|
||||||
val releaseManager = ReleaseManager.get(context)
|
val releaseManager = ReleaseManager.get(context)
|
||||||
val loadAutomatically = PreferenceUtils.get(context).getBoolean(PreferenceUtils.Key.LOAD_AUTOMATICALLY)
|
|
||||||
|
|
||||||
val availableUpdate = releaseManager.availableLauncherUpdateTag.value
|
val availableUpdate = releaseManager.availableLauncherUpdateTag.value
|
||||||
if (loadAutomatically && availableUpdate != null) {
|
if (availableUpdate != null && !releaseManager.dismissedLauncherUpdate) {
|
||||||
cards.add(LaunchNotificationType.LAUNCHER_UPDATE_AVAILABLE)
|
cards.add(LaunchNotificationType.LAUNCHER_UPDATE_AVAILABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,6 +208,7 @@ fun LauncherUpdateContent(modifier: Modifier = Modifier) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Composable
|
@Composable
|
||||||
fun UpdateNotificationContent(modifier: Modifier = Modifier) {
|
fun UpdateNotificationContent(modifier: Modifier = Modifier) {
|
||||||
ListItem(
|
ListItem(
|
||||||
@@ -228,6 +225,7 @@ fun UpdateNotificationContent(modifier: Modifier = Modifier) {
|
|||||||
modifier = modifier.width(IntrinsicSize.Max)
|
modifier = modifier.width(IntrinsicSize.Max)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OutdatedVersionContent(modifier: Modifier = Modifier) {
|
fun OutdatedVersionContent(modifier: Modifier = Modifier) {
|
||||||
|
|||||||
@@ -258,6 +258,10 @@ class LaunchViewModel(private val application: Application): ViewModel() {
|
|||||||
releaseManager.afterUseCachedUpdate()
|
releaseManager.afterUseCachedUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isRestart) {
|
||||||
|
releaseManager.dismissedLauncherUpdate = true
|
||||||
|
}
|
||||||
|
|
||||||
preReadyCheck()
|
preReadyCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ class ReleaseManager private constructor(
|
|||||||
private val _availableLauncherUpdateDetails = MutableStateFlow<DownloadableLauncherRelease?>(null)
|
private val _availableLauncherUpdateDetails = MutableStateFlow<DownloadableLauncherRelease?>(null)
|
||||||
val availableLauncherUpdateDetails = _availableLauncherUpdateDetails.asStateFlow()
|
val availableLauncherUpdateDetails = _availableLauncherUpdateDetails.asStateFlow()
|
||||||
|
|
||||||
|
var dismissedLauncherUpdate = false
|
||||||
|
|
||||||
private fun sendError(e: Exception) {
|
private fun sendError(e: Exception) {
|
||||||
_uiState.value = ReleaseManagerState.Failure(e)
|
_uiState.value = ReleaseManagerState.Failure(e)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user