feat(push_notifications): issue-660, fix: issue-908

This commit is contained in:
misha
2026-10-14 08:16:20 +03:00
parent 98c175df44
commit dcd343e765
29 changed files with 2281 additions and 608 deletions

View File

@@ -27,7 +27,37 @@ class NotificationsSettingsContent extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(s.notifications)),
body: BlocBuilder<NotificationSettingsCubit, NotificationSettingsState>(
body: BlocConsumer<NotificationSettingsCubit, NotificationSettingsState>(
listenWhen: (previous, current) {
if (current is! NotificationSettingsStateLoaded || current.alertId == null) {
return false;
}
final previousId = previous is NotificationSettingsStateLoaded ? previous.alertId : null;
return current.alertId != previousId;
},
listener: (context, state) {
if (state is! NotificationSettingsStateLoaded) {
return;
}
final message = state.alertMessage;
if (message == null || message.isEmpty) {
return;
}
showCupertinoDialog<void>(
context: context,
builder: (dialogContext) {
return CupertinoAlertDialog(
content: Text(message),
actions: [
CupertinoDialogAction(
onPressed: () => Navigator.of(dialogContext).pop(),
child: const Text('OK'),
),
],
);
},
);
},
builder: (context, state) {
if (state is NotificationSettingsStateLoading) {
return const Center(child: CircularProgressIndicator());