Files
Client/lib/storage/notification_settings.dart
T

28 lines
955 B
Dart

import 'package:json_annotation/json_annotation.dart';
part 'notification_settings.g.dart';
@JsonSerializable()
class NotificationSettings {
/// Whether push notifications are enabled. Defaults to `true` — the OS
/// 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;
/// 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);
Map<String, dynamic> toJson() => _$NotificationSettingsToJson(this);
}