From df602c5220bf588ff367ca9503086367be0ed497 Mon Sep 17 00:00:00 2001 From: Michatec Date: Sun, 8 Mar 2026 14:39:00 +0100 Subject: [PATCH] - Updated the PreferencesFragment.kt - New Build Variant added - New strings added in strings.xml - Updated build.gradle --- build.gradle | 12 ++++ .../com/michatec/store/entity/Repository.kt | 64 +++++++++++-------- .../store/screen/PreferencesFragment.kt | 15 +++++ src/main/res/values/strings.xml | 4 +- 4 files changed, 68 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index f7b2ef7..c3b17bb 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,18 @@ android { targetCompatibility JavaVersion.VERSION_17 } + flavorDimensions "distributor" + productFlavors { + michas { + dimension "distributor" + buildConfigField "boolean", "FLAVOR_FDROID", "false" + } + fdroid { + dimension "distributor" + buildConfigField "boolean", "FLAVOR_FDROID", "true" + } + } + buildTypes { debug { minifyEnabled false diff --git a/src/main/kotlin/com/michatec/store/entity/Repository.kt b/src/main/kotlin/com/michatec/store/entity/Repository.kt index 30e03d0..51e9c57 100644 --- a/src/main/kotlin/com/michatec/store/entity/Repository.kt +++ b/src/main/kotlin/com/michatec/store/entity/Repository.kt @@ -2,6 +2,7 @@ package com.michatec.store.entity import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.JsonParser +import com.michatec.store.BuildConfig import com.michatec.store.utility.extension.json.* data class Repository( @@ -72,36 +73,47 @@ data class Repository( lastModified, entityTag, updated, timestamp, authentication) } - private fun defaultRepository(address: String, name: String, description: String, + private fun defaultRepository(address: String, name: String, description: String, version: Int, enabled: Boolean, fingerprint: String, authentication: String): Repository { return Repository(-1, address, emptyList(), name, description, version, enabled, fingerprint, "", "", 0L, 0L, authentication) } - val defaultRepositories = listOf(run { - defaultRepository("https://repo.dgplayser.duckdns.org/fdroid/repo", "Michachatz F-Droid Repo", "Michachatz official repository. " + - "Everything in this repository is always built from the source code.", - 21, true, "3546DCBDD900F280EE2161CC163C1156BE2C2F3EB810415115039E0C7D3242C0", "") - }, - run { - defaultRepository("https://f-droid.org/repo", "F-Droid", "The official F-Droid Free Software repository. " + - "Everything in this repository is always built from the source code.", - 21, false, "43238D512C1E5EB2D6569F4A3AFBF5523418B82E0A3ED1552770ABB9A9C9CCAB", "") - }, run { - defaultRepository("https://f-droid.org/archive", "F-Droid Archive", "The archive of the official F-Droid Free " + - "Software repository. Apps here are old and can contain known vulnerabilities and security issues!", - 21, false, "43238D512C1E5EB2D6569F4A3AFBF5523418B82E0A3ED1552770ABB9A9C9CCAB", "") - }, run { - defaultRepository("https://guardianproject.info/fdroid/repo", "Guardian Project Official Releases", "The " + - "official repository of The Guardian Project apps for use with the F-Droid client. Applications in this " + - "repository are official binaries built by the original application developers and signed by the same key as " + - "the APKs that are released in the Google Play Store.", - 21, false, "B7C2EEFD8DAC7806AF67DFCD92EB18126BC08312A7F2D6F3862E46013C7A6135", "") - }, run { - defaultRepository("https://guardianproject.info/fdroid/archive", "Guardian Project Archive", "The official " + - "repository of The Guardian Project apps for use with the F-Droid client. This contains older versions of " + - "applications from the main repository.", 21, false, - "B7C2EEFD8DAC7806AF67DFCD92EB18126BC08312A7F2D6F3862E46013C7A6135", "") - }) + val defaultRepositories: List + get() { + val isFdroid = BuildConfig.FLAVOR_FDROID + return listOfNotNull( + if (isFdroid) null else defaultRepository( + "https://repo.dgplayser.duckdns.org/fdroid/repo", + "Michachatz F-Droid Repo", + "Michachatz official repository. Everything in this repository is always built from the source code.", + 21, true, "3546DCBDD900F280EE2161CC163C1156BE2C2F3EB810415115039E0C7D3242C0", "" + ), + defaultRepository( + "https://f-droid.org/repo", + "F-Droid", + "The official F-Droid Free Software repository. Everything in this repository is always built from the source code.", + 21, isFdroid, "43238D512C1E5EB2D6569F4A3AFBF5523418B82E0A3ED1552770ABB9A9C9CCAB", "" + ), + defaultRepository( + "https://f-droid.org/archive", + "F-Droid Archive", + "The archive of the official F-Droid Free Software repository. Apps here are old and can contain known vulnerabilities and security issues!", + 21, false, "43238D512C1E5EB2D6569F4A3AFBF5523418B82E0A3ED1552770ABB9A9C9CCAB", "" + ), + defaultRepository( + "https://guardianproject.info/fdroid/repo", + "Guardian Project Official Releases", + "The official repository of The Guardian Project apps for use with the F-Droid client.", + 21, false, "B7C2EEFD8DAC7806AF67DFCD92EB18126BC08312A7F2D6F3862E46013C7A6135", "" + ), + defaultRepository( + "https://guardianproject.info/fdroid/archive", + "Guardian Project Archive", + "The official repository of The Guardian Project apps for use with the F-Droid client. This contains older versions.", + 21, false, "B7C2EEFD8DAC7806AF67DFCD92EB18126BC08312A7F2D6F3862E46013C7A6135", "" + ) + ) + } } } diff --git a/src/main/kotlin/com/michatec/store/screen/PreferencesFragment.kt b/src/main/kotlin/com/michatec/store/screen/PreferencesFragment.kt index 9908c1e..85200d0 100644 --- a/src/main/kotlin/com/michatec/store/screen/PreferencesFragment.kt +++ b/src/main/kotlin/com/michatec/store/screen/PreferencesFragment.kt @@ -86,6 +86,21 @@ class PreferencesFragment: ScreenFragment() { addSwitch(Preferences.Key.IncompatibleVersions, getString(R.string.incompatible_versions), getString(R.string.incompatible_versions_summary)) } + preferencesLayout.addCategory("Credits") { + val texts = 16f + addView(TextView(context).apply { + setText(R.string.credits) + textSize = texts + setPadding(resources.sizeScaled(16), resources.sizeScaled(16), 0, resources.sizeScaled(8)) + setTextColor(context.getColorFromAttr(android.R.attr.textColorPrimary)) + }) + addView(TextView(context).apply { + setText(R.string.credits_to_fork) + textSize = texts + setPadding(resources.sizeScaled(16), resources.sizeScaled(16), 0, resources.sizeScaled(14)) + setTextColor(context.getColorFromAttr(android.R.attr.textColorPrimary)) + }) + } disposable = Preferences.observable .observeOn(AndroidSchedulers.mainThread()) diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a25d7f2..75624d1 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -10,7 +10,7 @@ Always Anti-features Application - Store + Michas Store Application not found Author email Author website @@ -164,5 +164,7 @@ Waiting to start download Website The repository address was redirected to %s. Do you want to use it instead? + Credits to Michatec + This is a fork from github.com/kitsunyan/foxy-droid.