From c50d65fb745f876472e5ea8d045403e9b965f666 Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 21 Dec 2023 13:57:10 +0100 Subject: [PATCH] feat: Switch to firebase messaging package --- .github/workflows/integrate.yaml | 2 +- .github/workflows/main_deploy.yaml | 2 +- .github/workflows/release.yaml | 4 +- android/app/build.gradle | 4 +- android/app/src/main/AndroidManifest.xml | 7 - .../chat/fluffy/fluffychat/FcmPushService.kt | 36 ----- .../chat/fluffy/fluffychat/MainActivity.kt | 2 - android/settings.gradle | 2 +- firebase.json | 1 + lib/main.dart | 4 + lib/utils/background_push.dart | 33 ++--- lib/utils/init_with_restore.dart | 6 +- lib/utils/push_helper.dart | 21 ++- macos/Runner.xcodeproj/project.pbxproj | 4 + macos/Runner/GoogleService-Info.plist | 30 ++++ pubspec.yaml | 3 +- scripts/build-ios.sh | 2 +- scripts/build-macos.sh | 2 +- scripts/enable-android-google-services.patch | 136 ------------------ scripts/enable-google-services.sh | 6 + scripts/release-ios-testflight.sh | 2 +- 21 files changed, 97 insertions(+), 212 deletions(-) delete mode 100644 android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt create mode 100644 firebase.json create mode 100644 macos/Runner/GoogleService-Info.plist delete mode 100644 scripts/enable-android-google-services.patch create mode 100755 scripts/enable-google-services.sh diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index d487d6b4b..067674546 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -24,7 +24,7 @@ jobs: run: dart run license_checker check-licenses -c licenses.yaml --problematic - run: flutter analyze - name: Apply google services patch - run: git apply ./scripts/enable-android-google-services.patch + run: ./scripts/enable-google-services.sh - run: flutter analyze - run: flutter test diff --git a/.github/workflows/main_deploy.yaml b/.github/workflows/main_deploy.yaml index 1a817f006..518fad78b 100644 --- a/.github/workflows/main_deploy.yaml +++ b/.github/workflows/main_deploy.yaml @@ -57,7 +57,7 @@ jobs: - name: Install Fastlane run: gem install fastlane -NV - name: Apply Google Services Patch - run: git apply ./scripts/enable-android-google-services.patch + run: ./scripts/enable-google-services.sh - name: Remove Emoji Font run: | rm -rf fonts/NotoEmoji diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 204d1e0e0..cdc4fc2be 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -80,7 +80,7 @@ jobs: flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - name: Apply Google Services Patch - run: git apply ./scripts/enable-android-google-services.patch + run: ./scripts/enable-google-services.sh - name: Remove Emoji Font run: | rm -rf fonts/NotoEmoji @@ -148,7 +148,7 @@ jobs: - name: Install Fastlane run: gem install fastlane -NV - name: Apply Google Services Patch - run: git apply ./scripts/enable-android-google-services.patch + run: ./scripts/enable-google-services.sh - name: Remove Emoji Font run: | rm -rf fonts/NotoEmoji diff --git a/android/app/build.gradle b/android/app/build.gradle index 7520ff2ab..29d0d808b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -67,7 +67,7 @@ android { } release { signingConfig signingConfigs.release - } + } } // https://stackoverflow.com/a/77494454/8222484 packagingOptions { @@ -83,6 +83,6 @@ flutter { } dependencies { - //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 implementation 'androidx.multidex:multidex:2.0.1' } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 149424e6a..9aac9b3de 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -111,13 +111,6 @@ - - - - - - diff --git a/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt b/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt deleted file mode 100644 index d9930f557..000000000 --- a/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt +++ /dev/null @@ -1,36 +0,0 @@ -/*package chat.fluffy.fluffychat - -import com.famedly.fcm_shared_isolate.FcmSharedIsolateService - -import chat.fluffy.fluffychat.MainActivity - -import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.view.FlutterMain -import io.flutter.embedding.engine.dart.DartExecutor.DartEntrypoint - -import android.content.Context -import android.os.Bundle -import android.util.Log -import android.view.WindowManager - -class FcmPushService : FcmSharedIsolateService() { - override fun getEngine(): FlutterEngine { - return provideEngine(getApplicationContext()) - } - - companion object { - fun provideEngine(context: Context): FlutterEngine { - var engine = MainActivity.engine - if (engine == null) { - engine = MainActivity.provideEngine(context) - engine.getLocalizationPlugin().sendLocalesToFlutter( - context.getResources().getConfiguration()) - engine.getDartExecutor().executeDartEntrypoint( - DartEntrypoint.createDefault()) - } - return engine - } - } -} -*/ \ No newline at end of file diff --git a/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt b/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt index 1afc46062..894d1571c 100644 --- a/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt +++ b/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt @@ -7,13 +7,11 @@ import android.content.Context import androidx.multidex.MultiDex class MainActivity : FlutterActivity() { - override fun attachBaseContext(base: Context) { super.attachBaseContext(base) MultiDex.install(this) } - override fun provideFlutterEngine(context: Context): FlutterEngine? { return provideEngine(this) } diff --git a/android/settings.gradle b/android/settings.gradle index b2fd960a7..9f1b14bd9 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -20,7 +20,7 @@ plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.1.2" apply false id "org.jetbrains.kotlin.android" version "1.8.0" apply false - // id "com.google.gms.google-services" version "4.3.8" apply false + //id "com.google.gms.google-services" version "4.3.8" apply false } include ":app" \ No newline at end of file diff --git a/firebase.json b/firebase.json new file mode 100644 index 000000000..093a4e3c2 --- /dev/null +++ b/firebase.json @@ -0,0 +1 @@ +{"flutter":{"platforms":{"android":{"default":{"projectId":"fluffychat-ef3e8","appId":"1:865731724731:android:ec427b3b1dcd4a1e64309e","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"fluffychat-ef3e8","configurations":{"android":"1:865731724731:android:ec427b3b1dcd4a1e64309e","ios":"1:865731724731:ios:79fd983ce46cb40c64309e","macos":"1:865731724731:ios:6fb777cf513cdb6264309e","web":"1:865731724731:web:d367990bc625c24864309e","windows":"1:865731724731:web:06933086ac59630464309e"}}}}}} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index d9ac10b4c..f68930fa2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,5 @@ +//import 'package:firebase_core/firebase_core.dart'; + import 'package:flutter/material.dart'; import 'package:collection/collection.dart'; @@ -21,6 +23,8 @@ void main() async { // widget bindings are initialized already. WidgetsFlutterBinding.ensureInitialized(); + //await Firebase.initializeApp(); + Logs().nativeColors = !PlatformInfos.isIOS; final store = await SharedPreferences.getInstance(); final clients = await ClientManager.getClients(store: store); diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index a7ce8c6de..87ed54b6f 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -39,7 +39,7 @@ import '../config/setting_keys.dart'; import '../widgets/matrix.dart'; import 'platform_infos.dart'; -//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; +//import 'package:firebase_messaging/firebase_messaging.dart'; class NoTokenException implements Exception { String get cause => 'Cannot get firebase token'; @@ -64,7 +64,7 @@ class BackgroundPush { final pendingTests = >{}; - final dynamic firebase = null; //FcmSharedIsolate(); + //final firebase = FirebaseMessaging.instance; DateTime? lastReceivedPush; @@ -80,17 +80,8 @@ class BackgroundPush { onDidReceiveNotificationResponse: goToRoom, ); Logs().v('Flutter Local Notifications initialized'); - firebase?.setListeners( - onMessage: (message) => pushHelper( - PushNotification.fromJson( - Map.from(message['data'] ?? message), - ), - client: client, - l10n: l10n, - activeRoomId: matrix?.activeRoomId, - flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin, - ), - ); + //FirebaseMessaging.onMessage.listen(_onFirebaseMessage); + //FirebaseMessaging.onBackgroundMessage(pushHelperBackground); if (Platform.isAndroid) { await UnifiedPush.initialize( onNewEndpoint: _newUpEndpoint, @@ -148,7 +139,7 @@ class BackgroundPush { bool useDeviceSpecificAppId = false, }) async { if (PlatformInfos.isIOS) { - await firebase?.requestPermission(); + // await firebase.requestPermission(); } else if (PlatformInfos.isAndroid) { _flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< @@ -305,7 +296,7 @@ class BackgroundPush { Logs().v('Setup firebase'); if (_fcmToken?.isEmpty ?? true) { try { - _fcmToken = await firebase?.getToken(); + //_fcmToken = await firebase.getToken(); if (_fcmToken == null) throw ('PushToken is null'); } catch (e, s) { Logs().w('[Push] cannot get token', e, e is String ? null : s); @@ -375,7 +366,8 @@ class BackgroundPush { Logs().i('[Push] UnifiedPush using endpoint $endpoint'); final oldTokens = {}; try { - final fcmToken = await firebase?.getToken(); + String? fcmToken; + //fcmToken = await firebase.getToken(); oldTokens.add(fcmToken); } catch (_) {} await setupPusher( @@ -403,6 +395,15 @@ class BackgroundPush { } } + // ignore: unused_element + Future _onFirebaseMessage(message) => pushHelper( + PushNotification.fromJson(message.data), + client: client, + l10n: l10n, + activeRoomId: matrix?.activeRoomId, + flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin, + ); + Future _onUpMessage(Uint8List message, String i) async { upAction = true; final data = Map.from( diff --git a/lib/utils/init_with_restore.dart b/lib/utils/init_with_restore.dart index f979adbe8..16094d586 100644 --- a/lib/utils/init_with_restore.dart +++ b/lib/utils/init_with_restore.dart @@ -61,7 +61,10 @@ extension InitWithRestoreExtension on Client { ); } - Future initWithRestore({void Function()? onMigration}) async { + Future initWithRestore({ + bool isBackgroundClient = false, + void Function()? onMigration, + }) async { final storageKey = '${AppConfig.applicationName}_session_backup_$clientName'; final storage = PlatformInfos.isMobile || PlatformInfos.isLinux @@ -69,6 +72,7 @@ extension InitWithRestoreExtension on Client { : null; try { + if (isBackgroundClient) await abortSync(); await init( onMigration: onMigration, waitForFirstSync: false, diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index 05f0e90c7..b34ba6144 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -17,13 +17,26 @@ import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/voip/callkeep_manager.dart'; +Future pushHelperBackground(message) => + pushHelper(PushNotification.fromJson(message.data)); + Future pushHelper( PushNotification notification, { Client? client, L10n? l10n, String? activeRoomId, - required FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin, + FlutterLocalNotificationsPlugin? flutterLocalNotificationsPlugin, }) async { + if (flutterLocalNotificationsPlugin == null) { + flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); + await flutterLocalNotificationsPlugin.initialize( + const InitializationSettings( + android: AndroidInitializationSettings('notifications_icon'), + iOS: DarwinInitializationSettings(), + ), + ); + } + try { await _tryPushHelper( notification, @@ -41,7 +54,7 @@ Future pushHelper( l10n.newMessageInFluffyChat, l10n.openAppToReadMessages, NotificationDetails( - iOS: const DarwinNotificationDetails(), + iOS: const DarwinNotificationDetails(sound: 'notification.caf'), android: AndroidNotificationDetails( AppConfig.pushNotificationsChannelId, l10n.incomingMessages, @@ -275,7 +288,9 @@ Future _tryPushHelper( priority: Priority.max, groupKey: event.room.spaceParents.firstOrNull?.roomId ?? 'rooms', ); - const iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + const iOSPlatformChannelSpecifics = DarwinNotificationDetails( + sound: "notification.caf", + ); final platformChannelSpecifics = NotificationDetails( android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics, diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 304fc1636..63f1794ad 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 3AF44CC3D61A8332019AFCDE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5AEFA815523969D4ADFBE7E8 /* GoogleService-Info.plist */; }; 9CAF203E1D098383F2EDFFCB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3C62FEBAA272B5A33AFFC95 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -69,6 +70,7 @@ 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 35E6B919318905352ECC7D69 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 5AEFA815523969D4ADFBE7E8 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 5CDC3DD55F4AC23D2067B292 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; @@ -110,6 +112,7 @@ 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, F9F203356080D460FB6D4567 /* Pods */, + 5AEFA815523969D4ADFBE7E8 /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -255,6 +258,7 @@ files = ( 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + 3AF44CC3D61A8332019AFCDE /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macos/Runner/GoogleService-Info.plist b/macos/Runner/GoogleService-Info.plist new file mode 100644 index 000000000..9fe83e59a --- /dev/null +++ b/macos/Runner/GoogleService-Info.plist @@ -0,0 +1,30 @@ + + + + + API_KEY + AIzaSyA8ZUBcuny0HjPwF2Q2fvDyQTC5dG2VHlE + GCM_SENDER_ID + 865731724731 + PLIST_VERSION + 1 + BUNDLE_ID + im.fluffychat.fluffychat + PROJECT_ID + fluffychat-ef3e8 + STORAGE_BUCKET + fluffychat-ef3e8.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:865731724731:ios:6fb777cf513cdb6264309e + + \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index f511c8615..43acdd008 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,9 +25,10 @@ dependencies: dynamic_color: ^1.7.0 emoji_picker_flutter: ^3.1.0 emojis: ^0.9.9 - #fcm_shared_isolate: ^0.1.0 file_picker: ^8.1.2 file_selector: ^1.0.3 + #firebase_core: ^3.6.0 + #firebase_messaging: ^15.1.3 flutter: sdk: flutter flutter_app_badger: ^1.5.0 diff --git a/scripts/build-ios.sh b/scripts/build-ios.sh index 7fd791b5e..3a592af9f 100755 --- a/scripts/build-ios.sh +++ b/scripts/build-ios.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -git apply ./scripts/enable-android-google-services.patch +./scripts/enable-google-services.sh FLUFFYCHAT_ORIG_GROUP="im.fluffychat" FLUFFYCHAT_ORIG_TEAM="4NXF6Z997G" #FLUFFYCHAT_NEW_GROUP="com.example.fluffychat" diff --git a/scripts/build-macos.sh b/scripts/build-macos.sh index 11d3e4a09..c565b145f 100755 --- a/scripts/build-macos.sh +++ b/scripts/build-macos.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -git apply ./scripts/enable-android-google-services.patch +./scripts/enable-google-services.sh FLUFFYCHAT_ORIG_GROUP="im.fluffychat" FLUFFYCHAT_ORIG_TEAM="4NXF6Z997G" #FLUFFYCHAT_NEW_GROUP="com.example.fluffychat" diff --git a/scripts/enable-android-google-services.patch b/scripts/enable-android-google-services.patch deleted file mode 100644 index aca4f69b8..000000000 --- a/scripts/enable-android-google-services.patch +++ /dev/null @@ -1,136 +0,0 @@ -diff --git a/android/app/build.gradle b/android/app/build.gradle -index 7520ff2a..ae376d9d 100644 ---- a/android/app/build.gradle -+++ b/android/app/build.gradle -@@ -2,7 +2,7 @@ plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -- //id "com.google.gms.google-services" -+ id "com.google.gms.google-services" - } - - def localProperties = new Properties() -@@ -83,6 +83,6 @@ flutter { - } - - dependencies { -- //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 - implementation 'androidx.multidex:multidex:2.0.1' - } -diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro -index d0e0fbc9..0a546da0 100644 ---- a/android/app/proguard-rules.pro -+++ b/android/app/proguard-rules.pro -@@ -1 +1,42 @@ ---keep class net.sqlcipher.** { *; } -\ No newline at end of file -+-optimizationpasses 5 -+## Flutter wrapper -+-keep class net.sqlcipher.** { *; } -+-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/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() { - } - } - } --*/ -\ No newline at end of file -diff --git a/android/settings.gradle b/android/settings.gradle -index b2fd960a..fdb01a4d 100644 ---- a/android/settings.gradle -+++ b/android/settings.gradle -@@ -20,7 +20,7 @@ plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.1.2" apply false - id "org.jetbrains.kotlin.android" version "1.8.0" apply false -- // id "com.google.gms.google-services" version "4.3.8" apply false -+ id "com.google.gms.google-services" version "4.3.8" apply false - } - - include ":app" -\ No newline at end of file -diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart -index 039dde89..1cefdd71 100644 ---- a/lib/utils/background_push.dart -+++ b/lib/utils/background_push.dart -@@ -38,7 +38,7 @@ import '../config/setting_keys.dart'; - import '../widgets/matrix.dart'; - import 'platform_infos.dart'; - --//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; -+import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; - - class NoTokenException implements Exception { - String get cause => 'Cannot get firebase token'; -@@ -63,7 +63,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 69c80d6e..efd32d89 100644 ---- a/pubspec.yaml -+++ b/pubspec.yaml -@@ -25,7 +25,7 @@ dependencies: - dynamic_color: ^1.7.0 - emoji_picker_flutter: ^3.1.0 - emojis: ^0.9.9 -- #fcm_shared_isolate: ^0.1.0 -+ fcm_shared_isolate: ^0.1.0 - file_picker: ^8.1.2 - file_selector: ^1.0.3 - flutter: diff --git a/scripts/enable-google-services.sh b/scripts/enable-google-services.sh new file mode 100755 index 000000000..686c78277 --- /dev/null +++ b/scripts/enable-google-services.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +sed -i 's/#//g' pubspec.yaml +sed -i 's,//,,g' android/settings.gradle +sed -i 's,//,,g' android/app/build.gradle +sed -i 's,//,,g' lib/main.dart +sed -i 's,//,,g' lib/utils/background_push.dart \ No newline at end of file diff --git a/scripts/release-ios-testflight.sh b/scripts/release-ios-testflight.sh index e3f1a109a..586a83db3 100755 --- a/scripts/release-ios-testflight.sh +++ b/scripts/release-ios-testflight.sh @@ -1,5 +1,5 @@ #!/bin/sh -ve -git apply ./scripts/enable-android-google-services.patch +./scripts/enable-google-services.sh rm -rf fonts/NotoEmoji yq -i 'del( .flutter.fonts[] | select(.family == "NotoEmoji") )' pubspec.yaml flutter clean