diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 6d1536003..3b5fe77d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -65,6 +65,7 @@ import eu.kanade.tachiyomi.Migrations import eu.kanade.tachiyomi.data.cache.ChapterCache import eu.kanade.tachiyomi.data.download.DownloadCache import eu.kanade.tachiyomi.data.notification.NotificationReceiver +import eu.kanade.tachiyomi.data.updater.AppUpdateChecker import eu.kanade.tachiyomi.data.updater.RELEASE_URL import eu.kanade.tachiyomi.extension.api.ExtensionApi import eu.kanade.tachiyomi.ui.base.activity.BaseActivity @@ -73,6 +74,7 @@ import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen import eu.kanade.tachiyomi.ui.deeplink.DeepLinkScreen import eu.kanade.tachiyomi.ui.home.HomeScreen import eu.kanade.tachiyomi.ui.manga.MangaScreen +import eu.kanade.tachiyomi.ui.more.NewUpdateScreen import eu.kanade.tachiyomi.ui.more.OnboardingScreen import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.isNavigationBarNeedsScrim @@ -91,6 +93,7 @@ import tachiyomi.core.Constants import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.system.logcat import tachiyomi.domain.library.service.LibraryPreferences +import tachiyomi.domain.release.interactor.GetApplicationRelease import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.i18n.stringResource @@ -311,6 +314,27 @@ class MainActivity : BaseActivity() { @Composable private fun CheckForUpdates() { val context = LocalContext.current + val navigator = LocalNavigator.currentOrThrow + + // App updates + LaunchedEffect(Unit) { + if (BuildConfig.INCLUDE_UPDATER) { + try { + val result = AppUpdateChecker().checkForUpdate(context) + if (result is GetApplicationRelease.Result.NewUpdate) { + val updateScreen = NewUpdateScreen( + versionName = result.release.version, + changelogInfo = result.release.info, + releaseLink = result.release.releaseLink, + downloadLink = result.release.getDownloadLink(), + ) + navigator.push(updateScreen) + } + } catch (e: Exception) { + logcat(LogPriority.ERROR, e) + } + } + } // Extensions updates LaunchedEffect(Unit) {