forked from Nexus/nexus
send notifications natively
This commit is contained in:
parent
11d83ee067
commit
2beb6dcb9b
14 changed files with 225 additions and 30 deletions
|
|
@ -8,6 +8,7 @@ import "package:m3e_buttons/m3e_buttons.dart";
|
|||
import "package:nexus/controllers/account_data.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
import "package:nexus/controllers/client_state.dart";
|
||||
import "package:nexus/controllers/notifications.dart";
|
||||
import "package:nexus/controllers/settings.dart";
|
||||
import "package:nexus/controllers/unified_push.dart";
|
||||
import "package:nexus/controllers/spec_versions.dart";
|
||||
|
|
@ -132,17 +133,30 @@ class SettingsSectionsController
|
|||
orElse: () => false,
|
||||
)
|
||||
? pusherRegistered.maybeWhen(
|
||||
data: (_) =>
|
||||
(value) => value
|
||||
? ref
|
||||
data: (_) => (value) async {
|
||||
if (value) {
|
||||
if (await ref
|
||||
.watch(
|
||||
NotificationsController
|
||||
.provider
|
||||
.notifier,
|
||||
)
|
||||
.requestPermissions()) {
|
||||
ref
|
||||
.watch(
|
||||
UnifiedPushController
|
||||
.provider
|
||||
.notifier,
|
||||
)
|
||||
.register()
|
||||
.onError(showError)
|
||||
: /*deregeister*/ null,
|
||||
.onError(showError);
|
||||
} else {
|
||||
// TODO: Handle not granted
|
||||
}
|
||||
} else {
|
||||
// TODO: Deregister
|
||||
}
|
||||
},
|
||||
orElse: () => null,
|
||||
)
|
||||
: null,
|
||||
|
|
|
|||
Loading…
Reference in a new issue