feat(settings): 添加通知偏好设置和后端 API 集成

This commit is contained in:
qzl
2026-04-07 18:43:42 +08:00
parent b18a205bf3
commit b22673ce49
9 changed files with 612 additions and 29 deletions
@@ -37,6 +37,26 @@ class PreferenceSettings {
}
}
class NotificationSettings {
const NotificationSettings({
this.allowNotifications = true,
this.allowVibration = true,
});
final bool allowNotifications;
final bool allowVibration;
NotificationSettings copyWith({
bool? allowNotifications,
bool? allowVibration,
}) {
return NotificationSettings(
allowNotifications: allowNotifications ?? this.allowNotifications,
allowVibration: allowVibration ?? this.allowVibration,
);
}
}
class ProfileSettingsV1 {
const ProfileSettingsV1({
this.version = 1,
@@ -46,7 +66,7 @@ class ProfileSettingsV1 {
this.avatarUrl,
this.preferences = const PreferenceSettings(),
this.privacy = const <String, Object?>{},
this.notification = const <String, Object?>{},
this.notification = const NotificationSettings(),
});
final int version;
@@ -56,7 +76,7 @@ class ProfileSettingsV1 {
final String? avatarUrl;
final PreferenceSettings preferences;
final Map<String, Object?> privacy;
final Map<String, Object?> notification;
final NotificationSettings notification;
ProfileSettingsV1 copyWith({
int? version,
@@ -66,7 +86,7 @@ class ProfileSettingsV1 {
String? avatarUrl,
PreferenceSettings? preferences,
Map<String, Object?>? privacy,
Map<String, Object?>? notification,
NotificationSettings? notification,
}) {
return ProfileSettingsV1(
version: version ?? this.version,