From 14de80c54ecdd24aa6e523b18c4a435f072a0ac2 Mon Sep 17 00:00:00 2001 From: TheOneWithTheBraid Date: Wed, 25 May 2022 12:46:51 +0200 Subject: [PATCH] chore: apply F-Droid hotfixes Signed-off-by: TheOneWithTheBraid --- android/app/build.gradle | 7 - android/app/proguard-rules.pro | 41 ----- android/app/src/main/AndroidManifest.xml | 1 - .../chat/fluffy/fluffychat/MainActivity.kt | 2 + linux/flutter/generated_plugins.cmake | 8 + pubspec.lock | 30 ++-- scripts/enable-android-google-services.patch | 168 +++++++++--------- windows/flutter/generated_plugins.cmake | 8 + 8 files changed, 117 insertions(+), 148 deletions(-) delete mode 100644 android/app/proguard-rules.pro diff --git a/android/app/build.gradle b/android/app/build.gradle index 3a1f9293..001fbd72 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -68,10 +68,6 @@ android { } release { signingConfig signingConfigs.release - minifyEnabled false - shrinkResources false - - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } @@ -83,9 +79,6 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" //implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'androidx.multidex:multidex:2.0.1' } diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro deleted file mode 100644 index 40570865..00000000 --- a/android/app/proguard-rules.pro +++ /dev/null @@ -1,41 +0,0 @@ --optimizationpasses 5 -## Flutter wrapper --keep class io.flutter.app.** { *; } --keep class io.flutter.plugin.** { *; } --keep class io.flutter.util.** { *; } --keep class io.flutter.view.** { *; } --keep class io.flutter.** { *; } --keep class io.flutter.plugins.** { *; } --dontwarn io.flutter.embedding.** - -##---------------Begin: proguard configuration for Gson (Needed for flutter_local_notifications) ---------- -# Gson uses generic type information stored in a class file when working with fields. Proguard -# removes such information by default, so configure it to keep all of it. --keepattributes Signature - -# For using GSON @Expose annotation --keepattributes *Annotation* - -# Gson specific classes --dontwarn sun.misc.** - -# Application classes that will be serialized/deserialized over Gson --keep class com.google.gson.examples.android.model.** { ; } - -# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, -# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) --keep class * extends com.google.gson.TypeAdapter --keep class * implements com.google.gson.TypeAdapterFactory --keep class * implements com.google.gson.JsonSerializer --keep class * implements com.google.gson.JsonDeserializer - -# Prevent R8 from leaving Data object members always null --keepclassmembers,allowobfuscation class * { - @com.google.gson.annotations.SerializedName ; -} - -# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. --keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken --keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken - -##---------------End: proguard configuration for Gson (Needed for flutter_local_notifications) ---------- \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6faacc94..db30b324 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -28,7 +28,6 @@ tools:overrideLibrary="io.wazo.callkeep, net.touchcapture.qr.flutterqr, com.cloudwebrtc.webrtc, org.webrtc, com.it_nomads.fluttersecurestorage, com.pichillilorenzo.flutter_inappwebview, com.example.video_compress, com.otaliastudios.transcoder, com.otaliastudios.opengl, com.kineapps.flutter_file_dialog"/> ) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/pubspec.lock b/pubspec.lock index 8d0f0049..39dc5e06 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -56,7 +56,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.6" + version: "3.1.11" args: dependency: transitive description: @@ -182,7 +182,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" connectivity_plus: dependency: "direct main" description: @@ -240,7 +240,7 @@ packages: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.2.0" cross_file: dependency: transitive description: @@ -394,7 +394,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: transitive description: @@ -905,7 +905,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" just_audio: dependency: "direct main" description: @@ -1005,7 +1005,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" matrix: dependency: "direct main" description: @@ -1161,7 +1161,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_drawing: dependency: transitive description: @@ -1592,7 +1592,7 @@ packages: description: path: "." ref: listenable - resolved-ref: "3da78eea5d222baa1b266c19284acafee090f6be" + resolved-ref: "2d9f2a40590c13aadfd226c2e41b08e155e6a92e" url: "https://github.com/TheOneWithTheBraid/snapping_sheet.git" source: git version: "3.1.0" @@ -1616,7 +1616,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" sqflite: dependency: transitive description: @@ -1686,21 +1686,21 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.19.5" + version: "1.20.2" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" + version: "0.4.9" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.11" timezone: dependency: transitive description: @@ -1882,7 +1882,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" very_good_analysis: dependency: transitive description: @@ -1945,7 +1945,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "7.5.0" + version: "8.2.2" vrouter: dependency: "direct main" description: @@ -2059,5 +2059,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.16.1 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.8.0" diff --git a/scripts/enable-android-google-services.patch b/scripts/enable-android-google-services.patch index 31a2f21b..8633cf3d 100644 --- a/scripts/enable-android-google-services.patch +++ b/scripts/enable-android-google-services.patch @@ -1,91 +1,91 @@ -diff --git a/android/app/build.gradle b/android/app/build.gradle -index ad9ffb87..37baafb1 100644 ---- a/android/app/build.gradle -+++ b/android/app/build.gradle -@@ -44,7 +44,7 @@ android { - - defaultConfig { - applicationId "chat.fluffy.fluffychat" -- minSdkVersion 16 -+ minSdkVersion 19 - targetSdkVersion 30 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName -@@ -82,11 +82,11 @@ flutter { - - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -- //implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 -+ implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' - implementation 'androidx.multidex:multidex:2.0.1' - } - --//apply plugin: 'com.google.gms.google-services' -+apply plugin: 'com.google.gms.google-services' -diff --git a/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt b/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt -index d9930f55..510e9845 100644 ---- a/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt -+++ b/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt -@@ -1,4 +1,4 @@ --/*package chat.fluffy.fluffychat -+package chat.fluffy.fluffychat - - import com.famedly.fcm_shared_isolate.FcmSharedIsolateService - -@@ -33,4 +33,3 @@ class FcmPushService : FcmSharedIsolateService() { +diff --git b/android/app/build.gradle a/android/app/build.gradle +index 001fbd72..3a1f9293 100644 +--- b/android/app/build.gradle ++++ a/android/app/build.gradle +@@ -68,6 +68,10 @@ android { + } + release { + signingConfig signingConfigs.release ++ minifyEnabled false ++ shrinkResources false ++ ++ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } --*/ -\ No newline at end of file -diff --git a/android/build.gradle b/android/build.gradle -index 85aa8647..3b7e09e7 100644 ---- a/android/build.gradle -+++ b/android/build.gradle -@@ -8,7 +8,7 @@ buildscript { - dependencies { - classpath 'com.android.tools.build:gradle:4.2.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" -- //classpath 'com.google.gms:google-services:4.3.8' -+ classpath 'com.google.gms:google-services:4.3.8' - } +@@ -79,6 +83,9 @@ flutter { + dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + //implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 ++ testImplementation 'junit:junit:4.12' ++ androidTestImplementation 'androidx.test:runner:1.1.1' ++ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' + implementation 'androidx.multidex:multidex:2.0.1' } -diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart -index 00ca2aaa..8bb8a156 100644 ---- a/lib/utils/background_push.dart -+++ b/lib/utils/background_push.dart -@@ -39,7 +39,7 @@ import '../config/setting_keys.dart'; - import 'famedlysdk_store.dart'; - import 'platform_infos.dart'; +diff --git b/android/app/proguard-rules.pro a/android/app/proguard-rules.pro +new file mode 100644 +index 00000000..40570865 +--- /dev/null ++++ a/android/app/proguard-rules.pro +@@ -0,0 +1,41 @@ ++-optimizationpasses 5 ++## Flutter wrapper ++-keep class io.flutter.app.** { *; } ++-keep class io.flutter.plugin.** { *; } ++-keep class io.flutter.util.** { *; } ++-keep class io.flutter.view.** { *; } ++-keep class io.flutter.** { *; } ++-keep class io.flutter.plugins.** { *; } ++-dontwarn io.flutter.embedding.** ++ ++##---------------Begin: proguard configuration for Gson (Needed for flutter_local_notifications) ---------- ++# Gson uses generic type information stored in a class file when working with fields. Proguard ++# removes such information by default, so configure it to keep all of it. ++-keepattributes Signature ++ ++# For using GSON @Expose annotation ++-keepattributes *Annotation* ++ ++# Gson specific classes ++-dontwarn sun.misc.** ++ ++# Application classes that will be serialized/deserialized over Gson ++-keep class com.google.gson.examples.android.model.** { ; } ++ ++# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, ++# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) ++-keep class * extends com.google.gson.TypeAdapter ++-keep class * implements com.google.gson.TypeAdapterFactory ++-keep class * implements com.google.gson.JsonSerializer ++-keep class * implements com.google.gson.JsonDeserializer ++ ++# Prevent R8 from leaving Data object members always null ++-keepclassmembers,allowobfuscation class * { ++ @com.google.gson.annotations.SerializedName ; ++} ++ ++# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. ++-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken ++-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken ++ ++##---------------End: proguard configuration for Gson (Needed for flutter_local_notifications) ---------- +\ No newline at end of file +diff --git b/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt a/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt +index 1afc4606..894d1571 100644 +--- b/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt ++++ a/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt +@@ -7,13 +7,11 @@ import android.content.Context + import androidx.multidex.MultiDex --//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; -+import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; + class MainActivity : FlutterActivity() { +- + override fun attachBaseContext(base: Context) { + super.attachBaseContext(base) + MultiDex.install(this) + } - class NoTokenException implements Exception { - String get cause => 'Cannot get firebase token'; -@@ -65,7 +65,7 @@ class BackgroundPush { - - final pendingTests = >{}; - -- final dynamic firebase = null; //FcmSharedIsolate(); -+ final dynamic firebase = FcmSharedIsolate(); - - DateTime? lastReceivedPush; - -diff --git a/pubspec.yaml b/pubspec.yaml -index c6295788..8dd17ce4 100644 ---- a/pubspec.yaml -+++ b/pubspec.yaml -@@ -24,7 +24,7 @@ dependencies: - email_validator: ^2.0.1 - emoji_picker_flutter: ^1.1.2 - encrypt: ^5.0.1 -- #fcm_shared_isolate: ^0.1.0 -+ fcm_shared_isolate: ^0.1.0 - file_picker_cross: ^4.6.0 - flutter: - sdk: flutter +- + override fun provideFlutterEngine(context: Context): FlutterEngine? { + return provideEngine(this) + } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index fec9fdda..355f8578 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -12,6 +12,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_windows ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -20,3 +23,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin)