diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 689610f..b0eb589 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -43,6 +43,7 @@ android { useSupportLibrary = true } multiDexEnabled = true + resourceConfigurations += setOf() } splits { @@ -74,10 +75,14 @@ android { proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) + renderscriptOptimLevel = 3 } getByName("debug") { applicationIdSuffix = ".debug" isDebuggable = true + versionNameSuffix = "-debug" + isJniDebuggable = true + isRenderscriptDebuggable = true // ONLY FOR TESTING SENTRY // minifyEnabled true @@ -137,7 +142,7 @@ android { buildConfigField( "String", "ANDROIDACY_CLIENT_ID", "\"" + propertiesA.getProperty("client_id") + "\"" ) - // If client ID is empty, disable androidacy + buildConfigField( "java.util.List", "ENABLED_REPOS", @@ -146,6 +151,65 @@ android { } + // play variant. pretty similiar to default, but with an empty inital online repo list, and use play_client_id instead of client_id + create("play") { + // debug http requests. do not set this to true if you care about performance!!!!! + buildConfigField("boolean", "DEBUG_HTTP", "false") + // Latest commit hash as BuildConfig.COMMIT_HASH + buildConfigField("String", "COMMIT_HASH", "\"$gitCommitHash\"") + // Get the current branch name as BuildConfig.BRANCH_NAME + buildConfigField("String", "BRANCH_NAME", "\"$gitBranch\"") + // Get remote url as BuildConfig.REMOTE_URL + buildConfigField("String", "REMOTE_URL", "\"$gitRemote\"") + dimension = "type" + buildConfigField("boolean", "ENABLE_AUTO_UPDATER", "false") + buildConfigField("boolean", "DEFAULT_ENABLE_CRASH_REPORTING", "true") + buildConfigField("boolean", "DEFAULT_ENABLE_CRASH_REPORTING_PII", "true") + buildConfigField("boolean", "DEFAULT_ENABLE_ANALYTICS", "true") + val properties = Properties() + if (project.rootProject.file("local.properties").exists()) { + // grab matomo.url + buildConfigField( + "String", "ANALYTICS_ENDPOINT", "\"" + properties.getProperty( + "matomo.url", "https://s-api.androidacy.com/matomo.php" + "\"" + ) + ) + } else { + buildConfigField( + "String", "ANALYTICS_ENDPOINT", "\"https://s-api.androidacy.com/matomo.php\"" + ) + } + buildConfigField("boolean", "ENABLE_PROTECTION", "true") + // Get the androidacy client ID from the androidacy.properties + + val propertiesA = Properties() + // If androidacy.properties doesn"t exist, use the default client ID which is heavily + // rate limited to 30 requests per minute + if (project.rootProject.file("androidacy.properties").exists()) { + propertiesA.load(project.rootProject.file("androidacy.properties").inputStream()) + properties.setProperty( + "client_id", "\"" + propertiesA.getProperty( + "play_client_id", + "5KYccdYxWB2RxMq5FTbkWisXi2dS6yFN9R7RVlFCG98FRdz6Mf5ojY2fyJCUlXJZ" + ) + "\"" + ) + } else { + properties.setProperty( + "client_id", "5KYccdYxWB2RxMq5FTbkWisXi2dS6yFN9R7RVlFCG98FRdz6Mf5ojY2fyJCUlXJZ" + ) + } + buildConfigField( + "String", "ANDROIDACY_CLIENT_ID", "\"" + propertiesA.getProperty("client_id") + "\"" + ) + + buildConfigField( + "java.util.List", + "ENABLED_REPOS", + "java.util.Arrays.asList(\"\")", + ) + + } + create("fdroid") { dimension = "type" applicationIdSuffix = ".fdroid" diff --git a/app/src/main/java/com/fox2code/mmm/MainApplication.java b/app/src/main/java/com/fox2code/mmm/MainApplication.java index e8577b7..aa2251f 100644 --- a/app/src/main/java/com/fox2code/mmm/MainApplication.java +++ b/app/src/main/java/com/fox2code/mmm/MainApplication.java @@ -104,6 +104,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con private static MainApplication INSTANCE; private static boolean firstBoot; private static HashMap mSharedPrefs; + public static String updateCheckBg; static { Shell.setDefaultBuilder(shellBuilder = Shell.Builder.create().setFlags(Shell.FLAG_REDIRECT_STDERR).setTimeout(10).setInitializers(InstallerInitializer.class)); @@ -248,7 +249,13 @@ public class MainApplication extends FoxApplication implements androidx.work.Con } public static boolean isBackgroundUpdateCheckEnabled() { - return !wrapped && getPreferences("mmm").getBoolean("pref_background_update_check", true); + if (updateCheckBg != null) { + return Boolean.parseBoolean(updateCheckBg); + } + boolean wrapped = isWrapped(); + boolean updateCheckBgTemp = !wrapped && getPreferences("mmm").getBoolean("pref_background_update_check", true); + updateCheckBg = String.valueOf(updateCheckBgTemp); + return Boolean.parseBoolean(updateCheckBg); } public static boolean isAndroidacyTestMode() { diff --git a/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java b/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java index 5b1f6c0..d9f351d 100644 --- a/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java +++ b/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java @@ -67,7 +67,7 @@ public final class AndroidacyRepoData extends RepoData { this.defaultName = "Androidacy Modules Repo"; this.defaultWebsite = RepoManager.ANDROIDACY_MAGISK_REPO_HOMEPAGE; this.defaultSupport = "https://t.me/androidacy_discussions"; - this.defaultDonate = "https://www.androidacy.com/membership-account/membership-checkout/?level=2&discount_code=FOXWINTER2&utm_souce=foxmmm&utm_medium=android-app&utm_campaign=fox-upgrade-promo"; + this.defaultDonate = "https://www.androidacy.com/membership-account/membership-checkout/?level=2&discount_code=FOX2CODE&utm_souce=foxmmm&utm_medium=android-app&utm_campaign=fox-upgrade-promo"; this.defaultSubmitModule = "https://www.androidacy.com/module-repository-applications/"; this.host = testMode ? "staging-api.androidacy.com" : "production-api.androidacy.com"; this.testMode = testMode; diff --git a/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java b/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java index 25274f2..4d4a6ab 100644 --- a/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java +++ b/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java @@ -846,6 +846,40 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity { } return true; }); + + LongClickablePreference pref_donate_fox = findPreference("pref_donate_fox"); + pref_donate_fox.setOnPreferenceClickListener(p -> { + // open fox + IntentHelper.openUrl(getFoxActivity(this), "https://paypal.me/fox2code"); + return true; + }); + // handle long click on pref_donate_fox + pref_donate_fox.setOnPreferenceLongClickListener(p -> { + // copy to clipboard + String toastText = requireContext().getString(R.string.link_copied); + clipboard.setPrimaryClip(ClipData.newPlainText(toastText, "https://paypal.me/fox2code")); + Toast.makeText(requireContext(), toastText, Toast.LENGTH_SHORT).show(); + return true; + }); + // now handle pref_donate_androidacy + LongClickablePreference pref_donate_androidacy = findPreference("pref_donate_androidacy"); + pref_donate_androidacy.setOnPreferenceClickListener(p -> { + // copy FOX2CODE promo code to clipboard and toast user that they can use it for half off any subscription + String toastText = requireContext().getString(R.string.promo_code_copied); + clipboard.setPrimaryClip(ClipData.newPlainText(toastText, "FOX2CODE")); + Toast.makeText(requireContext(), toastText, Toast.LENGTH_SHORT).show(); + // open androidacy + IntentHelper.openUrl(getFoxActivity(this), "https://www.androidacy.com/membership-join/?utm_source=foxmmm&utm_medium=app&utm_campaign=donate"); + return true; + }); + // handle long click on pref_donate_androidacy + pref_donate_androidacy.setOnPreferenceLongClickListener(p -> { + // copy to clipboard + String toastText = requireContext().getString(R.string.link_copied); + clipboard.setPrimaryClip(ClipData.newPlainText(toastText, "https://www.androidacy.com/membership-join/?utm_source=foxmmm&utm_medium=app&utm_campaign=donate")); + Toast.makeText(requireContext(), toastText, Toast.LENGTH_SHORT).show(); + return true; + }); } private void openFragment(Fragment fragment, @StringRes int title) { @@ -1015,12 +1049,17 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity { if (userInfo != null) { String userRole = userInfo[0][1]; if (Objects.nonNull(userRole) && !Objects.equals(userRole, "Guest")) { - // Disable the pref_androidacy_repo_api_token preference + // Disable the pref_androidacy_repo_api_donate preference LongClickablePreference prefAndroidacyRepoApiD = Objects.requireNonNull(findPreference("pref_androidacy_repo_donate")); prefAndroidacyRepoApiD.setEnabled(false); prefAndroidacyRepoApiD.setSummary(R.string.upgraded_summary); prefAndroidacyRepoApiD.setTitle(R.string.upgraded); prefAndroidacyRepoApiD.setIcon(R.drawable.baseline_check_24); + } else if (BuildConfig.FLAVOR.equals("play")) { + // Disable the pref_androidacy_repo_api_token preference and hide the donate button + LongClickablePreference prefAndroidacyRepoApiD = Objects.requireNonNull(findPreference("pref_androidacy_repo_donate")); + prefAndroidacyRepoApiD.setEnabled(false); + prefAndroidacyRepoApiD.setVisible(false); } } String[] originalApiKeyRef = new String[]{MainApplication.getPreferences("androidacy").getString("pref_androidacy_api_token", "")}; @@ -1093,8 +1132,7 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity { new Handler(Looper.getMainLooper()).post(() -> { Snackbar.make(requireView(), R.string.api_key_invalid, BaseTransientBottomBar.LENGTH_SHORT).show(); // Save the original key - MainApplication.getPreferences( - "androidacy").edit().putString("pref_androidacy_api_token", originalApiKeyRef[0]).apply(); + MainApplication.getPreferences("androidacy").edit().putString("pref_androidacy_api_token", originalApiKeyRef[0]).apply(); // Re-show the dialog with an error prefAndroidacyRepoApiKey.performClick(); // Show error diff --git a/app/src/main/res/layout/settings_activity.xml b/app/src/main/res/layout/settings_activity.xml index 36f1d4e..c5e0a80 100644 --- a/app/src/main/res/layout/settings_activity.xml +++ b/app/src/main/res/layout/settings_activity.xml @@ -2,6 +2,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" + android:padding="4dp" + app:layout_constraintTop_toTopOf="parent" android:orientation="vertical"> Monet is not compatible with transparent themes. Blur is not compatible with transparent themes. You are setting a transparent theme - Transparent themes may have some inconsistencies and may not work on all ROMs. In additon, monet and blur will be disabled. You can change back at any time. + Transparent themes may have some inconsistencies and may not work on all ROMs. In addition, monet and blur will be disabled. You can change back at any time. Custom repos are always on until you remove them. We encountered an error! Please help us improve the app by adding some information about the error below.\nName and email are optional but will @@ -233,14 +233,14 @@ Enable the Magisk Alt Repo Much more lax than the original. Has a lot of modules at the cost of some safety. Enable Sentry - Crash reporting and performance monitoring. All reports are striclty anonymous and confidential. + Crash reporting and performance monitoring. All reports are strictly anonymous and confidential. You can add custom repos later in settings. Repos Miscellaneous Skip Enabling blur on lower-end device You are trying to enable blur on a device that may not perform well with it.\nYou may enable it, but this may lead to a poor user experience and we recommend you don\'t. - This repo has less restrictions and reviews, which may lead to lower quality modules. Pretty barebones but has a lot of modules. + This repo has less restrictions and reviews, which may lead to lower quality modules. Pretty bare bones but has a lot of modules. You are about to reboot your device. If you\'ve saved your work, hit OK to continue. Otherwise, hit cancel. Package %s is missing for module config, so we cannot launch it. Clear app data @@ -392,7 +392,7 @@ Allows sending additional information in crash reports, some of which may contain personally identifiable information such as IP address and device identifiers. Send additional information Send additional info in crash reports. - This may include device identifiers and IP addresses. No data will be used for any other purpose besides analyzing crashes and improving performance. + This may include device identifiers and IP addresses. No data will be used for any other purpose besides analyzing crashes and improving performance. Error accessing WebView. Functionality may be impacted. To enable the finish button, please scroll down and view all the options. URL is required @@ -407,4 +407,9 @@ Debugging News and updates Go back + Donate to Fox2Code + Donate to Androidacy + Buy a premium subscription to Androidacy to support the app and the repo. + Use the copied code for half off your first month! + Please note that some settings may not take effect until you restart the app. diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index 7bb9a48..479c71d 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -1,6 +1,15 @@ + + + + @@ -232,6 +241,18 @@ + + +