mirror of
https://github.com/mihonapp/mihon.git
synced 2025-03-02 19:04:09 +01:00
Remove F-droid warnings
This commit is contained in:
parent
3ce013fa19
commit
181dbbb638
@ -1,12 +1,6 @@
|
|||||||
package eu.kanade.presentation.more
|
package eu.kanade.presentation.more
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.WindowInsetsSides
|
|
||||||
import androidx.compose.foundation.layout.only
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.systemBars
|
|
||||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.HelpOutline
|
import androidx.compose.material.icons.automirrored.outlined.HelpOutline
|
||||||
import androidx.compose.material.icons.automirrored.outlined.Label
|
import androidx.compose.material.icons.automirrored.outlined.Label
|
||||||
@ -40,7 +34,6 @@ fun MoreScreen(
|
|||||||
onDownloadedOnlyChange: (Boolean) -> Unit,
|
onDownloadedOnlyChange: (Boolean) -> Unit,
|
||||||
incognitoMode: Boolean,
|
incognitoMode: Boolean,
|
||||||
onIncognitoModeChange: (Boolean) -> Unit,
|
onIncognitoModeChange: (Boolean) -> Unit,
|
||||||
isFDroid: Boolean,
|
|
||||||
onClickDownloadQueue: () -> Unit,
|
onClickDownloadQueue: () -> Unit,
|
||||||
onClickCategories: () -> Unit,
|
onClickCategories: () -> Unit,
|
||||||
onClickStats: () -> Unit,
|
onClickStats: () -> Unit,
|
||||||
@ -50,19 +43,7 @@ fun MoreScreen(
|
|||||||
) {
|
) {
|
||||||
val uriHandler = LocalUriHandler.current
|
val uriHandler = LocalUriHandler.current
|
||||||
|
|
||||||
Scaffold(
|
Scaffold { contentPadding ->
|
||||||
topBar = {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.windowInsetsPadding(
|
|
||||||
WindowInsets.systemBars.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
|
|
||||||
),
|
|
||||||
) {
|
|
||||||
if (isFDroid) {
|
|
||||||
// Don't really care about slow updaters now
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
) { contentPadding ->
|
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
modifier = Modifier.padding(contentPadding),
|
modifier = Modifier.padding(contentPadding),
|
||||||
) {
|
) {
|
||||||
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.data.updater
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.util.system.isInstalledFromFDroid
|
|
||||||
import tachiyomi.core.common.util.lang.withIOContext
|
import tachiyomi.core.common.util.lang.withIOContext
|
||||||
import tachiyomi.domain.release.interactor.GetApplicationRelease
|
import tachiyomi.domain.release.interactor.GetApplicationRelease
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@ -21,7 +20,6 @@ class AppUpdateChecker {
|
|||||||
val result = getApplicationRelease.await(
|
val result = getApplicationRelease.await(
|
||||||
GetApplicationRelease.Arguments(
|
GetApplicationRelease.Arguments(
|
||||||
BuildConfig.PREVIEW,
|
BuildConfig.PREVIEW,
|
||||||
context.isInstalledFromFDroid(),
|
|
||||||
BuildConfig.COMMIT_COUNT.toInt(),
|
BuildConfig.COMMIT_COUNT.toInt(),
|
||||||
BuildConfig.VERSION_NAME,
|
BuildConfig.VERSION_NAME,
|
||||||
GITHUB_REPO,
|
GITHUB_REPO,
|
||||||
@ -31,9 +29,6 @@ class AppUpdateChecker {
|
|||||||
|
|
||||||
when (result) {
|
when (result) {
|
||||||
is GetApplicationRelease.Result.NewUpdate -> AppUpdateNotifier(context).promptUpdate(result.release)
|
is GetApplicationRelease.Result.NewUpdate -> AppUpdateNotifier(context).promptUpdate(result.release)
|
||||||
is GetApplicationRelease.Result.ThirdPartyInstallation -> AppUpdateNotifier(
|
|
||||||
context,
|
|
||||||
).promptFdroidUpdate()
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,27 +139,6 @@ internal class AppUpdateNotifier(private val context: Context) {
|
|||||||
notificationBuilder.show(Notifications.ID_APP_UPDATE_PROMPT)
|
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_mihon)
|
|
||||||
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
|
* Call when apk download throws a error
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,6 @@ import eu.kanade.tachiyomi.ui.category.CategoryScreen
|
|||||||
import eu.kanade.tachiyomi.ui.download.DownloadQueueScreen
|
import eu.kanade.tachiyomi.ui.download.DownloadQueueScreen
|
||||||
import eu.kanade.tachiyomi.ui.setting.SettingsScreen
|
import eu.kanade.tachiyomi.ui.setting.SettingsScreen
|
||||||
import eu.kanade.tachiyomi.ui.stats.StatsScreen
|
import eu.kanade.tachiyomi.ui.stats.StatsScreen
|
||||||
import eu.kanade.tachiyomi.util.system.isInstalledFromFDroid
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
@ -68,7 +67,6 @@ data object MoreTab : Tab {
|
|||||||
onDownloadedOnlyChange = { screenModel.downloadedOnly = it },
|
onDownloadedOnlyChange = { screenModel.downloadedOnly = it },
|
||||||
incognitoMode = screenModel.incognitoMode,
|
incognitoMode = screenModel.incognitoMode,
|
||||||
onIncognitoModeChange = { screenModel.incognitoMode = it },
|
onIncognitoModeChange = { screenModel.incognitoMode = it },
|
||||||
isFDroid = context.isInstalledFromFDroid(),
|
|
||||||
onClickDownloadQueue = { navigator.push(DownloadQueueScreen) },
|
onClickDownloadQueue = { navigator.push(DownloadQueueScreen) },
|
||||||
onClickCategories = { navigator.push(CategoryScreen()) },
|
onClickCategories = { navigator.push(CategoryScreen()) },
|
||||||
onClickStats = { navigator.push(StatsScreen()) },
|
onClickStats = { navigator.push(StatsScreen()) },
|
||||||
|
@ -16,7 +16,6 @@ import androidx.core.net.toUri
|
|||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
import eu.kanade.domain.ui.UiPreferences
|
import eu.kanade.domain.ui.UiPreferences
|
||||||
import eu.kanade.domain.ui.model.ThemeMode
|
import eu.kanade.domain.ui.model.ThemeMode
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
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()
|
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 && !isDebugBuildType)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Context.launchRequestPackageInstallsPermission() {
|
fun Context.launchRequestPackageInstallsPermission() {
|
||||||
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply {
|
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply {
|
||||||
data = Uri.parse("package:$packageName")
|
data = Uri.parse("package:$packageName")
|
||||||
|
@ -37,7 +37,6 @@ class GetApplicationRelease(
|
|||||||
release.version,
|
release.version,
|
||||||
)
|
)
|
||||||
return when {
|
return when {
|
||||||
isNewVersion && arguments.isThirdParty -> Result.ThirdPartyInstallation
|
|
||||||
isNewVersion -> Result.NewUpdate(release)
|
isNewVersion -> Result.NewUpdate(release)
|
||||||
else -> Result.NoNewUpdate
|
else -> Result.NoNewUpdate
|
||||||
}
|
}
|
||||||
@ -75,7 +74,6 @@ class GetApplicationRelease(
|
|||||||
|
|
||||||
data class Arguments(
|
data class Arguments(
|
||||||
val isPreview: Boolean,
|
val isPreview: Boolean,
|
||||||
val isThirdParty: Boolean,
|
|
||||||
val commitCount: Int,
|
val commitCount: Int,
|
||||||
val versionName: String,
|
val versionName: String,
|
||||||
val repository: String,
|
val repository: String,
|
||||||
@ -86,6 +84,5 @@ class GetApplicationRelease(
|
|||||||
data class NewUpdate(val release: Release) : Result
|
data class NewUpdate(val release: Release) : Result
|
||||||
data object NoNewUpdate : Result
|
data object NoNewUpdate : Result
|
||||||
data object OsTooOld : Result
|
data object OsTooOld : Result
|
||||||
data object ThirdPartyInstallation : Result
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,31 +30,6 @@ class GetApplicationReleaseTest {
|
|||||||
getApplicationRelease = GetApplicationRelease(releaseService, preferenceStore)
|
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",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
result shouldBe GetApplicationRelease.Result.ThirdPartyInstallation
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `When has update but is preview expect new update`() = runTest {
|
fun `When has update but is preview expect new update`() = runTest {
|
||||||
every { preference.get() } returns 0
|
every { preference.get() } returns 0
|
||||||
@ -72,7 +47,6 @@ class GetApplicationReleaseTest {
|
|||||||
val result = getApplicationRelease.await(
|
val result = getApplicationRelease.await(
|
||||||
GetApplicationRelease.Arguments(
|
GetApplicationRelease.Arguments(
|
||||||
isPreview = true,
|
isPreview = true,
|
||||||
isThirdParty = false,
|
|
||||||
commitCount = 1000,
|
commitCount = 1000,
|
||||||
versionName = "",
|
versionName = "",
|
||||||
repository = "test",
|
repository = "test",
|
||||||
@ -101,7 +75,6 @@ class GetApplicationReleaseTest {
|
|||||||
val result = getApplicationRelease.await(
|
val result = getApplicationRelease.await(
|
||||||
GetApplicationRelease.Arguments(
|
GetApplicationRelease.Arguments(
|
||||||
isPreview = false,
|
isPreview = false,
|
||||||
isThirdParty = false,
|
|
||||||
commitCount = 0,
|
commitCount = 0,
|
||||||
versionName = "v1.0.0",
|
versionName = "v1.0.0",
|
||||||
repository = "test",
|
repository = "test",
|
||||||
@ -130,7 +103,6 @@ class GetApplicationReleaseTest {
|
|||||||
val result = getApplicationRelease.await(
|
val result = getApplicationRelease.await(
|
||||||
GetApplicationRelease.Arguments(
|
GetApplicationRelease.Arguments(
|
||||||
isPreview = false,
|
isPreview = false,
|
||||||
isThirdParty = false,
|
|
||||||
commitCount = 0,
|
commitCount = 0,
|
||||||
versionName = "v2.0.0",
|
versionName = "v2.0.0",
|
||||||
repository = "test",
|
repository = "test",
|
||||||
@ -157,7 +129,6 @@ class GetApplicationReleaseTest {
|
|||||||
val result = getApplicationRelease.await(
|
val result = getApplicationRelease.await(
|
||||||
GetApplicationRelease.Arguments(
|
GetApplicationRelease.Arguments(
|
||||||
isPreview = false,
|
isPreview = false,
|
||||||
isThirdParty = false,
|
|
||||||
commitCount = 0,
|
commitCount = 0,
|
||||||
versionName = "v2.0.0",
|
versionName = "v2.0.0",
|
||||||
repository = "test",
|
repository = "test",
|
||||||
|
@ -922,7 +922,6 @@
|
|||||||
<string name="update_check_notification_download_complete">Tap to install update</string>
|
<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_download_error">Download error</string>
|
||||||
<string name="update_check_notification_update_available">New version available!</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 -->
|
<!-- Information Text -->
|
||||||
<string name="information_no_downloads">No downloads</string>
|
<string name="information_no_downloads">No downloads</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user