Files
Client/lib/storage/notification_settings.dart
T

39 lines
1.4 KiB
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;
/// Same one-shot guards for the two occasions on which accounts with
/// parent letters are asked: right after signing in and, if the permission
/// is still missing, on the first visit of the parent letters.
@JsonKey(defaultValue: false)
bool guardianLoginPromptShown;
@JsonKey(defaultValue: false)
bool parentLettersPromptShown;
NotificationSettings({
this.enabled = true,
this.talkPermissionPromptShown = false,
this.guardianLoginPromptShown = false,
this.parentLettersPromptShown = false,
});
factory NotificationSettings.fromJson(Map<String, dynamic> json) =>
_$NotificationSettingsFromJson(json);
Map<String, dynamic> toJson() => _$NotificationSettingsToJson(this);
}