From 96ecc878b4cb807d9a11d71182e9c5792ce0c04e Mon Sep 17 00:00:00 2001 From: baltevl Date: Tue, 1 Oct 2024 23:15:23 +0200 Subject: [PATCH] build: Add unifiedpush_ui package Add unifiedpush_ui as part of unifiedpush was split off into it. --- lib/utils/background_push.dart | 29 ++++++++++++++++++++++++++--- pubspec.lock | 8 ++++++++ pubspec.yaml | 1 + 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index 748461f2a..142ec7cf9 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -30,6 +30,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:http/http.dart' as http; import 'package:matrix/matrix.dart'; import 'package:unifiedpush/unifiedpush.dart'; +import 'package:unifiedpush_ui/unifiedpush_ui.dart'; import 'package:fluffychat/utils/push_helper.dart'; import 'package:fluffychat/widgets/fluffy_chat_app.dart'; @@ -323,9 +324,8 @@ class BackgroundPush { } Future setupUp() async { - // Blocked by https://codeberg.org/UnifiedPush/flutter-connector/issues/2 - // ignore: deprecated_member_use - await UnifiedPush.registerAppWithDialog(matrix!.context); + await UnifiedPushUi(matrix!.context, ["default"], UPFunctions()) + .registerAppWithDialog(); } Future _newUpEndpoint(String newEndpoint, String i) async { @@ -403,3 +403,26 @@ class BackgroundPush { ); } } + +class UPFunctions extends UnifiedPushFunctions { + final List features = [/*list of features*/]; + @override + Future getDistributor() async { + return await UnifiedPush.getDistributor(); + } + + @override + Future> getDistributors() async { + return await UnifiedPush.getDistributors(features); + } + + @override + Future registerApp(String instance) async { + await UnifiedPush.registerApp(instance, features); + } + + @override + Future saveDistributor(String distributor) async { + await UnifiedPush.saveDistributor(distributor); + } +} diff --git a/pubspec.lock b/pubspec.lock index 194ec0bd8..ef90a19f0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -2096,6 +2096,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + unifiedpush_ui: + dependency: "direct main" + description: + name: unifiedpush_ui + sha256: cf86f0214f37debd41f25c0425c8489df85e27f9f8784fed571eb7a86d39ba11 + url: "https://pub.dev" + source: hosted + version: "0.1.0" universal_html: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 8cd648565..21a7b1e33 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -90,6 +90,7 @@ dependencies: tor_detector_web: ^1.1.0 uni_links: ^0.5.1 unifiedpush: ^5.0.1 + unifiedpush_ui: ^0.1.0 universal_html: ^2.2.4 url_launcher: ^6.2.5 video_compress: ^3.1.3