Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit f3d31ed

Browse files
Fix empty androidacy client id and bundle cronet
Fdroid apparently won't let us attempt to use cronet from gms because something something proprietary AAAAAAAAAAAAAAAAAAAAAAAAAAA The scream is the two hours I spent resolving the 15189759875195791 conflicts that resulted from the change. Also, when ANDROIDACY_CLIENT_ID is empty, do not allow the user to enable Androidacy repo and instead show a message suggesting to download official builds. May have to reword for fdroid Oh, and now no internet actually means no internet and it'll properly notify when repos fail to update. Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent dfe5357 commit f3d31ed

21 files changed

+267
-125
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ If your language is right to left don't forget to set `lang_support_rtl` to `tru
158158

159159
Translators are not expected to have any previous coding experience.
160160

161+
## License
162+
See [LICENSE](LICENCE). Library licenses can be found in the licenses section of the app.
163+
164+
Cronet is licensed under the Apache License, Version 2.0. Static libraries are licensed under
165+
the BSD license. See [LICENSE](https://chromium.googlesource.com/chromium/src/+/master/LICENSE)
166+
for more information. Libraries were built using the microg build script which can be found [here](https://github.com/microg/cronet-build).
167+
161168
## I want to add my own repo
162169

163170
To add you own repo to Fox's mmm it need to follow theses conditions:

app/build.gradle

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ android {
99
namespace "com.fox2code.mmm"
1010
compileSdk 33
1111
buildToolsVersion '30.0.3'
12+
signingConfigs {
13+
release {
14+
// Everything comes from local.properties
15+
Properties properties = new Properties()
16+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
17+
storeFile file(properties.getProperty('keystore.file'))
18+
storePassword properties.getProperty('keystore.password')
19+
keyAlias 'key0'
20+
keyPassword properties.getProperty('keystore.password')
21+
}
22+
}
1223

1324
defaultConfig {
1425
applicationId "com.fox2code.mmm"
@@ -17,13 +28,15 @@ android {
1728
versionCode 60
1829
versionName "0.6.8"
1930
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
31+
signingConfig signingConfigs.release
2032
}
2133

2234
buildTypes {
2335
release {
2436
minifyEnabled true
2537
shrinkResources true
26-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
38+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
39+
'proguard-rules.pro'
2740
}
2841
debug {
2942
applicationIdSuffix '.debug'
@@ -42,19 +55,26 @@ android {
4255
dimension "type"
4356
buildConfigField "boolean", "ENABLE_AUTO_UPDATER", "true"
4457
buildConfigField "boolean", "DEFAULT_ENABLE_CRASH_REPORTING", "true"
45-
buildConfigField("java.util.List<String>",
46-
"ENABLED_REPOS",
47-
"java.util.Arrays.asList(\"magisk_alt_repo\", \"androidacy_repo\")",)
4858
// Get the androidacy client ID from the androidacy.properties
4959
Properties properties = new Properties()
5060
// If androidacy.properties doesn't exist, use the default client ID (an empty string
5161
// - won't work, but it's better than failing to build)
5262
if (project.rootProject.file('androidacy.properties').exists()) {
5363
properties.load(project.rootProject.file('androidacy.properties').newDataInputStream())
5464
} else {
55-
properties.setProperty('client_id', '""')
65+
properties.setProperty('client_id', '')
5666
}
5767
buildConfigField("String", "ANDROIDACY_CLIENT_ID", properties.getProperty('client_id'))
68+
// If client ID is empty, disable androidacy
69+
if (properties.getProperty('client_id').isEmpty()) {
70+
buildConfigField("java.util.List<String>",
71+
"ENABLED_REPOS", "java.util.Arrays.asList(\"magisk_alt_repo\")")
72+
} else {
73+
buildConfigField("java.util.List<String>",
74+
"ENABLED_REPOS",
75+
"java.util.Arrays.asList(\"magisk_alt_repo\", \"androidacy_repo\")",)
76+
}
77+
5878
}
5979

6080
fdroid {
@@ -82,7 +102,7 @@ android {
82102
if (project.rootProject.file('androidacy.properties').exists()) {
83103
properties.load(project.rootProject.file('androidacy.properties').newDataInputStream())
84104
} else {
85-
properties.setProperty('client_id', '""')
105+
properties.setProperty('client_id', '')
86106
}
87107
buildConfigField("String", "ANDROIDACY_CLIENT_ID", properties.getProperty('client_id'))
88108
}
@@ -160,7 +180,7 @@ sentry {
160180
// as Gradle will resolve it to the latest version.
161181
//
162182
// Defaults to the latest published sentry version.
163-
sentryVersion = '6.8.0'
183+
sentryVersion = '6.9.2'
164184
}
165185
}
166186

@@ -198,26 +218,29 @@ dependencies {
198218
implementation 'androidx.work:work-runtime:2.7.1'
199219
implementation 'com.squareup.okhttp3:okhttp-dnsoverhttps:5.0.0-alpha.10'
200220
implementation 'com.squareup.okhttp3:okhttp-brotli:5.0.0-alpha.10'
201-
implementation 'com.google.net.cronet:cronet-okhttp:0.1.0'
221+
// Chromium cronet from microG
222+
implementation fileTree(dir: 'libs', include: '*.jar')
223+
// Force prefer our own version of Cronet
202224
implementation 'com.github.topjohnwu.libsu:io:5.0.1'
203225
implementation 'com.github.Fox2Code:RosettaX:1.0.9'
204226
implementation 'com.github.Fox2Code:AndroidANSI:1.0.1'
205227

206228
if (hasSentryConfig) {
207229
// Error reporting
208-
defaultImplementation 'io.sentry:sentry-android:6.8.0'
209-
defaultImplementation 'io.sentry:sentry-android-fragment:6.8.0'
210-
defaultImplementation 'io.sentry:sentry-android-okhttp:6.8.0'
211-
defaultImplementation 'io.sentry:sentry-android-core:6.8.0'
212-
defaultImplementation 'io.sentry:sentry-android-ndk:6.8.0'
230+
defaultImplementation 'io.sentry:sentry-android:6.9.2'
231+
defaultImplementation 'io.sentry:sentry-android-fragment:6.9.2'
232+
defaultImplementation 'io.sentry:sentry-android-okhttp:6.9.2'
233+
defaultImplementation 'io.sentry:sentry-android-core:6.9.2'
234+
defaultImplementation 'io.sentry:sentry-android-ndk:6.9.2'
213235
}
214236

215237
// Markdown
216238
implementation "io.noties.markwon:core:4.6.2"
217239
implementation "io.noties.markwon:html:4.6.2"
218240
implementation "io.noties.markwon:image:4.6.2"
219241
implementation "io.noties.markwon:syntax-highlight:4.6.2"
220-
implementation 'com.google.android.gms:play-services-cronet:18.0.1'
242+
implementation 'com.google.net.cronet:cronet-okhttp:0.1.0'
243+
// Ignore all org.chromium.net dependencies
221244
annotationProcessor "io.noties:prism4j-bundler:2.0.0"
222245
implementation "com.caverock:androidsvg:1.4"
223246

app/libs/arm64-v8a.jar

2.41 MB
Binary file not shown.

app/libs/armeabi-v7a.jar

1.95 MB
Binary file not shown.
115 KB
Binary file not shown.
1.14 MB
Binary file not shown.

app/libs/x86.jar

2.64 MB
Binary file not shown.

app/libs/x86_64.jar

2.5 MB
Binary file not shown.

app/proguard-rules.pro

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@
187187
android.graphics.Insets getWaterfallInsets();
188188
}
189189

190+
# Keep all of Cronet API and google's internal classes
191+
-keep class org.chromium.net.** { *; }
192+
-keep class org.chromium.** { *; }
193+
-keep class com.google.** { *; }
194+
190195
# Silence some warnings
191196
-dontwarn android.os.SystemProperties
192197
-dontwarn android.view.ThreadedRenderer
@@ -196,4 +201,22 @@
196201
-dontwarn me.weishu.reflection.Reflection
197202
-dontwarn org.lsposed.hiddenapibypass.HiddenApiBypass
198203
-dontwarn rikka.core.res.ResourcesCompatLayoutInflaterListener
199-
-dontwarn rikka.core.util.ResourceUtils
204+
-dontwarn rikka.core.util.ResourceUtils
205+
-dontwarn com.afollestad.materialdialogs.MaterialDialog
206+
-dontwarn com.afollestad.materialdialogs.WhichButton
207+
-dontwarn com.afollestad.materialdialogs.actions.DialogActionExtKt
208+
-dontwarn com.afollestad.materialdialogs.callbacks.DialogCallbackExtKt
209+
-dontwarn com.afollestad.materialdialogs.internal.button.DialogActionButton
210+
-dontwarn com.afollestad.materialdialogs.internal.button.DialogActionButtonLayout
211+
-dontwarn com.afollestad.materialdialogs.internal.main.DialogLayout
212+
-dontwarn com.afollestad.materialdialogs.internal.main.DialogTitleLayout
213+
-dontwarn com.afollestad.materialdialogs.internal.message.DialogContentLayout
214+
-dontwarn com.oracle.svm.core.annotate.AutomaticFeature
215+
-dontwarn com.oracle.svm.core.annotate.Delete
216+
-dontwarn com.oracle.svm.core.annotate.Substitute
217+
-dontwarn com.oracle.svm.core.annotate.TargetClass
218+
-dontwarn com.oracle.svm.core.configure.ResourcesRegistry
219+
-dontwarn javax.lang.model.element.Modifier
220+
-dontwarn org.graalvm.nativeimage.ImageSingletons
221+
-dontwarn org.graalvm.nativeimage.hosted.Feature$BeforeAnalysisAccess
222+
-dontwarn org.graalvm.nativeimage.hosted.Feature

app/src/main/java/com/fox2code/mmm/MainActivity.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import android.widget.TextView;
2323

2424
import androidx.annotation.NonNull;
25-
import androidx.appcompat.app.AlertDialog;
2625
import androidx.appcompat.widget.SearchView;
2726
import androidx.cardview.widget.CardView;
2827
import androidx.core.app.NotificationManagerCompat;
@@ -207,6 +206,8 @@ public void commonNext() {
207206
NotificationType.NEED_CAPTCHA_ANDROIDACY.autoAdd(moduleViewListBuilder);
208207
if (!NotificationType.NO_INTERNET.shouldRemove()) {
209208
moduleViewListBuilder.addNotification(NotificationType.NO_INTERNET);
209+
} else if (!NotificationType.REPO_UPDATE_FAILED.shouldRemove()) {
210+
moduleViewListBuilder.addNotification(NotificationType.REPO_UPDATE_FAILED);
210211
} else {
211212
// Compatibility data still needs to be updated
212213
AppUpdateManager appUpdateManager = AppUpdateManager.getAppUpdateManager();
@@ -406,10 +407,10 @@ public void onRefresh() {
406407
} else {
407408
// Compatibility data still needs to be updated
408409
AppUpdateManager appUpdateManager = AppUpdateManager.getAppUpdateManager();
409-
noodleDebug.replace("Check App Update");
410+
// noodleDebug.replace("Check App Update");
410411
if (BuildConfig.ENABLE_AUTO_UPDATER && appUpdateManager.checkUpdate(true))
411412
moduleViewListBuilder.addNotification(NotificationType.UPDATE_AVAILABLE);
412-
noodleDebug.replace("Check Json Update");
413+
// noodleDebug.replace("Check Json Update");
413414
if (max != 0) {
414415
int current = 0;
415416
noodleDebug.push("");
@@ -429,7 +430,7 @@ public void onRefresh() {
429430
noodleDebug.pop();
430431
}
431432
}
432-
noodleDebug.replace("Apply");
433+
// noodleDebug.replace("Apply");
433434
runOnUiThread(() -> {
434435
this.progressIndicator.setVisibility(View.GONE);
435436
this.swipeRefreshLayout.setRefreshing(false);
@@ -441,8 +442,8 @@ public void onRefresh() {
441442
RepoManager.getINSTANCE().updateEnabledStates();
442443
RepoManager.getINSTANCE().runAfterUpdate(moduleViewListBuilder::appendRemoteModules);
443444
this.moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter);
444-
noodleDebug.pop();
445-
noodleDebug.unbind();
445+
// noodleDebug.pop();
446+
// noodleDebug.unbind();
446447
}, "Repo update thread").start();
447448
}
448449

0 commit comments

Comments
 (0)