Change foss variant application id suffix to '.foss' and more (mihonapp/mihon#1831)

- Remove `BuildConfig.PREVIEW`
- Rename `BuildConfig.INCLUDE_ANALYTICS` -> `BuildConfig.ANALYTICS_INCLUDED`
- Rename `BuildConfig.INCLUDE_UPDATER` -> `BuildConfig.UPDATER_ENABLED`
- Rename build property `with-analytics` -> `include-analytics`
- Rename build property `with-updater` -> `enable-updater`
- Add build property to disable code shrink
- Add build property to include dependency info in apk/app bundle

(cherry picked from commit 0893609ad2c4791dc404d72a5e69a2e0373517ae)
This commit is contained in:
AntsyLich 2025-03-08 03:10:56 +06:00 committed by Cuong-Tran
parent 686a80555f
commit 3623b4efb6
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
22 changed files with 70 additions and 10634 deletions

View file

@ -152,7 +152,7 @@ jobs:
run: ./gradlew spotlessCheck run: ./gradlew spotlessCheck
- name: Build app - name: Build app
run: ./gradlew assemblePreview run: ./gradlew assemblePreview -Pinclude-analytics -Penable-updater
- name: Run unit tests - name: Run unit tests
run: ./gradlew testReleaseUnitTest run: ./gradlew testReleaseUnitTest

View file

@ -69,7 +69,7 @@ jobs:
run: ./gradlew spotlessCheck run: ./gradlew spotlessCheck
- name: Build app - name: Build app
run: ./gradlew assembleRelease -Pwith-analytics -Pwith-updater run: ./gradlew assembleRelease -Pinclude-analytics -Penable-updater
- name: Run unit tests - name: Run unit tests
run: ./gradlew testReleaseUnitTest run: ./gradlew testReleaseUnitTest

View file

@ -125,7 +125,7 @@ jobs:
run: ./gradlew spotlessCheck run: ./gradlew spotlessCheck
- name: Build app - name: Build app
run: ./gradlew assembleRelease -Pwith-analytics -Pwith-updater run: ./gradlew assembleRelease -Pinclude-analytics -Penable-updater
- name: Run unit tests - name: Run unit tests
run: ./gradlew testReleaseUnitTest run: ./gradlew testReleaseUnitTest

View file

@ -11,10 +11,17 @@ plugins {
id("com.github.ben-manes.versions") id("com.github.ben-manes.versions")
} }
val includeAnalytics = project.hasProperty("with-analytics") class ConfigClass {
val includeUpdater = project.hasProperty("with-updater") val includeAnalytics: Boolean = project.hasProperty("include-analytics")
val enableUpdater: Boolean = project.hasProperty("enable-updater")
val enableCodeShrink: Boolean = !project.hasProperty("disable-code-shrink")
val includeDependencyInfo: Boolean = project.hasProperty("include-dependency-info")
}
if (includeAnalytics) { @Suppress("PropertyName")
val Config = ConfigClass()
if (Config.includeAnalytics) {
pluginManager.apply { pluginManager.apply {
apply(libs.plugins.google.services.get().pluginId) apply(libs.plugins.google.services.get().pluginId)
apply(libs.plugins.firebase.crashlytics.get().pluginId) apply(libs.plugins.firebase.crashlytics.get().pluginId)
@ -33,9 +40,8 @@ android {
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"") buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"") buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
buildConfigField("boolean", "INCLUDE_ANALYTICS", "$includeAnalytics") buildConfigField("boolean", "ANALYTICS_INCLUDED", "${Config.includeAnalytics}")
buildConfigField("boolean", "INCLUDE_UPDATER", "$includeUpdater") buildConfigField("boolean", "UPDATER_ENABLED", "${Config.enableUpdater}")
buildConfigField("boolean", "PREVIEW", "false")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
@ -47,11 +53,14 @@ android {
isPseudoLocalesEnabled = true isPseudoLocalesEnabled = true
} }
val release by getting { val release by getting {
isMinifyEnabled = true isMinifyEnabled = Config.enableCodeShrink
isShrinkResources = true isShrinkResources = Config.enableCodeShrink
proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro") proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
} }
val commonMatchingFallbacks = listOf(release.name)
create("releaseTest") { create("releaseTest") {
initWith(release) initWith(release)
@ -59,14 +68,14 @@ android {
isMinifyEnabled = false isMinifyEnabled = false
isShrinkResources = false isShrinkResources = false
matchingFallbacks.add(release.name) matchingFallbacks.addAll(commonMatchingFallbacks)
} }
create("foss") { create("foss") {
initWith(release) initWith(release)
applicationIdSuffix = ".t-foss" applicationIdSuffix = ".foss"
matchingFallbacks.add(release.name) matchingFallbacks.addAll(commonMatchingFallbacks)
} }
create("preview") { create("preview") {
initWith(release) initWith(release)
@ -76,9 +85,7 @@ android {
versionNameSuffix = debug.versionNameSuffix versionNameSuffix = debug.versionNameSuffix
signingConfig = debug.signingConfig signingConfig = debug.signingConfig
matchingFallbacks.add(release.name) matchingFallbacks.addAll(commonMatchingFallbacks)
buildConfigField("boolean", "PREVIEW", "true")
} }
create("benchmark") { create("benchmark") {
initWith(release) initWith(release)
@ -90,12 +97,12 @@ android {
signingConfig = debug.signingConfig signingConfig = debug.signingConfig
matchingFallbacks.add(release.name) matchingFallbacks.addAll(commonMatchingFallbacks)
} }
} }
sourceSets { sourceSets {
val analyticsDir = if (includeAnalytics) "analytics-firebase" else "analytics-firebase-noop" val analyticsDir = if (Config.includeAnalytics) "analytics-firebase" else "analytics-firebase-noop"
getByName("main").kotlin.srcDirs("src/$analyticsDir/kotlin") getByName("main").kotlin.srcDirs("src/$analyticsDir/kotlin")
getByName("preview").res.srcDirs("src/beta/res") getByName("preview").res.srcDirs("src/beta/res")
getByName("benchmark").res.srcDirs("src/debug/res") getByName("benchmark").res.srcDirs("src/debug/res")
@ -140,7 +147,8 @@ android {
} }
dependenciesInfo { dependenciesInfo {
includeInApk = false includeInApk = Config.includeDependencyInfo
includeInBundle = Config.includeDependencyInfo
} }
buildFeatures { buildFeatures {
@ -300,7 +308,7 @@ dependencies {
implementation(libs.logcat) implementation(libs.logcat)
// Crash reports/analytics // Crash reports/analytics
if (includeAnalytics) { if (Config.includeAnalytics) {
implementation(platform(libs.firebase.bom)) implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics) implementation(libs.firebase.analytics)
implementation(libs.firebase.crashlytics) implementation(libs.firebase.crashlytics)

View file

@ -3,7 +3,7 @@ package exh.log
import com.elvishew.xlog.printer.Printer import com.elvishew.xlog.printer.Printer
import com.google.firebase.Firebase import com.google.firebase.Firebase
import com.google.firebase.crashlytics.crashlytics import com.google.firebase.crashlytics.crashlytics
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.util.system.isDebugBuildType
class CrashlyticsPrinter(private val logLevel: Int) : Printer { class CrashlyticsPrinter(private val logLevel: Int) : Printer {
/** /**
@ -19,7 +19,7 @@ class CrashlyticsPrinter(private val logLevel: Int) : Printer {
Firebase.crashlytics.log("$logLevel/$tag: $msg") Firebase.crashlytics.log("$logLevel/$tag: $msg")
} catch (t: Throwable) { } catch (t: Throwable) {
// Crash in debug if shit like this happens // Crash in debug if shit like this happens
if (BuildConfig.DEBUG) throw t if (isDebugBuildType) throw t
} }
} }
} }

View file

@ -1,229 +0,0 @@
{
"url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/184548882",
"assets_url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/184548882/assets",
"upload_url": "https://uploads.github.com/repos/komikku-app/komikku-preview/releases/184548882/assets{?name,label}",
"html_url": "https://github.com/komikku-app/komikku-preview/releases/tag/r9576",
"id": 184548882,
"author": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
},
"node_id": "RE_kwDOL4q0GM4K__4S",
"tag_name": "r9576",
"target_commitish": "main",
"name": "Komikku Preview r9576",
"draft": false,
"prerelease": false,
"created_at": "2024-10-31T21:22:20Z",
"published_at": "2024-11-10T07:50:48Z",
"assets": [
{
"url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/assets/205437757",
"id": 205437757,
"node_id": "RA_kwDOL4q0GM4MPrs9",
"name": "Komikku-arm64-v8a-r9576.apk",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
},
"content_type": "application/vnd.android.package-archive",
"state": "uploaded",
"size": 36655297,
"download_count": 731,
"created_at": "2024-11-10T07:42:42Z",
"updated_at": "2024-11-10T07:42:43Z",
"browser_download_url": "https://github.com/komikku-app/komikku-preview/releases/download/r9576/Komikku-arm64-v8a-r9576.apk"
},
{
"url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/assets/205437760",
"id": 205437760,
"node_id": "RA_kwDOL4q0GM4MPrtA",
"name": "Komikku-armeabi-v7a-r9576.apk",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
},
"content_type": "application/vnd.android.package-archive",
"state": "uploaded",
"size": 31707343,
"download_count": 72,
"created_at": "2024-11-10T07:42:42Z",
"updated_at": "2024-11-10T07:42:43Z",
"browser_download_url": "https://github.com/komikku-app/komikku-preview/releases/download/r9576/Komikku-armeabi-v7a-r9576.apk"
},
{
"url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/assets/205437758",
"id": 205437758,
"node_id": "RA_kwDOL4q0GM4MPrs-",
"name": "Komikku-r9576.apk",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
},
"content_type": "application/vnd.android.package-archive",
"state": "uploaded",
"size": 88282864,
"download_count": 67,
"created_at": "2024-11-10T07:42:42Z",
"updated_at": "2024-11-10T07:42:44Z",
"browser_download_url": "https://github.com/komikku-app/komikku-preview/releases/download/r9576/Komikku-r9576.apk"
},
{
"url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/assets/205437759",
"id": 205437759,
"node_id": "RA_kwDOL4q0GM4MPrs_",
"name": "Komikku-x86-r9576.apk",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
},
"content_type": "application/vnd.android.package-archive",
"state": "uploaded",
"size": 37822615,
"download_count": 3,
"created_at": "2024-11-10T07:42:42Z",
"updated_at": "2024-11-10T07:42:43Z",
"browser_download_url": "https://github.com/komikku-app/komikku-preview/releases/download/r9576/Komikku-x86-r9576.apk"
},
{
"url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/assets/205437761",
"id": 205437761,
"node_id": "RA_kwDOL4q0GM4MPrtB",
"name": "Komikku-x86_64-r9576.apk",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
},
"content_type": "application/vnd.android.package-archive",
"state": "uploaded",
"size": 39817388,
"download_count": 14,
"created_at": "2024-11-10T07:42:42Z",
"updated_at": "2024-11-10T07:42:43Z",
"browser_download_url": "https://github.com/komikku-app/komikku-preview/releases/download/r9576/Komikku-x86_64-r9576.apk"
}
],
"tarball_url": "https://api.github.com/repos/komikku-app/komikku-preview/tarball/r9576",
"zipball_url": "https://api.github.com/repos/komikku-app/komikku-preview/zipball/r9576",
"body": "#### What's Changed\r\n##### New\r\n- Filter only Obsolete sources in Migration screen (@cuong-tran)\r\n- Add option to always use SSIV for image decoding (@AntsyLich)\r\n\r\n##### Improve\r\n- Trying to load saved-search as much as possible even though filterList might changed (@cuong-tran)\r\n- Improve saved-search usage (@cuong-tran)\r\n- Allow reset filters on SourceFeedScreen (@cuong-tran)\r\n- Allow using saved-search while migration source search (@cuong-tran)\r\n- Change bulk-favorite icon to Heart (@cuong-tran)\r\n- Bump default user agent (@AntsyLich)\r\n- Support comma (,) delimiter when searching library (@cuong-tran)\r\n- Auto format extension repo URLs (@AntsyLich)\r\n- Some improvements to Bangumi tracker search (@MajorTanya)\r\n- Do not sync automatically when not connected to a network. (@NGB-Was-Taken)\r\n\r\n##### Fix\r\n- Fix a rare crash when invoking \"Mark previous as read\" action (@AntsyLich)\r\n- Fix long strip images not loading in some old devices (@AntsyLich)\r\n- Fix InterceptActivity crash (@jobobby04)\r\n- Fix crashes from Exh Updater (@jobobby04)\r\n- Fix app onStart sync (@jobobby04)\r\n- Fix crash on MigrationListScreen with null accessing a mutableState when it's being put in the background (@cuong-tran)\r\n- Fix Reader's dialog font size (@cuong-tran)\r\n- Fix multiple issues with the E-Hentai updater (@jobobby04)\r\n- Fix a possible crash with auto-zoom (@jobobby04)\r\n- Fix source-search clear causing disappearance of search box (@cuong-tran)\r\n\r\n**Full Changelog**: https://github.com/komikku-app/komikku/compare/r9523...r9576\r\n\r\n---\r\n\r\n### Checksums\r\n\r\n| Variant | SHA-256 |\r\n| ------- | ------- |\r\n| Universal | d4810c40e54cfb0834dc1253b83c502ba0307a89114b9842f1a01f270d854979 |\r\n| arm64-v8a | 329720d8616359ee311c8bb4f1b151d8318e4afbf996c7d9202c01778ae99128 |\r\n| armeabi-v7a | cd500e73fd8397b07994a3d4de2028af35d2cc91c1c054ce55ad0321347498ca |\r\n| x86 | cc45fb1109cc08127d084fd780cba15d1d011aae6fae31a05690bc0a3ae027e4 |\r\n| x86_64 | a2da81a678d626e0a80b2fe393f987f8059e3924d67f6e1a6e145972e7373e04 |\r\n\r\n### If you are unsure which apk to download then go with `Komikku-r9576.apk`\r\n",
"reactions": {
"url": "https://api.github.com/repos/komikku-app/komikku-preview/releases/184548882/reactions",
"total_count": 6,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 6,
"rocket": 0,
"eyes": 0
},
"mentions_count": 5
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -37,8 +37,10 @@ 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.isDebugBuildType import eu.kanade.tachiyomi.util.system.isDebugBuildType
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import eu.kanade.tachiyomi.util.system.isReleaseBuildType import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.system.updaterEnabled
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
@ -108,7 +110,7 @@ object AboutScreen : Screen() {
) )
} }
if (BuildConfig.INCLUDE_UPDATER) { if (updaterEnabled) {
item { item {
TextPreferenceWidget( TextPreferenceWidget(
title = stringResource(MR.strings.check_for_updates), title = stringResource(MR.strings.check_for_updates),
@ -368,7 +370,7 @@ object AboutScreen : Screen() {
fun getVersionName(withBuildDate: Boolean): String { fun getVersionName(withBuildDate: Boolean): String {
return when { return when {
BuildConfig.DEBUG -> { isDebugBuildType -> {
"Debug ${BuildConfig.COMMIT_SHA}".let { "Debug ${BuildConfig.COMMIT_SHA}".let {
if (withBuildDate) { if (withBuildDate) {
"$it (${getFormattedBuildTime()})" "$it (${getFormattedBuildTime()})"
@ -377,7 +379,7 @@ object AboutScreen : Screen() {
} }
} }
} }
BuildConfig.PREVIEW -> { isPreviewBuildType -> {
"Beta r${BuildConfig.COMMIT_COUNT}".let { "Beta r${BuildConfig.COMMIT_COUNT}".let {
if (withBuildDate) { if (withBuildDate) {
"$it (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})" "$it (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})"

View file

@ -37,7 +37,7 @@ import com.kevinnzou.web.WebView
import com.kevinnzou.web.rememberWebViewNavigator import com.kevinnzou.web.rememberWebViewNavigator
import com.kevinnzou.web.rememberWebViewState import com.kevinnzou.web.rememberWebViewState
import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBar
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.util.system.isDebugBuildType
import eu.kanade.tachiyomi.util.system.setDefaultSettings import eu.kanade.tachiyomi.util.system.setDefaultSettings
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
@ -125,7 +125,7 @@ fun EhLoginWebViewScreen(
webView.setDefaultSettings() webView.setDefaultSettings()
// Debug mode (chrome://inspect/#devices) // Debug mode (chrome://inspect/#devices)
if (BuildConfig.DEBUG && if (isDebugBuildType &&
0 != webView.context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE 0 != webView.context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE
) { ) {
WebView.setWebContentsDebuggingEnabled(true) WebView.setWebContentsDebuggingEnabled(true)

View file

@ -38,10 +38,10 @@ import com.kevinnzou.web.rememberWebViewState
import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.WarningBanner import eu.kanade.presentation.components.WarningBanner
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.util.system.WebViewUtil import eu.kanade.tachiyomi.util.system.WebViewUtil
import eu.kanade.tachiyomi.util.system.getHtml import eu.kanade.tachiyomi.util.system.getHtml
import eu.kanade.tachiyomi.util.system.isDebugBuildType
import eu.kanade.tachiyomi.util.system.setDefaultSettings import eu.kanade.tachiyomi.util.system.setDefaultSettings
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -258,7 +258,7 @@ fun WebViewScreenContent(
webView.setDefaultSettings() webView.setDefaultSettings()
// Debug mode (chrome://inspect/#devices) // Debug mode (chrome://inspect/#devices)
if (BuildConfig.DEBUG && if (isDebugBuildType &&
0 != webView.context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE 0 != webView.context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE
) { ) {
WebView.setWebContentsDebuggingEnabled(true) WebView.setWebContentsDebuggingEnabled(true)

View file

@ -62,8 +62,10 @@ import eu.kanade.tachiyomi.util.CrashLogUtil
import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.GLUtil import eu.kanade.tachiyomi.util.system.GLUtil
import eu.kanade.tachiyomi.util.system.WebViewUtil import eu.kanade.tachiyomi.util.system.WebViewUtil
import eu.kanade.tachiyomi.util.system.analyticsIncluded
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.isDebugBuildType
import eu.kanade.tachiyomi.util.system.notify import eu.kanade.tachiyomi.util.system.notify
import exh.log.CrashlyticsPrinter import exh.log.CrashlyticsPrinter
import exh.log.EHLogLevel import exh.log.EHLogLevel
@ -110,7 +112,7 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
FirebaseConfig.init(applicationContext) FirebaseConfig.init(applicationContext)
// KMK --> // KMK -->
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree()) if (isDebugBuildType) Timber.plant(Timber.DebugTree())
// KMK <-- // KMK <--
GlobalExceptionHandler.initialize(applicationContext, CrashActivity::class.java) GlobalExceptionHandler.initialize(applicationContext, CrashActivity::class.java)
@ -313,7 +315,7 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
val logLevel = when { val logLevel = when {
EHLogLevel.shouldLog(EHLogLevel.EXTREME) -> LogLevel.ALL EHLogLevel.shouldLog(EHLogLevel.EXTREME) -> LogLevel.ALL
EHLogLevel.shouldLog(EHLogLevel.EXTRA) || BuildConfig.DEBUG -> LogLevel.DEBUG EHLogLevel.shouldLog(EHLogLevel.EXTRA) || isDebugBuildType -> LogLevel.DEBUG
else -> LogLevel.WARN else -> LogLevel.WARN
} }
@ -348,7 +350,7 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
} }
// Install Crashlytics in prod // Install Crashlytics in prod
if (!BuildConfig.DEBUG) { if (analyticsIncluded) {
printers += CrashlyticsPrinter(LogLevel.ERROR) printers += CrashlyticsPrinter(LogLevel.ERROR)
} }

View file

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.updater
import android.content.Context import android.content.Context
import android.os.Build import android.os.Build
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.UnsortedPreferences import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.release.interactor.GetApplicationRelease import tachiyomi.domain.release.interactor.GetApplicationRelease
@ -33,7 +34,7 @@ class AppUpdateChecker(
return withIOContext { return withIOContext {
val result = getApplicationRelease.await( val result = getApplicationRelease.await(
GetApplicationRelease.Arguments( GetApplicationRelease.Arguments(
isPreview = BuildConfig.PREVIEW || peekIntoPreview, isPreview = isPreviewBuildType || peekIntoPreview,
commitCount = BuildConfig.COMMIT_COUNT.toInt(), commitCount = BuildConfig.COMMIT_COUNT.toInt(),
versionName = BuildConfig.VERSION_NAME, versionName = BuildConfig.VERSION_NAME,
repository = getGithubRepo(peekIntoPreview), repository = getGithubRepo(peekIntoPreview),
@ -78,7 +79,7 @@ class AppUpdateChecker(
return withIOContext { return withIOContext {
getApplicationRelease.awaitReleaseNotes( getApplicationRelease.awaitReleaseNotes(
GetApplicationRelease.Arguments( GetApplicationRelease.Arguments(
isPreview = BuildConfig.PREVIEW || peekIntoPreview, isPreview = isPreviewBuildType || peekIntoPreview,
commitCount = BuildConfig.COMMIT_COUNT.toInt(), commitCount = BuildConfig.COMMIT_COUNT.toInt(),
versionName = BuildConfig.VERSION_NAME, versionName = BuildConfig.VERSION_NAME,
repository = getGithubRepo(peekIntoPreview), repository = getGithubRepo(peekIntoPreview),
@ -92,7 +93,7 @@ class AppUpdateChecker(
val GITHUB_REPO: String by lazy { getGithubRepo() } val GITHUB_REPO: String by lazy { getGithubRepo() }
fun getGithubRepo(peekIntoPreview: Boolean = false): String = fun getGithubRepo(peekIntoPreview: Boolean = false): String =
if (BuildConfig.PREVIEW || peekIntoPreview) { if (isPreviewBuildType || peekIntoPreview) {
"komikku-app/komikku-preview" "komikku-app/komikku-preview"
} else { } else {
"komikku-app/komikku" "komikku-app/komikku"
@ -101,7 +102,7 @@ fun getGithubRepo(peekIntoPreview: Boolean = false): String =
val RELEASE_TAG: String by lazy { getReleaseTag() } val RELEASE_TAG: String by lazy { getReleaseTag() }
fun getReleaseTag(peekIntoPreview: Boolean = false): String = fun getReleaseTag(peekIntoPreview: Boolean = false): String =
if (BuildConfig.PREVIEW || peekIntoPreview) { if (isPreviewBuildType || peekIntoPreview) {
"r${BuildConfig.COMMIT_COUNT}" "r${BuildConfig.COMMIT_COUNT}"
} else { } else {
"v${BuildConfig.VERSION_NAME}" "v${BuildConfig.VERSION_NAME}"

View file

@ -9,9 +9,9 @@ import androidx.work.NetworkType
import androidx.work.PeriodicWorkRequestBuilder import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager import androidx.work.WorkManager
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.notificationManager
import eu.kanade.tachiyomi.util.system.updaterEnabled
import exh.log.xLogE import exh.log.xLogE
import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.coroutineScope
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -21,7 +21,7 @@ class AppUpdateJob(private val context: Context, workerParams: WorkerParameters)
override suspend fun doWork(): Result = coroutineScope { override suspend fun doWork(): Result = coroutineScope {
try { try {
if (!BuildConfig.INCLUDE_UPDATER) { if (!updaterEnabled) {
cancelTask(context) cancelTask(context)
return@coroutineScope Result.success() return@coroutineScope Result.success()
} }

View file

@ -8,7 +8,6 @@ import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import app.cash.sqldelight.db.SqlDriver import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.android.AndroidSqliteDriver import app.cash.sqldelight.driver.android.AndroidSqliteDriver
import eu.kanade.domain.track.store.DelayedTrackingStore import eu.kanade.domain.track.store.DelayedTrackingStore
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.core.security.SecurityPreferences import eu.kanade.tachiyomi.core.security.SecurityPreferences
import eu.kanade.tachiyomi.data.BackupRestoreStatus import eu.kanade.tachiyomi.data.BackupRestoreStatus
import eu.kanade.tachiyomi.data.LibraryUpdateStatus import eu.kanade.tachiyomi.data.LibraryUpdateStatus
@ -26,6 +25,7 @@ import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.network.JavaScriptEngine import eu.kanade.tachiyomi.network.JavaScriptEngine
import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.source.AndroidSourceManager import eu.kanade.tachiyomi.source.AndroidSourceManager
import eu.kanade.tachiyomi.util.system.isDebugBuildType
import exh.eh.EHentaiUpdateHelper import exh.eh.EHentaiUpdateHelper
import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
@ -87,7 +87,7 @@ class AppModule(val app: Application) : InjektModule {
}, },
factory = if (securityPreferences.encryptDatabase().get()) { factory = if (securityPreferences.encryptDatabase().get()) {
SupportOpenHelperFactory(CbzCrypto.getDecryptedPasswordSql(), null, false, 25) SupportOpenHelperFactory(CbzCrypto.getDecryptedPasswordSql(), null, false, 25)
} else if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { } else if (isDebugBuildType && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// Support database inspector in Android Studio // Support database inspector in Android Studio
FrameworkSQLiteOpenHelperFactory() FrameworkSQLiteOpenHelperFactory()
} else { } else {
@ -149,7 +149,7 @@ class AppModule(val app: Application) : InjektModule {
addSingletonFactory { ChapterCache(app, get(), get()) } addSingletonFactory { ChapterCache(app, get(), get()) }
addSingletonFactory { CoverCache(app) } addSingletonFactory { CoverCache(app) }
addSingletonFactory { NetworkHelper(app, get(), BuildConfig.DEBUG) } addSingletonFactory { NetworkHelper(app, get(), isDebugBuildType) }
addSingletonFactory { JavaScriptEngine(app) } addSingletonFactory { JavaScriptEngine(app) }
addSingletonFactory<SourceManager> { AndroidSourceManager(app, get(), get()) } addSingletonFactory<SourceManager> { AndroidSourceManager(app, get(), get()) }

View file

@ -87,9 +87,11 @@ 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.isDebugBuildType
import eu.kanade.tachiyomi.util.system.isNavigationBarNeedsScrim import eu.kanade.tachiyomi.util.system.isNavigationBarNeedsScrim
import eu.kanade.tachiyomi.util.system.isPreviewBuildType import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import eu.kanade.tachiyomi.util.system.isReleaseBuildType import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import eu.kanade.tachiyomi.util.system.updaterEnabled
import eu.kanade.tachiyomi.util.view.setComposeContent import eu.kanade.tachiyomi.util.view.setComposeContent
import exh.debug.DebugToggles import exh.debug.DebugToggles
import exh.eh.EHentaiUpdateWorker import exh.eh.EHentaiUpdateWorker
@ -194,7 +196,7 @@ class MainActivity : BaseActivity() {
// SY --> // SY -->
@Suppress("KotlinConstantConditions") @Suppress("KotlinConstantConditions")
val hasDebugOverlay = (BuildConfig.DEBUG || BuildConfig.BUILD_TYPE == "releaseTest") val hasDebugOverlay = (isDebugBuildType || BuildConfig.BUILD_TYPE == "releaseTest")
// SY <-- // SY <--
setComposeContent { setComposeContent {
@ -363,7 +365,7 @@ class MainActivity : BaseActivity() {
var showChangelog by remember { var showChangelog by remember {
mutableStateOf( mutableStateOf(
// KMK --> // KMK -->
// BuildConfig.DEBUG || // isDebugBuildType ||
isReleaseBuildType && isReleaseBuildType &&
didMigration || didMigration ||
isPreviewBuildType && isPreviewBuildType &&
@ -435,7 +437,7 @@ class MainActivity : BaseActivity() {
// App updates // App updates
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
if (BuildConfig.INCLUDE_UPDATER) { if (updaterEnabled) {
try { try {
// KMK --> // KMK -->
AppUpdateJob.setupTask(context) AppUpdateJob.setupTask(context)

View file

@ -5,7 +5,10 @@ package eu.kanade.tachiyomi.util.system
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
val analyticsIncluded: Boolean val analyticsIncluded: Boolean
inline get() = BuildConfig.INCLUDE_ANALYTICS inline get() = BuildConfig.ANALYTICS_INCLUDED
val updaterEnabled: Boolean
inline get() = BuildConfig.UPDATER_ENABLED
val isDebugBuildType: Boolean val isDebugBuildType: Boolean
inline get() = BuildConfig.BUILD_TYPE == "debug" inline get() = BuildConfig.BUILD_TYPE == "debug"

View file

@ -35,6 +35,7 @@ import androidx.compose.ui.unit.sp
import eu.kanade.core.preference.asState import eu.kanade.core.preference.asState
import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.util.system.isDebugBuildType
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -109,7 +110,7 @@ private fun buildInfo(context: Context, sourceBlacklist: Boolean) = buildAnnotat
} }
append('\n') append('\n')
appendItem("Build type:", BuildConfig.BUILD_TYPE) appendItem("Build type:", BuildConfig.BUILD_TYPE)
appendItem("Debug mode:", BuildConfig.DEBUG.asEnabledString()) appendItem("Debug mode:", isDebugBuildType.asEnabledString())
appendItem("Version code:", BuildConfig.VERSION_CODE.toString()) appendItem("Version code:", BuildConfig.VERSION_CODE.toString())
appendItem("Commit SHA:", BuildConfig.COMMIT_SHA) appendItem("Commit SHA:", BuildConfig.COMMIT_SHA)
appendItem("Log level:", EHLogLevel.currentLogLevel.name.lowercase(Locale.getDefault())) appendItem("Log level:", EHLogLevel.currentLogLevel.name.lowercase(Locale.getDefault()))

View file

@ -1,8 +1,8 @@
package mihon.core.migration.migrations package mihon.core.migration.migrations
import android.app.Application import android.app.Application
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.data.updater.AppUpdateJob import eu.kanade.tachiyomi.data.updater.AppUpdateJob
import eu.kanade.tachiyomi.util.system.updaterEnabled
import mihon.core.migration.Migration import mihon.core.migration.Migration
import mihon.core.migration.MigrationContext import mihon.core.migration.MigrationContext
@ -10,7 +10,7 @@ class SetupAppUpdateMigration : Migration {
override val version: Float = Migration.ALWAYS override val version: Float = Migration.ALWAYS
override suspend fun invoke(migrationContext: MigrationContext): Boolean { override suspend fun invoke(migrationContext: MigrationContext): Boolean {
if (!BuildConfig.INCLUDE_UPDATER) return false if (!updaterEnabled) return false
val context = migrationContext.get<Application>() ?: return false val context = migrationContext.get<Application>() ?: return false
AppUpdateJob.setupTask(context) AppUpdateJob.setupTask(context)

View file

@ -1,6 +1,5 @@
package tachiyomi.data.release package tachiyomi.data.release
import dev.icerock.moko.graphics.BuildConfig
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.network.awaitSuccess import eu.kanade.tachiyomi.network.awaitSuccess
@ -26,11 +25,7 @@ class ReleaseServiceImpl(
// KMK --> // KMK -->
override suspend fun releaseNotes(repository: String): List<Release> { override suspend fun releaseNotes(repository: String): List<Release> {
val releases = if (BuildConfig.DEBUG) { val releases = "https://api.github.com/repos/$repository/releases"
"https://raw.githubusercontent.com/$repository/refs/heads/master/app/src/debug/res/raw/releases.json"
} else {
"https://api.github.com/repos/$repository/releases"
}
return with(json) { return with(json) {
networkService.client networkService.client
.newCall(GET(releases)) .newCall(GET(releases))

View file

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.source package eu.kanade.tachiyomi.source
import dev.icerock.moko.graphics.BuildConfig
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
@ -125,15 +124,7 @@ interface CatalogueSource : Source {
runCatching { fetchRelatedMangaList(manga) } runCatching { fetchRelatedMangaList(manga) }
.onSuccess { if (it.isNotEmpty()) pushResults(Pair("", it), false) } .onSuccess { if (it.isNotEmpty()) pushResults(Pair("", it), false) }
.onFailure { e -> .onFailure { e ->
@Suppress("KotlinConstantConditions") logcat(LogPriority.ERROR, e) { "## getRelatedMangaListByExtension: $e" }
if (BuildConfig.BUILD_TYPE == "release") {
logcat(LogPriority.ERROR, e) { "## getRelatedMangaListByExtension: $e" }
} else {
throw UnsupportedOperationException(
"Extension doesn't support site's related entries," +
" please report an issue to Komikku.",
)
}
} }
} }