mirror of
https://github.com/krille-chan/fluffychat
synced 2024-10-10 01:03:40 +00:00
feat: Switch to firebase messaging package
This commit is contained in:
parent
0d4b7d67cc
commit
c50d65fb74
21 changed files with 97 additions and 212 deletions
2
.github/workflows/integrate.yaml
vendored
2
.github/workflows/integrate.yaml
vendored
|
@ -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
|
||||
|
||||
|
|
2
.github/workflows/main_deploy.yaml
vendored
2
.github/workflows/main_deploy.yaml
vendored
|
@ -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
|
||||
|
|
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
||||
//<GOOGLE_SERVICES>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'
|
||||
}
|
||||
|
|
|
@ -111,13 +111,6 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name=".FcmPushService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service android:name="com.pravera.flutter_foreground_task.service.ForegroundService"
|
||||
android:foregroundServiceType="camera|microphone|mediaProjection">
|
||||
</service>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
//<GOOGLE_SERVICES>id "com.google.gms.google-services" version "4.3.8" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
1
firebase.json
Normal file
1
firebase.json
Normal file
|
@ -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"}}}}}}
|
|
@ -1,3 +1,5 @@
|
|||
//<GOOGLE_SERVICES>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();
|
||||
|
||||
//<GOOGLE_SERVICES>await Firebase.initializeApp();
|
||||
|
||||
Logs().nativeColors = !PlatformInfos.isIOS;
|
||||
final store = await SharedPreferences.getInstance();
|
||||
final clients = await ClientManager.getClients(store: store);
|
||||
|
|
|
@ -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';
|
||||
//<GOOGLE_SERVICES>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 = <String, Completer<void>>{};
|
||||
|
||||
final dynamic firebase = null; //FcmSharedIsolate();
|
||||
//<GOOGLE_SERVICES>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<String, dynamic>.from(message['data'] ?? message),
|
||||
),
|
||||
client: client,
|
||||
l10n: l10n,
|
||||
activeRoomId: matrix?.activeRoomId,
|
||||
flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin,
|
||||
),
|
||||
);
|
||||
//<GOOGLE_SERVICES>FirebaseMessaging.onMessage.listen(_onFirebaseMessage);
|
||||
//<GOOGLE_SERVICES>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();
|
||||
//<GOOGLE_SERVICES> 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();
|
||||
//<GOOGLE_SERVICES>_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 = <String?>{};
|
||||
try {
|
||||
final fcmToken = await firebase?.getToken();
|
||||
String? fcmToken;
|
||||
//<GOOGLE_SERVICES>fcmToken = await firebase.getToken();
|
||||
oldTokens.add(fcmToken);
|
||||
} catch (_) {}
|
||||
await setupPusher(
|
||||
|
@ -403,6 +395,15 @@ class BackgroundPush {
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: unused_element
|
||||
Future<void> _onFirebaseMessage(message) => pushHelper(
|
||||
PushNotification.fromJson(message.data),
|
||||
client: client,
|
||||
l10n: l10n,
|
||||
activeRoomId: matrix?.activeRoomId,
|
||||
flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin,
|
||||
);
|
||||
|
||||
Future<void> _onUpMessage(Uint8List message, String i) async {
|
||||
upAction = true;
|
||||
final data = Map<String, dynamic>.from(
|
||||
|
|
|
@ -61,7 +61,10 @@ extension InitWithRestoreExtension on Client {
|
|||
);
|
||||
}
|
||||
|
||||
Future<void> initWithRestore({void Function()? onMigration}) async {
|
||||
Future<void> 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,
|
||||
|
|
|
@ -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<void> pushHelperBackground(message) =>
|
||||
pushHelper(PushNotification.fromJson(message.data));
|
||||
|
||||
Future<void> 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<void> 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<void> _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,
|
||||
|
|
|
@ -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 = "<group>"; };
|
||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
5AEFA815523969D4ADFBE7E8 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
|
@ -110,6 +112,7 @@
|
|||
33CC10EE2044A3C60003C045 /* Products */,
|
||||
D73912EC22F37F3D000D13A0 /* Frameworks */,
|
||||
F9F203356080D460FB6D4567 /* Pods */,
|
||||
5AEFA815523969D4ADFBE7E8 /* GoogleService-Info.plist */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
@ -255,6 +258,7 @@
|
|||
files = (
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
|
||||
3AF44CC3D61A8332019AFCDE /* GoogleService-Info.plist in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
30
macos/Runner/GoogleService-Info.plist
Normal file
30
macos/Runner/GoogleService-Info.plist
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>API_KEY</key>
|
||||
<string>AIzaSyA8ZUBcuny0HjPwF2Q2fvDyQTC5dG2VHlE</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
<string>865731724731</string>
|
||||
<key>PLIST_VERSION</key>
|
||||
<string>1</string>
|
||||
<key>BUNDLE_ID</key>
|
||||
<string>im.fluffychat.fluffychat</string>
|
||||
<key>PROJECT_ID</key>
|
||||
<string>fluffychat-ef3e8</string>
|
||||
<key>STORAGE_BUCKET</key>
|
||||
<string>fluffychat-ef3e8.appspot.com</string>
|
||||
<key>IS_ADS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_APPINVITE_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_GCM_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true></true>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:865731724731:ios:6fb777cf513cdb6264309e</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -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
|
||||
#<GOOGLE_SERVICES>firebase_core: ^3.6.0
|
||||
#<GOOGLE_SERVICES>firebase_messaging: ^15.1.3
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_app_badger: ^1.5.0
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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.** { <fields>; }
|
||||
+
|
||||
+# 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 <fields>;
|
||||
+}
|
||||
+
|
||||
+# 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 = <String, Completer<void>>{};
|
||||
|
||||
- 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:
|
6
scripts/enable-google-services.sh
Executable file
6
scripts/enable-google-services.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
sed -i 's/#<GOOGLE_SERVICES>//g' pubspec.yaml
|
||||
sed -i 's,//<GOOGLE_SERVICES>,,g' android/settings.gradle
|
||||
sed -i 's,//<GOOGLE_SERVICES>,,g' android/app/build.gradle
|
||||
sed -i 's,//<GOOGLE_SERVICES>,,g' lib/main.dart
|
||||
sed -i 's,//<GOOGLE_SERVICES>,,g' lib/utils/background_push.dart
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue