fix: Remove google from fcm_shared_isolate

This commit is contained in:
Krille Fear 2021-09-24 16:16:04 +02:00
parent fb4337272e
commit 1bade5cf5f
5 changed files with 64 additions and 39 deletions

View File

@ -1,4 +1,4 @@
package chat.fluffy.fluffychat
/*package chat.fluffy.fluffychat
import com.famedly.fcm_shared_isolate.FcmSharedIsolateService
@ -33,3 +33,4 @@ class FcmPushService : FcmSharedIsolateService() {
}
}
}
*/

View File

@ -24,7 +24,7 @@ import 'dart:ui';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:matrix/matrix.dart';
import 'package:fcm_shared_isolate/fcm_shared_isolate.dart';
//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
@ -72,7 +72,7 @@ class BackgroundPush {
onRoomSync ??= client.onSync.stream
.where((s) => s.hasRoomUpdate)
.listen((s) => _onClearingPush(getFromServer: false));
_fcmSharedIsolate.setListeners(
_fcmSharedIsolate?.setListeners(
onMessage: _onFcmMessage,
onNewToken: _newFcmToken,
);
@ -116,7 +116,7 @@ class BackgroundPush {
setupPush();
}
final _fcmSharedIsolate = FcmSharedIsolate();
final _fcmSharedIsolate = null; //FcmSharedIsolate();
StreamSubscription<LoginState> onLogin;
StreamSubscription<SyncUpdate> onRoomSync;
@ -128,7 +128,7 @@ class BackgroundPush {
bool useDeviceSpecificAppId = false,
}) async {
if (PlatformInfos.isIOS) {
await _fcmSharedIsolate.requestPermission();
await _fcmSharedIsolate?.requestPermission();
}
final clientName = PlatformInfos.clientName;
oldTokens ??= <String>{};
@ -268,7 +268,8 @@ class BackgroundPush {
Logs().v('Setup firebase');
if (_fcmToken?.isEmpty ?? true) {
try {
_fcmToken = await _fcmSharedIsolate.getToken();
_fcmToken = await _fcmSharedIsolate?.getToken();
if (_fcmToken == null) throw Exception('PushToken is null');
} catch (e, s) {
Logs().e('[Push] cannot get token', e, s);
await _noFcmWarning();
@ -362,7 +363,7 @@ class BackgroundPush {
Logs().i('[Push] UnifiedPush using endpoint ' + endpoint);
final oldTokens = <String>{};
try {
final fcmToken = await _fcmSharedIsolate.getToken();
final fcmToken = await _fcmSharedIsolate?.getToken();
oldTokens.add(fcmToken);
} catch (_) {}
await setupPusher(

View File

@ -239,15 +239,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
fcm_shared_isolate:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: eba99721714703f0305d094f4d7296bf2c2230db
url: "https://gitlab.com/famedly/libraries/fcm_shared_isolate.git"
source: git
version: "0.0.1"
ffi:
dependency: transitive
description:
@ -325,27 +316,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-nullsafety.0"
firebase_core:
dependency: transitive
description:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
flutter:
dependency: "direct main"
description: flutter

View File

@ -16,8 +16,8 @@ dependencies:
desktop_notifications: ">=0.4.0 <0.5.0" # Version 0.5.0 breaks web builds: https://github.com/canonical/dbus.dart/issues/250
email_validator: ^2.0.1
emoji_picker_flutter: ^1.0.7
fcm_shared_isolate:
git: https://gitlab.com/famedly/libraries/fcm_shared_isolate.git
#fcm_shared_isolate:
# git: https://gitlab.com/famedly/libraries/fcm_shared_isolate.git
file_picker_cross: ^4.4.2
filesystem_picker: 2.0.0-nullsafety.0 # Using pre release to be compatible with Flutter 2.5
flutter:

View File

@ -17,6 +17,22 @@ index 01687f53..780e0011 100644
-//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() {
}
}
}
-*/
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index 4ce5c41d..be58d662 100644
--- a/android/build.gradle
@ -30,3 +46,40 @@ index 4ce5c41d..be58d662 100644
}
}
diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart
index 0b771ef8..56af0cee 100644
--- a/lib/utils/background_push.dart
+++ b/lib/utils/background_push.dart
@@ -24,7 +24,7 @@ import 'dart:ui';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:matrix/matrix.dart';
-//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart';
+import 'package:fcm_shared_isolate/fcm_shared_isolate.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
@@ -116,7 +116,7 @@ class BackgroundPush {
setupPush();
}
- final _fcmSharedIsolate = null; //FcmSharedIsolate();
+ final _fcmSharedIsolate = FcmSharedIsolate();
StreamSubscription<LoginState> onLogin;
StreamSubscription<SyncUpdate> onRoomSync;
diff --git a/pubspec.yaml b/pubspec.yaml
index 97fdbac7..7956eb5d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -16,8 +16,8 @@ dependencies:
desktop_notifications: ">=0.4.0 <0.5.0" # Version 0.5.0 breaks web builds: https://github.com/canonical/dbus.dart/issues/250
email_validator: ^2.0.1
emoji_picker_flutter: ^1.0.7
- #fcm_shared_isolate:
- # git: https://gitlab.com/famedly/libraries/fcm_shared_isolate.git
+ fcm_shared_isolate:
+ git: https://gitlab.com/famedly/libraries/fcm_shared_isolate.git
file_picker_cross: ^4.4.2
filesystem_picker: 2.0.0-nullsafety.0 # Using pre release to be compatible with Flutter 2.5
flutter: