implemented a guided notification permission flow triggered on the first Talk visit
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user