fix(app): say it out loud when wake-ups do not work

Registration failures from the distributor were swallowed, so push looked
enabled while nothing arrived. Without wake-ups Android suspends the app
and messages only show up once the user opens it — which looks like broken
delivery even though the relay has them queued.

The failure is now remembered and surfaced in Settings, and the chat list
carries a dismissible line explaining the state.
This commit is contained in:
Julius Joska
2026-08-13 12:23:30 +02:00
parent 9985b79aa6
commit 923a6a01bd
18 changed files with 305 additions and 10 deletions
@@ -20,6 +20,7 @@ class _PushSettingsTileState extends ConsumerState<PushSettingsTile> {
String _mode = 'off';
String? _distributor;
bool _busy = false;
bool _registrationFailed = false;
@override
void initState() {
@@ -31,10 +32,12 @@ class _PushSettingsTileState extends ConsumerState<PushSettingsTile> {
final push = ref.read(pushServiceProvider);
final mode = await push.currentMode();
final d = await push.currentDistributor();
final failed = await push.registrationFailed();
if (mounted) {
setState(() {
_mode = mode;
_distributor = d;
_registrationFailed = failed;
});
}
}
@@ -160,12 +163,17 @@ class _PushSettingsTileState extends ConsumerState<PushSettingsTile> {
@override
Widget build(BuildContext context) {
final subtitle = switch (_mode) {
'up' => context.l10n.pushSubtitleUnifiedPush(
_distributor ?? context.l10n.pushNoDistributorFallback),
'fcm' => context.l10n.pushSubtitleFcm,
_ => context.l10n.commonOff,
};
// Selhaná registrace přebíjí popis režimu — „zapnuto" bez budíčků je
// horší než vypnuto, protože uživatel čeká zprávy, které nepřijdou.
final failed = _registrationFailed && _mode != 'off';
final subtitle = failed
? context.l10n.pushRegistrationFailed
: switch (_mode) {
'up' => context.l10n.pushSubtitleUnifiedPush(
_distributor ?? context.l10n.pushNoDistributorFallback),
'fcm' => context.l10n.pushSubtitleFcm,
_ => context.l10n.commonOff,
};
return ListTile(
leading: Container(
width: 40,
@@ -184,7 +192,10 @@ class _PushSettingsTileState extends ConsumerState<PushSettingsTile> {
style: const TextStyle(fontSize: 15)),
subtitle: Text(
subtitle,
style: const TextStyle(fontSize: 13, color: SepotColors.textMuted),
style: TextStyle(
fontSize: 13,
color: failed ? SepotColors.ember : SepotColors.textMuted,
),
),
trailing: _busy
? const SizedBox(