mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Create a service
This commit is contained in:
@ -26,4 +26,14 @@ class IndependentPushNotificationsHelper {
|
||||
|
||||
await platform.invokeMethod("preConfigure");
|
||||
}
|
||||
|
||||
/// Configure independent push notification services with a pull URL
|
||||
static Future<void> configure(String wsURL) async {
|
||||
await platform.invokeMethod("configure", wsURL);
|
||||
}
|
||||
|
||||
/// Disable independent push notifications service
|
||||
static Future<void> disable() async {
|
||||
await platform.invokeMethod("disable");
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:comunic/helpers/independent_push_notifications_helper.dart';
|
||||
import 'package:comunic/helpers/preferences_helper.dart';
|
||||
import 'package:comunic/helpers/server_config_helper.dart';
|
||||
import 'package:comunic/models/api_request.dart';
|
||||
@ -39,7 +40,9 @@ class PushNotificationsHelper {
|
||||
if (status == null) status = PushNotificationsStatus.UNDEFINED;
|
||||
|
||||
if (status == PushNotificationsStatus.INDEPENDENT) {
|
||||
// TODO : Invoke plugin to apply new WebSocket URL
|
||||
// Invoke plugin to apply new WebSocket URL
|
||||
await IndependentPushNotificationsHelper.configure(
|
||||
response["independent_push_url"]);
|
||||
}
|
||||
|
||||
await (await PreferencesHelper.getInstance()).setString(
|
||||
@ -51,7 +54,8 @@ class PushNotificationsHelper {
|
||||
await (await PreferencesHelper.getInstance())
|
||||
.removeKey(PreferencesKeyList.PUSH_NOTIFICATIONS_STATUS);
|
||||
|
||||
// TODO : stop local refresh notification refresh
|
||||
// Stop local refresh notification refresh
|
||||
IndependentPushNotificationsHelper.disable();
|
||||
}
|
||||
|
||||
/// Set new push notification status on the server
|
||||
|
Reference in New Issue
Block a user