build: Use gradle in kotlin

This commit is contained in:
Christian Kußowski 2025-07-12 07:59:18 +02:00
commit 4afd9684c9
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
22 changed files with 196 additions and 2262 deletions

View file

@ -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:fcm_shared_isolate/fcm_shared_isolate.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 = FcmSharedIsolate();
DateTime? lastReceivedPush;
@ -80,17 +80,17 @@ 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>firebase.setListeners(
//<GOOGLE_SERVICES> onMessage: (message) => pushHelper(
//<GOOGLE_SERVICES> PushNotification.fromJson(
//<GOOGLE_SERVICES> Map<String, dynamic>.from(message['data'] ?? message),
//<GOOGLE_SERVICES> ),
//<GOOGLE_SERVICES> client: client,
//<GOOGLE_SERVICES> l10n: l10n,
//<GOOGLE_SERVICES> activeRoomId: matrix?.activeRoomId,
//<GOOGLE_SERVICES> flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin,
//<GOOGLE_SERVICES> ),
//<GOOGLE_SERVICES>);
if (Platform.isAndroid) {
await UnifiedPush.initialize(
onNewEndpoint: _newUpEndpoint,
@ -148,7 +148,7 @@ class BackgroundPush {
bool useDeviceSpecificAppId = false,
}) async {
if (PlatformInfos.isIOS) {
await firebase?.requestPermission();
//<GOOGLE_SERVICES>await firebase.requestPermission();
}
if (PlatformInfos.isAndroid) {
_flutterLocalNotificationsPlugin
@ -308,7 +308,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);
@ -384,8 +384,8 @@ class BackgroundPush {
Logs().i('[Push] UnifiedPush using endpoint $endpoint');
final oldTokens = <String?>{};
try {
final fcmToken = await firebase?.getToken();
oldTokens.add(fcmToken);
//<GOOGLE_SERVICES>final fcmToken = await firebase.getToken();
//<GOOGLE_SERVICES>oldTokens.add(fcmToken);
} catch (_) {}
await setupPusher(
gatewayUrl: endpoint,