mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Add FOSS flavor
This commit is contained in:
parent
9df21583dc
commit
af7e6919c8
11 changed files with 51 additions and 11 deletions
|
@ -99,6 +99,11 @@ android {
|
||||||
buildConfigField("boolean", "INCLUDE_UPDATER", "true")
|
buildConfigField("boolean", "INCLUDE_UPDATER", "true")
|
||||||
dimension = "default"
|
dimension = "default"
|
||||||
}
|
}
|
||||||
|
create("foss") {
|
||||||
|
buildConfigField("boolean", "INCLUDE_UPDATER", "true")
|
||||||
|
dimension = "default"
|
||||||
|
applicationIdSuffix = "t-foss"
|
||||||
|
}
|
||||||
create("dev") {
|
create("dev") {
|
||||||
// Include pseudolocales: https://developer.android.com/guide/topics/resources/pseudolocales
|
// Include pseudolocales: https://developer.android.com/guide/topics/resources/pseudolocales
|
||||||
resourceConfigurations.addAll(listOf("en", "en_XA", "ar_XB", "xxhdpi"))
|
resourceConfigurations.addAll(listOf("en", "en_XA", "ar_XB", "xxhdpi"))
|
||||||
|
@ -291,9 +296,12 @@ androidComponents {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Only excluding in standard and foss flavors because this breaks
|
||||||
|
// Layout Inspector's Compose tree
|
||||||
onVariants(selector().withFlavor("default" to "standard")) {
|
onVariants(selector().withFlavor("default" to "standard")) {
|
||||||
// Only excluding in standard flavor because this breaks
|
it.packaging.resources.excludes.add("META-INF/*.version")
|
||||||
// Layout Inspector's Compose tree
|
}
|
||||||
|
onVariants(selector().withFlavor("default" to "foss")) {
|
||||||
it.packaging.resources.excludes.add("META-INF/*.version")
|
it.packaging.resources.excludes.add("META-INF/*.version")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
app/src/foss/java/mihon/core/firebase/FirebaseConfig.kt
Normal file
11
app/src/foss/java/mihon/core/firebase/FirebaseConfig.kt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package mihon.core.firebase
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
object FirebaseConfig {
|
||||||
|
fun init(context: Context) = Unit
|
||||||
|
|
||||||
|
fun setAnalyticsEnabled(enabled: Boolean) = Unit
|
||||||
|
|
||||||
|
fun setCrashlyticsEnabled(enabled: Boolean) = Unit
|
||||||
|
}
|
|
@ -37,6 +37,7 @@ import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||||
import eu.kanade.presentation.util.rememberRequestPackageInstallsPermissionState
|
import eu.kanade.presentation.util.rememberRequestPackageInstallsPermissionState
|
||||||
import eu.kanade.tachiyomi.core.security.PrivacyPreferences
|
import eu.kanade.tachiyomi.core.security.PrivacyPreferences
|
||||||
|
import eu.kanade.tachiyomi.util.system.isFossFlavor
|
||||||
import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission
|
import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
@ -117,6 +118,8 @@ internal class PermissionStep : OnboardingStep {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (isFossFlavor) return@Column
|
||||||
|
|
||||||
HorizontalDivider(
|
HorizontalDivider(
|
||||||
modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp),
|
modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp),
|
||||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
|
|
|
@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.core.security.PrivacyPreferences
|
||||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
|
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
|
||||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported
|
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported
|
||||||
|
import eu.kanade.tachiyomi.util.system.isFossFlavor
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
import kotlinx.collections.immutable.toImmutableMap
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
|
@ -31,10 +32,12 @@ object SettingsSecurityScreen : SearchableSettings {
|
||||||
override fun getPreferences(): List<Preference> {
|
override fun getPreferences(): List<Preference> {
|
||||||
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
|
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
|
||||||
val privacyPreferences = remember { Injekt.get<PrivacyPreferences>() }
|
val privacyPreferences = remember { Injekt.get<PrivacyPreferences>() }
|
||||||
return listOf(
|
return buildList {
|
||||||
getSecurityGroup(securityPreferences),
|
add(getSecurityGroup(securityPreferences))
|
||||||
getFirebaseGroup(privacyPreferences),
|
if (!isFossFlavor) {
|
||||||
)
|
add(getFirebaseGroup(privacyPreferences))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.ui.more.NewUpdateScreen
|
||||||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||||
import eu.kanade.tachiyomi.util.lang.toDateTimestampString
|
import eu.kanade.tachiyomi.util.lang.toDateTimestampString
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
|
import eu.kanade.tachiyomi.util.system.isFossFlavor
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
|
@ -121,7 +122,7 @@ object AboutScreen : Screen() {
|
||||||
versionName = result.release.version,
|
versionName = result.release.version,
|
||||||
changelogInfo = result.release.info,
|
changelogInfo = result.release.info,
|
||||||
releaseLink = result.release.releaseLink,
|
releaseLink = result.release.releaseLink,
|
||||||
downloadLink = result.release.getDownloadLink(),
|
downloadLink = result.release.getDownloadLink(isFossFlavor),
|
||||||
)
|
)
|
||||||
navigator.push(updateScreen)
|
navigator.push(updateScreen)
|
||||||
},
|
},
|
||||||
|
|
|
@ -44,6 +44,7 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.WebViewUtil
|
import eu.kanade.tachiyomi.util.system.WebViewUtil
|
||||||
import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
||||||
import eu.kanade.tachiyomi.util.system.cancelNotification
|
import eu.kanade.tachiyomi.util.system.cancelNotification
|
||||||
|
import eu.kanade.tachiyomi.util.system.isFossFlavor
|
||||||
import eu.kanade.tachiyomi.util.system.notify
|
import eu.kanade.tachiyomi.util.system.notify
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
|
|
|
@ -45,6 +45,8 @@ class AppUpdateChecker {
|
||||||
val GITHUB_REPO: String by lazy {
|
val GITHUB_REPO: String by lazy {
|
||||||
if (BuildConfig.PREVIEW) {
|
if (BuildConfig.PREVIEW) {
|
||||||
"mihonapp/mihon-preview"
|
"mihonapp/mihon-preview"
|
||||||
|
} else if (BuildConfig.FLAVOR == "foss") {
|
||||||
|
"mihonapp/mihon-foss"
|
||||||
} else {
|
} else {
|
||||||
"mihonapp/mihon"
|
"mihonapp/mihon"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.notification.NotificationHandler
|
import eu.kanade.tachiyomi.data.notification.NotificationHandler
|
||||||
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
||||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||||
|
import eu.kanade.tachiyomi.util.system.isFossFlavor
|
||||||
import eu.kanade.tachiyomi.util.system.notificationBuilder
|
import eu.kanade.tachiyomi.util.system.notificationBuilder
|
||||||
import eu.kanade.tachiyomi.util.system.notify
|
import eu.kanade.tachiyomi.util.system.notify
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
|
@ -38,7 +39,7 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||||
fun promptUpdate(release: Release) {
|
fun promptUpdate(release: Release) {
|
||||||
val updateIntent = NotificationReceiver.downloadAppUpdatePendingBroadcast(
|
val updateIntent = NotificationReceiver.downloadAppUpdatePendingBroadcast(
|
||||||
context,
|
context,
|
||||||
release.getDownloadLink(),
|
release.getDownloadLink(isFossFlavor),
|
||||||
release.version,
|
release.version,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen
|
||||||
import eu.kanade.tachiyomi.ui.more.NewUpdateScreen
|
import eu.kanade.tachiyomi.ui.more.NewUpdateScreen
|
||||||
import eu.kanade.tachiyomi.ui.more.OnboardingScreen
|
import eu.kanade.tachiyomi.ui.more.OnboardingScreen
|
||||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||||
|
import eu.kanade.tachiyomi.util.system.isFossFlavor
|
||||||
import eu.kanade.tachiyomi.util.system.isNavigationBarNeedsScrim
|
import eu.kanade.tachiyomi.util.system.isNavigationBarNeedsScrim
|
||||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||||
import eu.kanade.tachiyomi.util.view.setComposeContent
|
import eu.kanade.tachiyomi.util.view.setComposeContent
|
||||||
|
@ -303,7 +304,7 @@ class MainActivity : BaseActivity() {
|
||||||
versionName = result.release.version,
|
versionName = result.release.version,
|
||||||
changelogInfo = result.release.info,
|
changelogInfo = result.release.info,
|
||||||
releaseLink = result.release.releaseLink,
|
releaseLink = result.release.releaseLink,
|
||||||
downloadLink = result.release.getDownloadLink(),
|
downloadLink = result.release.getDownloadLink(isFossFlavor),
|
||||||
)
|
)
|
||||||
navigator.push(updateScreen)
|
navigator.push(updateScreen)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@ import eu.kanade.tachiyomi.BuildConfig
|
||||||
val isDevFlavor: Boolean
|
val isDevFlavor: Boolean
|
||||||
get() = BuildConfig.FLAVOR == "dev"
|
get() = BuildConfig.FLAVOR == "dev"
|
||||||
|
|
||||||
|
val isFossFlavor: Boolean
|
||||||
|
get() = BuildConfig.FLAVOR == "foss"
|
||||||
|
|
||||||
val isPreviewBuildType: Boolean
|
val isPreviewBuildType: Boolean
|
||||||
get() = BuildConfig.BUILD_TYPE == "preview"
|
get() = BuildConfig.BUILD_TYPE == "preview"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,13 @@ data class Release(
|
||||||
* Get download link of latest release from the assets.
|
* Get download link of latest release from the assets.
|
||||||
* @return download link of latest release.
|
* @return download link of latest release.
|
||||||
*/
|
*/
|
||||||
fun getDownloadLink(): String {
|
fun getDownloadLink(isFossFlavor: Boolean): String {
|
||||||
|
val fossFlavor = if (isFossFlavor) {
|
||||||
|
"-foss"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
val apkVariant = when (Build.SUPPORTED_ABIS[0]) {
|
val apkVariant = when (Build.SUPPORTED_ABIS[0]) {
|
||||||
"arm64-v8a" -> "-arm64-v8a"
|
"arm64-v8a" -> "-arm64-v8a"
|
||||||
"armeabi-v7a" -> "-armeabi-v7a"
|
"armeabi-v7a" -> "-armeabi-v7a"
|
||||||
|
@ -25,7 +31,7 @@ data class Release(
|
||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return assets.find { it.contains("mihon$apkVariant-") } ?: assets[0]
|
return assets.find { it.contains("mihon$fossFlavor$apkVariant-") } ?: assets[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue