@umituz/react-native-settings 4.12.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings Repository Interface and Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the contract for settings storage operations
|
|
5
|
+
* and the core types used throughout the settings domain.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* User settings data structure
|
|
10
|
+
*/
|
|
11
|
+
export interface UserSettings {
|
|
12
|
+
userId: string;
|
|
13
|
+
theme: 'light' | 'dark' | 'auto';
|
|
14
|
+
language: string;
|
|
15
|
+
notificationsEnabled: boolean;
|
|
16
|
+
emailNotifications: boolean;
|
|
17
|
+
pushNotifications: boolean;
|
|
18
|
+
soundEnabled: boolean;
|
|
19
|
+
vibrationEnabled: boolean;
|
|
20
|
+
privacyMode: boolean;
|
|
21
|
+
updatedAt: Date;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Settings operation result
|
|
26
|
+
*/
|
|
27
|
+
export interface SettingsResult<T> {
|
|
28
|
+
success: boolean;
|
|
29
|
+
data?: T;
|
|
30
|
+
error?: SettingsError;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Settings error types
|
|
35
|
+
*/
|
|
36
|
+
export interface SettingsError {
|
|
37
|
+
code: string;
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Settings repository interface
|
|
43
|
+
*/
|
|
44
|
+
export interface ISettingsRepository {
|
|
45
|
+
getSettings(userId: string): Promise<SettingsResult<UserSettings>>;
|
|
46
|
+
saveSettings(settings: UserSettings): Promise<SettingsResult<void>>;
|
|
47
|
+
deleteSettings(userId: string): Promise<SettingsResult<void>>;
|
|
48
|
+
}
|
|
@@ -73,8 +73,13 @@ export const DevSettingsSection: React.FC<DevSettingsProps> = ({
|
|
|
73
73
|
style: "destructive",
|
|
74
74
|
onPress: async () => {
|
|
75
75
|
try {
|
|
76
|
-
// Clear all storage
|
|
77
|
-
await storageRepository.clearAll();
|
|
76
|
+
// Clear all storage and check result
|
|
77
|
+
const result = await storageRepository.clearAll();
|
|
78
|
+
|
|
79
|
+
if (!result.success) {
|
|
80
|
+
Alert.alert(t.errorTitle, t.errorMessage);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
78
83
|
|
|
79
84
|
// If callback provided, call it (e.g., reload app)
|
|
80
85
|
if (onAfterClear) {
|