Skip to content

Commit

Permalink
Merge pull request #1376 from baltevl/main
Browse files Browse the repository at this point in the history
build: Add unifiedpush_ui package
  • Loading branch information
krille-chan authored Oct 3, 2024
2 parents 542b4bf + 96ecc87 commit 8b90c30
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
29 changes: 26 additions & 3 deletions lib/utils/background_push.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -323,9 +324,8 @@ class BackgroundPush {
}

Future<void> 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<void> _newUpEndpoint(String newEndpoint, String i) async {
Expand Down Expand Up @@ -403,3 +403,26 @@ class BackgroundPush {
);
}
}

class UPFunctions extends UnifiedPushFunctions {
final List<String> features = [/*list of features*/];
@override
Future<String?> getDistributor() async {
return await UnifiedPush.getDistributor();
}

@override
Future<List<String>> getDistributors() async {
return await UnifiedPush.getDistributors(features);
}

@override
Future<void> registerApp(String instance) async {
await UnifiedPush.registerApp(instance, features);
}

@override
Future<void> saveDistributor(String distributor) async {
await UnifiedPush.saveDistributor(distributor);
}
}
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8b90c30

Please sign in to comment.