@umituz/react-native-settings 4.6.0 → 4.7.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 +1 -3
- package/src/presentation/screens/components/SettingsContent.tsx +0 -7
- package/src/presentation/screens/hooks/useFeatureDetection.ts +2 -17
- package/src/presentation/screens/types/FeatureConfig.ts +0 -17
- package/src/presentation/screens/types/SettingsConfig.ts +3 -45
- package/src/presentation/screens/types/index.ts +0 -6
- package/src/presentation/screens/utils/normalizeConfig.ts +0 -24
- package/src/presentation/screens/types/ExtendedConfig.ts +0 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "Settings management for React Native apps - user preferences, theme, language, notifications",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"@umituz/react-native-design-system-theme": "*",
|
|
40
40
|
"@umituz/react-native-design-system-typography": "*",
|
|
41
41
|
"@umituz/react-native-legal": "*",
|
|
42
|
-
"@umituz/react-native-disclaimer": "*",
|
|
43
42
|
"@umituz/react-native-localization": "*",
|
|
44
43
|
"@umituz/react-native-storage": "*",
|
|
45
44
|
"react": ">=18.2.0",
|
|
@@ -70,7 +69,6 @@
|
|
|
70
69
|
"@umituz/react-native-design-system-theme": "latest",
|
|
71
70
|
"@umituz/react-native-design-system-typography": "latest",
|
|
72
71
|
"@umituz/react-native-legal": "^2.0.3",
|
|
73
|
-
"@umituz/react-native-disclaimer": "latest",
|
|
74
72
|
"@umituz/react-native-localization": "latest",
|
|
75
73
|
"@umituz/react-native-notifications": "latest",
|
|
76
74
|
"@umituz/react-native-storage": "latest",
|
|
@@ -16,7 +16,6 @@ import { AboutSection } from "@umituz/react-native-about";
|
|
|
16
16
|
import { LegalSection } from "@umituz/react-native-legal";
|
|
17
17
|
import { AppearanceSection } from "@umituz/react-native-appearance";
|
|
18
18
|
import { LanguageSection } from "@umituz/react-native-localization";
|
|
19
|
-
import { DisclaimerSetting } from "@umituz/react-native-disclaimer";
|
|
20
19
|
import type { NormalizedConfig } from "../utils/normalizeConfig";
|
|
21
20
|
import type { CustomSettingsSection } from "../types";
|
|
22
21
|
|
|
@@ -29,7 +28,6 @@ interface SettingsContentProps {
|
|
|
29
28
|
notifications: boolean;
|
|
30
29
|
about: boolean;
|
|
31
30
|
legal: boolean;
|
|
32
|
-
disclaimer: boolean;
|
|
33
31
|
};
|
|
34
32
|
showUserProfile?: boolean;
|
|
35
33
|
userProfile?: {
|
|
@@ -71,7 +69,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
71
69
|
features.notifications ||
|
|
72
70
|
features.about ||
|
|
73
71
|
features.legal ||
|
|
74
|
-
features.disclaimer ||
|
|
75
72
|
customSections.length > 0,
|
|
76
73
|
[features, customSections.length]
|
|
77
74
|
);
|
|
@@ -129,10 +126,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
129
126
|
<LegalSection config={normalizedConfig.legal.config} />
|
|
130
127
|
)}
|
|
131
128
|
|
|
132
|
-
{features.disclaimer && (
|
|
133
|
-
<DisclaimerSetting />
|
|
134
|
-
)}
|
|
135
|
-
|
|
136
129
|
{customSections && customSections.length > 0 && (
|
|
137
130
|
<>
|
|
138
131
|
{sortedSections.map((section, index) => (
|
|
@@ -61,9 +61,9 @@ export function useFeatureDetection(
|
|
|
61
61
|
},
|
|
62
62
|
) {
|
|
63
63
|
return useMemo(() => {
|
|
64
|
-
const { appearance, language, notifications, about, legal
|
|
64
|
+
const { appearance, language, notifications, about, legal } =
|
|
65
65
|
normalizedConfig;
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
const notificationServiceAvailable = options?.notificationServiceAvailable ?? notificationService !== null;
|
|
68
68
|
|
|
69
69
|
return {
|
|
@@ -102,21 +102,6 @@ export function useFeatureDetection(
|
|
|
102
102
|
(legal.config?.enabled === true ||
|
|
103
103
|
(legal.config?.enabled !== false &&
|
|
104
104
|
hasNavigationScreen(navigation, legal.config?.route || "Legal"))),
|
|
105
|
-
disclaimer:
|
|
106
|
-
disclaimer.enabled &&
|
|
107
|
-
(disclaimer.config?.enabled === true ||
|
|
108
|
-
(disclaimer.config?.enabled !== false &&
|
|
109
|
-
hasNavigationScreen(navigation, disclaimer.config?.route || "Disclaimer"))),
|
|
110
|
-
account:
|
|
111
|
-
account.enabled &&
|
|
112
|
-
(account.config?.enabled === true ||
|
|
113
|
-
(account.config?.enabled !== false &&
|
|
114
|
-
hasNavigationScreen(
|
|
115
|
-
navigation,
|
|
116
|
-
account.config?.route || "AccountSettings",
|
|
117
|
-
))),
|
|
118
|
-
support: support.enabled,
|
|
119
|
-
developer: developer.enabled && __DEV__,
|
|
120
105
|
};
|
|
121
106
|
}, [normalizedConfig, navigation, options]);
|
|
122
107
|
}
|
|
@@ -101,20 +101,3 @@ export interface LegalConfig {
|
|
|
101
101
|
defaultRoute?: string;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* Disclaimer Settings Configuration
|
|
106
|
-
*/
|
|
107
|
-
export interface DisclaimerConfig {
|
|
108
|
-
/** Show disclaimer section */
|
|
109
|
-
enabled?: FeatureVisibility;
|
|
110
|
-
/** Custom navigation route for disclaimer screen */
|
|
111
|
-
route?: string;
|
|
112
|
-
/** Custom disclaimer title */
|
|
113
|
-
title?: string;
|
|
114
|
-
/** Custom disclaimer description */
|
|
115
|
-
description?: string;
|
|
116
|
-
/** Custom short message for card display */
|
|
117
|
-
shortMessage?: string;
|
|
118
|
-
/** Default route name when no custom route provided */
|
|
119
|
-
defaultRoute?: string;
|
|
120
|
-
}
|
|
@@ -10,22 +10,16 @@ import type {
|
|
|
10
10
|
NotificationsConfig,
|
|
11
11
|
AboutConfig,
|
|
12
12
|
LegalConfig,
|
|
13
|
-
DisclaimerConfig,
|
|
14
13
|
} from "./FeatureConfig";
|
|
15
|
-
import type {
|
|
16
|
-
AccountConfig,
|
|
17
|
-
SupportConfig,
|
|
18
|
-
DeveloperConfig,
|
|
19
|
-
} from "./ExtendedConfig";
|
|
20
14
|
|
|
21
15
|
/**
|
|
22
16
|
* Main Settings Configuration
|
|
23
|
-
*
|
|
17
|
+
*
|
|
24
18
|
* Controls which settings features are visible in the SettingsScreen.
|
|
25
19
|
* Each feature can be configured with:
|
|
26
20
|
* - Simple: boolean | 'auto' (quick setup)
|
|
27
21
|
* - Advanced: Detailed config object (full control)
|
|
28
|
-
*
|
|
22
|
+
*
|
|
29
23
|
* @example
|
|
30
24
|
* // Simple configuration
|
|
31
25
|
* const config: SettingsConfig = {
|
|
@@ -33,31 +27,19 @@ import type {
|
|
|
33
27
|
* notifications: 'auto',
|
|
34
28
|
* about: false,
|
|
35
29
|
* };
|
|
36
|
-
*
|
|
30
|
+
*
|
|
37
31
|
* @example
|
|
38
32
|
* // Advanced configuration
|
|
39
33
|
* const config: SettingsConfig = {
|
|
40
34
|
* appearance: {
|
|
41
35
|
* enabled: true,
|
|
42
36
|
* route: 'CustomAppearance',
|
|
43
|
-
* showLanguage: true,
|
|
44
37
|
* showTheme: true,
|
|
45
38
|
* },
|
|
46
39
|
* notifications: {
|
|
47
40
|
* enabled: 'auto',
|
|
48
41
|
* showToggle: true,
|
|
49
42
|
* initialValue: false,
|
|
50
|
-
* onToggleChange: (value) => console.log(value),
|
|
51
|
-
* },
|
|
52
|
-
* support: {
|
|
53
|
-
* enabled: true,
|
|
54
|
-
* items: {
|
|
55
|
-
* liveSupport: {
|
|
56
|
-
* enabled: true,
|
|
57
|
-
* route: 'ChatSupport',
|
|
58
|
-
* title: 'Live Chat',
|
|
59
|
-
* },
|
|
60
|
-
* },
|
|
61
43
|
* },
|
|
62
44
|
* };
|
|
63
45
|
*/
|
|
@@ -92,30 +74,6 @@ export interface SettingsConfig {
|
|
|
92
74
|
*/
|
|
93
75
|
legal?: FeatureVisibility | LegalConfig;
|
|
94
76
|
|
|
95
|
-
/**
|
|
96
|
-
* Disclaimer settings (Important notices, warnings)
|
|
97
|
-
* @default false
|
|
98
|
-
*/
|
|
99
|
-
disclaimer?: FeatureVisibility | DisclaimerConfig;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Account settings
|
|
103
|
-
* @default false
|
|
104
|
-
*/
|
|
105
|
-
account?: FeatureVisibility | AccountConfig;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Support settings
|
|
109
|
-
* @default false
|
|
110
|
-
*/
|
|
111
|
-
support?: FeatureVisibility | SupportConfig;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Developer settings (only shown in __DEV__ mode)
|
|
115
|
-
* @default false
|
|
116
|
-
*/
|
|
117
|
-
developer?: boolean | DeveloperConfig;
|
|
118
|
-
|
|
119
77
|
/**
|
|
120
78
|
* Custom empty state text when no settings are available
|
|
121
79
|
*/
|
|
@@ -10,12 +10,6 @@ export type {
|
|
|
10
10
|
NotificationsConfig,
|
|
11
11
|
AboutConfig,
|
|
12
12
|
LegalConfig,
|
|
13
|
-
DisclaimerConfig,
|
|
14
13
|
} from "./FeatureConfig";
|
|
15
|
-
export type {
|
|
16
|
-
AccountConfig,
|
|
17
|
-
SupportConfig,
|
|
18
|
-
DeveloperConfig,
|
|
19
|
-
} from "./ExtendedConfig";
|
|
20
14
|
export type { SettingsConfig } from "./SettingsConfig";
|
|
21
15
|
export type { CustomSettingsSection } from "./CustomSection";
|
|
@@ -10,10 +10,6 @@ import type {
|
|
|
10
10
|
NotificationsConfig,
|
|
11
11
|
AboutConfig,
|
|
12
12
|
LegalConfig,
|
|
13
|
-
DisclaimerConfig,
|
|
14
|
-
AccountConfig,
|
|
15
|
-
SupportConfig,
|
|
16
|
-
DeveloperConfig,
|
|
17
13
|
SettingsConfig,
|
|
18
14
|
} from "../types";
|
|
19
15
|
|
|
@@ -38,22 +34,6 @@ export interface NormalizedConfig {
|
|
|
38
34
|
enabled: boolean;
|
|
39
35
|
config?: LegalConfig;
|
|
40
36
|
};
|
|
41
|
-
disclaimer: {
|
|
42
|
-
enabled: boolean;
|
|
43
|
-
config?: DisclaimerConfig;
|
|
44
|
-
};
|
|
45
|
-
account: {
|
|
46
|
-
enabled: boolean;
|
|
47
|
-
config?: AccountConfig;
|
|
48
|
-
};
|
|
49
|
-
support: {
|
|
50
|
-
enabled: boolean;
|
|
51
|
-
config?: SupportConfig;
|
|
52
|
-
};
|
|
53
|
-
developer: {
|
|
54
|
-
enabled: boolean;
|
|
55
|
-
config?: DeveloperConfig;
|
|
56
|
-
};
|
|
57
37
|
}
|
|
58
38
|
|
|
59
39
|
/**
|
|
@@ -93,10 +73,6 @@ export function normalizeSettingsConfig(
|
|
|
93
73
|
notifications: normalizeConfigValue(config?.notifications, "auto"),
|
|
94
74
|
about: normalizeConfigValue(config?.about, "auto"),
|
|
95
75
|
legal: normalizeConfigValue(config?.legal, "auto"),
|
|
96
|
-
disclaimer: normalizeConfigValue(config?.disclaimer, false),
|
|
97
|
-
account: normalizeConfigValue(config?.account, false),
|
|
98
|
-
support: normalizeConfigValue(config?.support, false),
|
|
99
|
-
developer: normalizeConfigValue(config?.developer, false),
|
|
100
76
|
};
|
|
101
77
|
}
|
|
102
78
|
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extended Configuration Types
|
|
3
|
-
* Account, Support, and Developer configurations
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ComponentType } from "react";
|
|
7
|
-
import type { FeatureVisibility } from "./FeatureConfig";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Account Settings Configuration
|
|
11
|
-
*/
|
|
12
|
-
export interface AccountConfig {
|
|
13
|
-
/** Show account section */
|
|
14
|
-
enabled?: FeatureVisibility;
|
|
15
|
-
/** Custom navigation route for account screen */
|
|
16
|
-
route?: string;
|
|
17
|
-
/** Custom account title */
|
|
18
|
-
title?: string;
|
|
19
|
-
/** Custom account description */
|
|
20
|
-
description?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Support Settings Configuration
|
|
25
|
-
*/
|
|
26
|
-
export interface SupportConfig {
|
|
27
|
-
/** Show support section */
|
|
28
|
-
enabled?: FeatureVisibility;
|
|
29
|
-
/** Support items configuration */
|
|
30
|
-
items?: {
|
|
31
|
-
/** Live support configuration */
|
|
32
|
-
liveSupport?: {
|
|
33
|
-
enabled?: boolean;
|
|
34
|
-
route?: string;
|
|
35
|
-
title?: string;
|
|
36
|
-
description?: string;
|
|
37
|
-
};
|
|
38
|
-
/** Help support configuration */
|
|
39
|
-
helpSupport?: {
|
|
40
|
-
enabled?: boolean;
|
|
41
|
-
route?: string;
|
|
42
|
-
title?: string;
|
|
43
|
-
description?: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
/** Custom support section title */
|
|
47
|
-
title?: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Developer Settings Configuration
|
|
52
|
-
*/
|
|
53
|
-
export interface DeveloperConfig {
|
|
54
|
-
/** Show developer section (only in __DEV__ mode) */
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
/** Developer settings items */
|
|
57
|
-
items?: Array<{
|
|
58
|
-
title: string;
|
|
59
|
-
description?: string;
|
|
60
|
-
route?: string;
|
|
61
|
-
onPress?: () => void;
|
|
62
|
-
icon?: ComponentType<{ size?: number; color?: string }>;
|
|
63
|
-
iconColor?: string;
|
|
64
|
-
titleColor?: string;
|
|
65
|
-
}>;
|
|
66
|
-
/** Custom developer section title */
|
|
67
|
-
title?: string;
|
|
68
|
-
}
|