fix: dont make notepush requests unless notifications is authorized

This commit is contained in:
2025-05-28 12:49:51 +01:00
parent 8bd9ff2a4c
commit 74c3ad9b9c
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,4 @@
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:zap_stream_flutter/notifications.dart';
import 'package:zap_stream_flutter/theme.dart';
@ -17,8 +18,13 @@ class _NotificationsButtonWidget extends State<NotificationsButtonWidget> {
Widget build(BuildContext context) {
return FutureBuilder(
future: () async {
final n = getNotificationService();
return await n?.getWatchedKeys();
if (notifications?.authorizationStatus ==
AuthorizationStatus.authorized) {
final n = getNotificationService();
return await n?.getWatchedKeys();
} else {
return null;
}
}(),
builder: (context, state) {
if (state.data == null) {