Remove F-droid warnings

(cherry picked from commit 181dbbb638686a284fa24c4e43d7c022a4f8e4bb)

# Conflicts:
#	app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt
#	app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt
#	domain/src/test/java/tachiyomi/domain/release/interactor/GetApplicationReleaseTest.kt
This commit is contained in:
AntsyLich 2025-02-26 02:13:14 +06:00 committed by Jobobby04
parent 5d4d15aa9c
commit 5f2e979bb5
8 changed files with 1 additions and 101 deletions

View File

@ -49,7 +49,6 @@ fun MoreScreen(
onDownloadedOnlyChange: (Boolean) -> Unit,
incognitoMode: Boolean,
onIncognitoModeChange: (Boolean) -> Unit,
isFDroid: Boolean,
// SY -->
showNavUpdates: Boolean,
showNavHistory: Boolean,
@ -66,26 +65,7 @@ fun MoreScreen(
) {
val uriHandler = LocalUriHandler.current
Scaffold(
topBar = {
Column(
modifier = Modifier.windowInsetsPadding(
WindowInsets.systemBars.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
),
) {
if (isFDroid) {
WarningBanner(
textRes = MR.strings.fdroid_warning,
modifier = Modifier.clickable {
uriHandler.openUri(
"https://mihon.app/docs/faq/general#how-do-i-update-from-the-f-droid-builds",
)
},
)
}
}
},
) { contentPadding ->
Scaffold { contentPadding ->
ScrollbarLazyColumn(
modifier = Modifier.padding(contentPadding),
) {

View File

@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.data.updater
import android.content.Context
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.util.system.isInstalledFromFDroid
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import exh.syDebugVersion
import tachiyomi.core.common.util.lang.withIOContext
@ -25,7 +24,6 @@ class AppUpdateChecker {
// SY -->
isPreviewBuildType,
// SY <--
context.isInstalledFromFDroid(),
BuildConfig.COMMIT_COUNT.toInt(),
BuildConfig.VERSION_NAME,
GITHUB_REPO,
@ -38,9 +36,6 @@ class AppUpdateChecker {
when (result) {
is GetApplicationRelease.Result.NewUpdate -> AppUpdateNotifier(context).promptUpdate(result.release)
is GetApplicationRelease.Result.ThirdPartyInstallation -> AppUpdateNotifier(
context,
).promptFdroidUpdate()
else -> {}
}

View File

@ -139,27 +139,6 @@ internal class AppUpdateNotifier(private val context: Context) {
notificationBuilder.show(Notifications.ID_APP_UPDATE_PROMPT)
}
/**
* Some people are still installing the app from F-Droid, so we avoid prompting GitHub-based
* updates.
*
* We can prompt them to migrate to the GitHub version though.
*/
fun promptFdroidUpdate() {
with(notificationBuilder) {
setContentTitle(context.stringResource(MR.strings.update_check_notification_update_available))
setContentText(context.stringResource(MR.strings.update_check_fdroid_migration_info))
setSmallIcon(R.drawable.ic_tachi)
setContentIntent(
NotificationHandler.openUrl(
context,
"https://mihon.app/docs/faq/general#how-do-i-update-from-the-f-droid-builds",
),
)
}
notificationBuilder.show(Notifications.ID_APP_UPDATE_PROMPT)
}
/**
* Call when apk download throws a error
*

View File

@ -29,7 +29,6 @@ import eu.kanade.tachiyomi.ui.history.HistoryTab
import eu.kanade.tachiyomi.ui.setting.SettingsScreen
import eu.kanade.tachiyomi.ui.stats.StatsScreen
import eu.kanade.tachiyomi.ui.updates.UpdatesTab
import eu.kanade.tachiyomi.util.system.isInstalledFromFDroid
import exh.ui.batchadd.BatchAddScreen
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@ -72,7 +71,6 @@ data object MoreTab : Tab {
onDownloadedOnlyChange = { screenModel.downloadedOnly = it },
incognitoMode = screenModel.incognitoMode,
onIncognitoModeChange = { screenModel.incognitoMode = it },
isFDroid = context.isInstalledFromFDroid(),
// SY -->
showNavUpdates = screenModel.showNavUpdates,
showNavHistory = screenModel.showNavHistory,

View File

@ -16,7 +16,6 @@ import androidx.core.net.toUri
import com.hippo.unifile.UniFile
import eu.kanade.domain.ui.UiPreferences
import eu.kanade.domain.ui.model.ThemeMode
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
@ -157,23 +156,6 @@ val Context.hasMiuiPackageInstaller get() = isPackageInstalled("com.miui.package
val Context.isShizukuInstalled get() = isPackageInstalled("moe.shizuku.privileged.api") || Sui.isSui()
fun Context.isInstalledFromFDroid(): Boolean {
val installerPackageName = try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
packageManager.getInstallSourceInfo(packageName).installingPackageName
} else {
@Suppress("DEPRECATION")
packageManager.getInstallerPackageName(packageName)
}
} catch (e: Exception) {
null
}
return installerPackageName == "org.fdroid.fdroid" ||
// F-Droid builds typically disable the updater
(!BuildConfig.INCLUDE_UPDATER && !isDevFlavor)
}
fun Context.launchRequestPackageInstallsPermission() {
val intent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply {

View File

@ -35,7 +35,6 @@ class GetApplicationRelease(
isNewVersion(arguments.isPreview, arguments.syDebugVersion, arguments.versionName, release.version)
// SY <--
return when {
isNewVersion && arguments.isThirdParty -> Result.ThirdPartyInstallation
isNewVersion -> Result.NewUpdate(release)
else -> Result.NoNewUpdate
}
@ -76,7 +75,6 @@ class GetApplicationRelease(
data class Arguments(
val isPreview: Boolean,
val isThirdParty: Boolean,
val commitCount: Int,
val versionName: String,
val repository: String,
@ -90,6 +88,5 @@ class GetApplicationRelease(
data class NewUpdate(val release: Release) : Result
data object NoNewUpdate : Result
data object OsTooOld : Result
data object ThirdPartyInstallation : Result
}
}

View File

@ -30,32 +30,6 @@ class GetApplicationReleaseTest {
getApplicationRelease = GetApplicationRelease(releaseService, preferenceStore)
}
@Test
fun `When has update but is third party expect third party installation`() = runTest {
every { preference.get() } returns 0
every { preference.set(any()) }.answers { }
coEvery { releaseService.latest(any()) } returns Release(
"v2.0.0",
"info",
"http://example.com/release_link",
listOf("http://example.com/assets"),
)
val result = getApplicationRelease.await(
GetApplicationRelease.Arguments(
isPreview = false,
isThirdParty = true,
commitCount = 0,
versionName = "v1.0.0",
repository = "test",
syDebugVersion = "0",
),
)
result shouldBe GetApplicationRelease.Result.ThirdPartyInstallation
}
@Test
fun `When has update but is preview expect new update`() = runTest {
every { preference.get() } returns 0
@ -73,7 +47,6 @@ class GetApplicationReleaseTest {
val result = getApplicationRelease.await(
GetApplicationRelease.Arguments(
isPreview = true,
isThirdParty = false,
commitCount = 1000,
versionName = "",
repository = "test",
@ -103,7 +76,6 @@ class GetApplicationReleaseTest {
val result = getApplicationRelease.await(
GetApplicationRelease.Arguments(
isPreview = false,
isThirdParty = false,
commitCount = 0,
versionName = "v1.0.0",
syDebugVersion = "0",
@ -133,7 +105,6 @@ class GetApplicationReleaseTest {
val result = getApplicationRelease.await(
GetApplicationRelease.Arguments(
isPreview = false,
isThirdParty = false,
commitCount = 0,
versionName = "v2.0.0",
syDebugVersion = "0",
@ -161,7 +132,6 @@ class GetApplicationReleaseTest {
val result = getApplicationRelease.await(
GetApplicationRelease.Arguments(
isPreview = false,
isThirdParty = false,
commitCount = 0,
versionName = "v2.0.0",
syDebugVersion = "0",

View File

@ -922,7 +922,6 @@
<string name="update_check_notification_download_complete">Tap to install update</string>
<string name="update_check_notification_download_error">Download error</string>
<string name="update_check_notification_update_available">New version available!</string>
<string name="update_check_fdroid_migration_info">A new version is available from the official releases. Tap to learn how to migrate from unofficial F-Droid releases.</string>
<!-- Information Text -->
<string name="information_no_downloads">No downloads</string>