@umituz/react-native-settings 4.20.53 → 4.20.54

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.
Files changed (26) hide show
  1. package/package.json +1 -1
  2. package/src/domains/about/presentation/components/AboutSettingItem.tsx +39 -86
  3. package/src/domains/about/presentation/hooks/useAboutInfo.ts +39 -101
  4. package/src/domains/about/presentation/hooks/useAboutInfo.types.ts +32 -0
  5. package/src/domains/about/utils/AppInfoFactory.ts +19 -0
  6. package/src/domains/about/utils/index.ts +2 -0
  7. package/src/domains/legal/index.ts +1 -0
  8. package/src/domains/legal/presentation/screens/LegalContentScreen.tsx +140 -0
  9. package/src/domains/legal/presentation/screens/PrivacyPolicyScreen.tsx +17 -155
  10. package/src/domains/legal/presentation/screens/TermsOfServiceScreen.tsx +17 -155
  11. package/src/presentation/components/SettingsItemCard.tsx +2 -2
  12. package/src/presentation/navigation/SettingsStackNavigator.tsx +50 -129
  13. package/src/presentation/navigation/components/wrappers/AboutScreenWrapper.tsx +13 -0
  14. package/src/presentation/navigation/components/wrappers/LegalScreenWrapper.tsx +50 -0
  15. package/src/presentation/navigation/components/wrappers/SettingsScreenWrapper.tsx +32 -0
  16. package/src/presentation/navigation/components/wrappers/index.ts +9 -0
  17. package/src/presentation/navigation/utils/index.ts +5 -0
  18. package/src/presentation/navigation/utils/navigationScreenOptions.ts +56 -0
  19. package/src/presentation/navigation/utils/navigationTranslations.ts +46 -0
  20. package/src/presentation/screens/components/SettingsHeader.tsx +1 -1
  21. package/src/presentation/screens/types/BaseTypes.ts +12 -0
  22. package/src/presentation/screens/types/ContentConfig.ts +82 -0
  23. package/src/presentation/screens/types/SettingsConfig.ts +6 -4
  24. package/src/presentation/screens/types/UserFeatureConfig.ts +137 -0
  25. package/src/presentation/screens/types/index.ts +10 -8
  26. package/src/presentation/screens/types/FeatureConfig.ts +0 -263
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Legal Screen Wrapper Component
3
+ */
4
+ import React from "react";
5
+ import { LegalScreen } from "../../../../domains/legal";
6
+
7
+ export interface LegalScreenWrapperProps {
8
+ title: string;
9
+ description: string;
10
+ documentsHeader: string;
11
+ privacyTitle: string;
12
+ privacyDescription: string;
13
+ termsTitle: string;
14
+ termsDescription: string;
15
+ eulaTitle: string;
16
+ eulaDescription: string;
17
+ onPrivacyPress: () => void;
18
+ onTermsPress: () => void;
19
+ onEulaPress: () => void;
20
+ }
21
+
22
+ export const LegalScreenWrapper: React.FC<LegalScreenWrapperProps> = ({
23
+ title,
24
+ description,
25
+ documentsHeader,
26
+ privacyTitle,
27
+ privacyDescription,
28
+ termsTitle,
29
+ termsDescription,
30
+ eulaTitle,
31
+ eulaDescription,
32
+ onPrivacyPress,
33
+ onTermsPress,
34
+ onEulaPress,
35
+ }) => (
36
+ <LegalScreen
37
+ title={title}
38
+ description={description}
39
+ documentsHeader={documentsHeader}
40
+ privacyTitle={privacyTitle}
41
+ privacyDescription={privacyDescription}
42
+ termsTitle={termsTitle}
43
+ termsDescription={termsDescription}
44
+ eulaTitle={eulaTitle}
45
+ eulaDescription={eulaDescription}
46
+ onPrivacyPress={onPrivacyPress}
47
+ onTermsPress={onTermsPress}
48
+ onEulaPress={onEulaPress}
49
+ />
50
+ );
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Settings Screen Wrapper Component
3
+ */
4
+ import React from "react";
5
+ import { SettingsScreen } from "../../../screens/SettingsScreen";
6
+
7
+ export interface SettingsScreenWrapperProps {
8
+ config: any;
9
+ appVersion: string;
10
+ showUserProfile: boolean;
11
+ userProfile: any;
12
+ devSettings: any;
13
+ customSections: any[];
14
+ }
15
+
16
+ export const SettingsScreenWrapper: React.FC<SettingsScreenWrapperProps> = ({
17
+ config,
18
+ appVersion,
19
+ showUserProfile,
20
+ userProfile,
21
+ devSettings,
22
+ customSections,
23
+ }) => (
24
+ <SettingsScreen
25
+ config={config}
26
+ appVersion={appVersion}
27
+ showUserProfile={showUserProfile}
28
+ userProfile={userProfile}
29
+ devSettings={devSettings}
30
+ customSections={customSections}
31
+ />
32
+ );
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Wrapper Components
3
+ */
4
+ export { SettingsScreenWrapper } from './SettingsScreenWrapper';
5
+ export type { SettingsScreenWrapperProps } from './SettingsScreenWrapper';
6
+ export { LegalScreenWrapper } from './LegalScreenWrapper';
7
+ export type { LegalScreenWrapperProps } from './LegalScreenWrapper';
8
+ export { AboutScreenWrapper } from './AboutScreenWrapper';
9
+ export type { AboutScreenWrapperProps } from './AboutScreenWrapper';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Navigation Utilities
3
+ */
4
+ export * from './navigationTranslations';
5
+ export * from './navigationScreenOptions';
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Navigation Screen Options Utility
3
+ * Creates screen options for settings navigation
4
+ */
5
+
6
+ import type { DesignTokens } from "@umituz/react-native-design-system";
7
+
8
+ export const createScreenOptions = (tokens: DesignTokens) => ({
9
+ headerStyle: {
10
+ backgroundColor: tokens.colors.surface,
11
+ borderBottomColor: tokens.colors.borderLight,
12
+ borderBottomWidth: 1,
13
+ },
14
+ headerTitleStyle: {
15
+ fontSize: 18,
16
+ fontWeight: "600" as const,
17
+ color: tokens.colors.textPrimary,
18
+ },
19
+ headerTintColor: tokens.colors.textPrimary,
20
+ });
21
+
22
+ export const createAppearanceScreenOptions = (t: any) => ({
23
+ headerShown: true,
24
+ headerTitle: t("settings.appearance.title"),
25
+ headerTitleAlign: "center" as const,
26
+ });
27
+
28
+ export const createAboutScreenOptions = (t: any) => ({
29
+ headerShown: true,
30
+ headerTitle: t("settings.about.title"),
31
+ headerTitleAlign: "center" as const,
32
+ });
33
+
34
+ export const createLegalScreenOptions = (t: any) => ({
35
+ headerShown: true,
36
+ headerTitle: t("settings.legal.title"),
37
+ headerTitleAlign: "center" as const,
38
+ });
39
+
40
+ export const createNotificationsScreenOptions = (t: any) => ({
41
+ headerShown: true,
42
+ headerTitle: t("settings.notifications.title"),
43
+ headerTitleAlign: "center" as const,
44
+ });
45
+
46
+ export const createFAQScreenOptions = (t: any) => ({
47
+ headerShown: true,
48
+ headerTitle: t("settings.faqs.title"),
49
+ headerTitleAlign: "center" as const,
50
+ });
51
+
52
+ export const createLanguageSelectionScreenOptions = (t: any) => ({
53
+ headerShown: true,
54
+ headerTitle: t("settings.language.title"),
55
+ headerTitleAlign: "center" as const,
56
+ });
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Navigation Translations Utility
3
+ * Creates translation objects for navigation screens
4
+ */
5
+
6
+ export const createNotificationTranslations = (t: any) => ({
7
+ screenTitle: t("settings.notifications.title"),
8
+ masterToggleTitle: t("settings.notifications.masterToggleTitle"),
9
+ masterToggleDescription: t("settings.notifications.masterToggleDescription"),
10
+ soundTitle: t("settings.notifications.soundTitle"),
11
+ soundDescription: t("settings.notifications.soundDescription"),
12
+ vibrationTitle: t("settings.notifications.vibrationTitle"),
13
+ vibrationDescription: t("settings.notifications.vibrationDescription"),
14
+ remindersTitle: t("settings.notifications.remindersTitle"),
15
+ remindersDescription: t("settings.notifications.remindersDescription"),
16
+ quietHoursTitle: t("settings.notifications.quietHoursTitle"),
17
+ quietHoursDescription: t("settings.notifications.quietHoursDescription"),
18
+ });
19
+
20
+ export const createQuietHoursTranslations = (t: any) => ({
21
+ title: t("settings.notifications.quietHours.title"),
22
+ description: t("settings.notifications.quietHours.description"),
23
+ startTimeLabel: t("settings.notifications.quietHours.startTimeLabel"),
24
+ endTimeLabel: t("settings.notifications.quietHours.endTimeLabel"),
25
+ enabledLabel: t("settings.notifications.quietHours.enabledLabel"),
26
+ });
27
+
28
+ export const createLegalScreenProps = (
29
+ t: any,
30
+ handlePrivacyPress: () => void,
31
+ handleTermsPress: () => void,
32
+ handleEulaPress: () => void
33
+ ) => ({
34
+ title: t("settings.legal.title"),
35
+ description: t("settings.legal.description"),
36
+ documentsHeader: t("settings.legal.documentsHeader"),
37
+ privacyTitle: t("settings.legal.privacyTitle"),
38
+ privacyDescription: t("settings.legal.privacyDescription"),
39
+ termsTitle: t("settings.legal.termsTitle"),
40
+ termsDescription: t("settings.legal.termsDescription"),
41
+ eulaTitle: t("settings.legal.eulaTitle"),
42
+ eulaDescription: t("settings.legal.eulaDescription"),
43
+ onPrivacyPress: handlePrivacyPress,
44
+ onTermsPress: handleTermsPress,
45
+ onEulaPress: handleEulaPress,
46
+ });
@@ -43,7 +43,7 @@ export const SettingsHeader: React.FC<SettingsHeaderProps> = ({
43
43
  styles.closeButton,
44
44
  {
45
45
  backgroundColor: pressed ? tokens.colors.surfaceVariant : tokens.colors.surface,
46
- borderRadius: tokens.radius.full,
46
+ borderRadius: tokens.borderRadius.full,
47
47
  },
48
48
  ]}
49
49
  hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Base Feature Types
3
+ * Core types for feature visibility and configuration
4
+ */
5
+
6
+ /**
7
+ * Feature visibility configuration
8
+ * - true: Always show (if navigation screen exists)
9
+ * - false: Never show
10
+ * - 'auto': Automatically detect (check if navigation screen exists and package is available)
11
+ */
12
+ export type FeatureVisibility = boolean | "auto";
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Content Feature Configuration Types
3
+ * Types for content-related features (About, Legal, Disclaimer)
4
+ */
5
+
6
+ import type { FeatureVisibility } from "./BaseTypes";
7
+ import type { AppearanceTexts } from "../../../domains/appearance/types";
8
+
9
+ /**
10
+ * Base configuration interface for content features
11
+ */
12
+ interface BaseContentConfig {
13
+ /** Show section */
14
+ enabled?: FeatureVisibility;
15
+ /** Custom navigation route */
16
+ route?: string;
17
+ /** Custom title */
18
+ title?: string;
19
+ /** Custom description */
20
+ description?: string;
21
+ /** Custom icon name (Ionicons) */
22
+ icon?: string;
23
+ /** Custom section title for grouping */
24
+ sectionTitle?: string;
25
+ }
26
+
27
+ /**
28
+ * About Settings Configuration
29
+ */
30
+ export interface AboutConfig extends BaseContentConfig {
31
+ /** Default route name when no custom route provided */
32
+ defaultRoute?: string;
33
+ }
34
+
35
+ /**
36
+ * Legal Settings Configuration
37
+ */
38
+ export interface LegalConfig extends BaseContentConfig {
39
+ /** Default route name when no custom route provided */
40
+ defaultRoute?: string;
41
+ }
42
+
43
+ /**
44
+ * Disclaimer Settings Configuration
45
+ */
46
+ export interface DisclaimerConfig extends BaseContentConfig {
47
+ // Disclaimer-specific properties can be added here if needed
48
+ }
49
+
50
+ /**
51
+ * Appearance Settings Configuration
52
+ */
53
+ export interface AppearanceConfig extends BaseContentConfig {
54
+ /** Show theme toggle */
55
+ showTheme?: boolean;
56
+ /** Default route name when no custom route provided */
57
+ defaultRoute?: string;
58
+ /** Appearance screen texts (theme mode labels, descriptions, etc.) */
59
+ texts?: AppearanceTexts;
60
+ }
61
+
62
+ /**
63
+ * Language Settings Configuration
64
+ */
65
+ export interface LanguageConfig extends BaseContentConfig {
66
+ /** Default language display when no language is detected */
67
+ defaultLanguageDisplay?: string;
68
+ }
69
+
70
+ /**
71
+ * Notifications Settings Configuration
72
+ */
73
+ export interface NotificationsConfig extends BaseContentConfig {
74
+ /** Show notification toggle switch */
75
+ showToggle?: boolean;
76
+ /** Initial toggle value */
77
+ initialValue?: boolean;
78
+ /** Toggle change handler */
79
+ onToggleChange?: (value: boolean) => void;
80
+ /** Default route name when no custom route provided */
81
+ defaultRoute?: string;
82
+ }
@@ -3,7 +3,7 @@
3
3
  * Combines all feature configurations
4
4
  */
5
5
 
6
- import type { FeatureVisibility } from "./FeatureConfig";
6
+ import type { FeatureVisibility } from "./BaseTypes";
7
7
  import type {
8
8
  AppearanceConfig,
9
9
  LanguageConfig,
@@ -11,6 +11,8 @@ import type {
11
11
  AboutConfig,
12
12
  LegalConfig,
13
13
  DisclaimerConfig,
14
+ } from "./ContentConfig";
15
+ import type {
14
16
  UserProfileConfig,
15
17
  FeedbackConfig,
16
18
  RatingConfig,
@@ -18,7 +20,7 @@ import type {
18
20
  CloudSyncConfig,
19
21
  SubscriptionConfig,
20
22
  WalletConfig,
21
- } from "./FeatureConfig";
23
+ } from "./UserFeatureConfig";
22
24
 
23
25
  /**
24
26
  * Main Settings Configuration
@@ -115,7 +117,7 @@ export interface SettingsConfig {
115
117
  * @default false
116
118
  */
117
119
  cloudSync?: FeatureVisibility | CloudSyncConfig;
118
-
120
+
119
121
  /**
120
122
  * Subscription settings configuration
121
123
  * @default false
@@ -132,4 +134,4 @@ export interface SettingsConfig {
132
134
  * Custom empty state text when no settings are available
133
135
  */
134
136
  emptyStateText?: string;
135
- }
137
+ }
@@ -0,0 +1,137 @@
1
+ /**
2
+ * User Feature Configuration Types
3
+ * Types for user-related features (Profile, Feedback, FAQ, etc.)
4
+ */
5
+
6
+ import type { FeatureVisibility } from "./BaseTypes";
7
+ import type { FeedbackType } from "../../../domains/feedback/domain/entities/FeedbackEntity";
8
+
9
+ /**
10
+ * User Profile Settings Configuration
11
+ */
12
+ export interface UserProfileConfig {
13
+ /** Show user profile header */
14
+ enabled?: boolean;
15
+ /** Custom display name for anonymous users */
16
+ anonymousDisplayName?: string;
17
+ /** Custom avatar service URL */
18
+ avatarServiceUrl?: string;
19
+ /** Navigation route for account settings (shows chevron if set) */
20
+ accountSettingsRoute?: string;
21
+ }
22
+
23
+ /**
24
+ * Feedback Settings Configuration
25
+ */
26
+ export interface FeedbackConfig {
27
+ /** Enable feedback feature */
28
+ enabled?: FeatureVisibility;
29
+ /** Custom title for the feedback section */
30
+ title?: string;
31
+ /** Custom label for the feedback item */
32
+ description?: string;
33
+ /** Custom icon name (Ionicons) */
34
+ icon?: string;
35
+ /** Custom section title for grouping */
36
+ sectionTitle?: string;
37
+ /** Initial feedback type */
38
+ initialType?: FeedbackType;
39
+ /** Feedback submission handler */
40
+ onSubmit?: (data: { type: any; rating: number; description: string; title: string }) => Promise<void>;
41
+ /** Custom handler to open feedback screen (overrides default modal) */
42
+ onPress?: () => void;
43
+ }
44
+
45
+ /**
46
+ * FAQ Settings Configuration
47
+ */
48
+ export interface FAQConfig {
49
+ /** Enable FAQ feature */
50
+ enabled?: FeatureVisibility;
51
+ /** Custom title for the FAQ section */
52
+ title?: string;
53
+ /** Custom label for the FAQ button */
54
+ description?: string;
55
+ /** Custom icon name (Ionicons) */
56
+ icon?: string;
57
+ /** Custom section title for grouping */
58
+ sectionTitle?: string;
59
+ /** FAQ items passed from app */
60
+ items?: any[];
61
+ /** Handler to open FAQ screen */
62
+ onPress?: () => void;
63
+ }
64
+
65
+ /**
66
+ * Rating Settings Configuration
67
+ */
68
+ export interface RatingConfig {
69
+ /** Enable rating feature */
70
+ enabled?: FeatureVisibility;
71
+ /** Custom title for the rating section */
72
+ title?: string;
73
+ /** Custom label for the rate app button */
74
+ description?: string;
75
+ /** Store URL for direct linking (optional) */
76
+ storeUrl?: string;
77
+ /** Custom handler for rating action (e.g. open store review) */
78
+ onRate?: () => void;
79
+ }
80
+
81
+ /**
82
+ * Cloud Sync Settings Configuration
83
+ */
84
+ export interface CloudSyncConfig {
85
+ /** Enable cloud sync feature */
86
+ enabled?: FeatureVisibility;
87
+ /** Custom title for the sync section */
88
+ title?: string;
89
+ /** Custom description for the sync toggle */
90
+ description?: string;
91
+ /** Custom icon name (Ionicons) */
92
+ icon?: string;
93
+ /** Custom section title for grouping */
94
+ sectionTitle?: string;
95
+ /** Firestore collection name */
96
+ collectionName?: string;
97
+ }
98
+
99
+ /**
100
+ * Subscription Settings Configuration
101
+ */
102
+ export interface SubscriptionConfig {
103
+ /** Show subscription section */
104
+ enabled?: FeatureVisibility;
105
+ /** Custom title for the subscription section */
106
+ title?: string;
107
+ /** Custom label for the subscription item */
108
+ description?: string;
109
+ /** Custom icon name (Ionicons) */
110
+ icon?: string;
111
+ /** Custom section title for grouping */
112
+ sectionTitle?: string;
113
+ /** Handler to open subscription screen */
114
+ onPress?: () => void;
115
+ /** Whether user is premium (to show active status) */
116
+ isPremium?: boolean;
117
+ }
118
+
119
+ /**
120
+ * Wallet Settings Configuration
121
+ */
122
+ export interface WalletConfig {
123
+ /** Show wallet section */
124
+ enabled?: FeatureVisibility;
125
+ /** Custom title for the wallet section */
126
+ title?: string;
127
+ /** Custom label for the wallet item */
128
+ description?: string;
129
+ /** Custom icon name (Ionicons) */
130
+ icon?: string;
131
+ /** Custom section title for grouping */
132
+ sectionTitle?: string;
133
+ /** Navigation route for wallet screen */
134
+ route?: string;
135
+ /** Current balance to display */
136
+ balance?: number;
137
+ }
@@ -3,21 +3,23 @@
3
3
  * Exports all settings-related types
4
4
  */
5
5
 
6
- export type { FeatureVisibility } from "./FeatureConfig";
6
+ export type { FeatureVisibility } from "./BaseTypes";
7
7
  export type {
8
- AppearanceConfig,
9
- LanguageConfig,
10
- NotificationsConfig,
11
8
  AboutConfig,
12
9
  LegalConfig,
13
10
  DisclaimerConfig,
11
+ AppearanceConfig,
12
+ LanguageConfig,
13
+ NotificationsConfig,
14
+ } from "./ContentConfig";
15
+ export type {
14
16
  UserProfileConfig,
15
17
  FeedbackConfig,
16
- RatingConfig,
17
18
  FAQConfig,
18
- SubscriptionConfig,
19
+ RatingConfig,
19
20
  CloudSyncConfig,
21
+ SubscriptionConfig,
20
22
  WalletConfig,
21
- } from "./FeatureConfig";
23
+ } from "./UserFeatureConfig";
22
24
  export type { SettingsConfig } from "./SettingsConfig";
23
- export type { CustomSettingsSection } from "./CustomSection";
25
+ export type { CustomSettingsSection } from "./CustomSection";