implemented a guided notification permission flow triggered on the first Talk visit

This commit is contained in:
2026-07-06 20:01:45 +02:00
parent 3be0113f93
commit 38a271929c
11 changed files with 211 additions and 30 deletions
+12 -3
View File
@@ -5,12 +5,21 @@ part 'notification_settings.g.dart';
@JsonSerializable()
class NotificationSettings {
/// Whether push notifications are enabled. Defaults to `true` — the OS
/// permission prompt at login is now the gate, so there is no separate
/// in-app opt-in step anymore.
/// permission prompt on the first Talk visit is now the gate, so there is no
/// separate in-app opt-in step anymore.
@JsonKey(defaultValue: true)
bool enabled;
NotificationSettings({this.enabled = true});
/// Whether the one-time notification-permission prompt shown on the first
/// Talk visit has already run. Prevents nagging the user on every visit and
/// keeps the OS prompt out of the cold-start path.
@JsonKey(defaultValue: false)
bool talkPermissionPromptShown;
NotificationSettings({
this.enabled = true,
this.talkPermissionPromptShown = false,
});
factory NotificationSettings.fromJson(Map<String, dynamic> json) =>
_$NotificationSettingsFromJson(json);
+9 -2
View File
@@ -8,8 +8,15 @@ part of 'notification_settings.dart';
NotificationSettings _$NotificationSettingsFromJson(
Map<String, dynamic> json,
) => NotificationSettings(enabled: json['enabled'] as bool? ?? true);
) => NotificationSettings(
enabled: json['enabled'] as bool? ?? true,
talkPermissionPromptShown:
json['talkPermissionPromptShown'] as bool? ?? false,
);
Map<String, dynamic> _$NotificationSettingsToJson(
NotificationSettings instance,
) => <String, dynamic>{'enabled': instance.enabled};
) => <String, dynamic>{
'enabled': instance.enabled,
'talkPermissionPromptShown': instance.talkPermissionPromptShown,
};