@umituz/react-native-settings 4.23.68 → 4.23.70

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 (46) hide show
  1. package/package.json +2 -1
  2. package/src/domains/about/presentation/hooks/useAboutInfo.ts +0 -1
  3. package/src/domains/appearance/data/colorPalettes.ts +1 -6
  4. package/src/domains/appearance/hooks/useAppearance.ts +5 -3
  5. package/src/domains/appearance/hooks/useAppearanceActions.ts +2 -1
  6. package/src/domains/appearance/index.ts +2 -1
  7. package/src/domains/appearance/presentation/components/ColorPicker.tsx +1 -1
  8. package/src/domains/appearance/presentation/screens/AppearanceScreen.tsx +2 -1
  9. package/src/domains/appearance/types/index.ts +5 -2
  10. package/src/domains/disclaimer/presentation/components/DisclaimerModal.tsx +1 -1
  11. package/src/domains/feedback/presentation/components/FeedbackForm.tsx +48 -12
  12. package/src/domains/feedback/presentation/components/FeedbackModal.tsx +1 -1
  13. package/src/domains/gamification/components/GamificationScreen/index.tsx +83 -4
  14. package/src/domains/gamification/components/GamificationScreen/types.ts +5 -0
  15. package/src/domains/gamification/components/index.ts +0 -1
  16. package/src/domains/gamification/index.ts +0 -1
  17. package/src/domains/gamification/utils/calculations.ts +1 -1
  18. package/src/domains/legal/presentation/components/LegalItem.tsx +1 -1
  19. package/src/domains/localization/index.ts +0 -2
  20. package/src/domains/localization/infrastructure/components/useLanguageSwitcher.ts +18 -1
  21. package/src/domains/localization/infrastructure/config/languages.ts +0 -9
  22. package/src/domains/localization/infrastructure/hooks/TranslationHook.ts +22 -24
  23. package/src/domains/localization/infrastructure/storage/LocalizationStore.ts +163 -111
  24. package/src/domains/notifications/infrastructure/services/NotificationManager.ts +1 -3
  25. package/src/domains/notifications/infrastructure/services/NotificationScheduler.ts +2 -2
  26. package/src/domains/notifications/quietHours/presentation/components/QuietHoursCard.tsx +0 -1
  27. package/src/domains/notifications/reminders/infrastructure/hooks/useReminderActions.ts +60 -25
  28. package/src/domains/notifications/reminders/presentation/screens/ReminderListScreen.tsx +2 -2
  29. package/src/domains/rating/presentation/components/RatingPromptModal.tsx +1 -1
  30. package/src/domains/rating/presentation/components/StarRating.tsx +1 -1
  31. package/src/presentation/components/SettingsErrorBoundary.tsx +14 -18
  32. package/src/presentation/components/SettingsFooter.tsx +1 -3
  33. package/src/presentation/components/SettingsItemCard.tsx +27 -6
  34. package/src/presentation/hooks/queries/useSettingsQuery.ts +0 -1
  35. package/src/presentation/hooks/useSettings.ts +8 -0
  36. package/src/presentation/hooks/useSettingsScreenConfig.ts +3 -3
  37. package/src/presentation/navigation/SettingsStackNavigator.tsx +6 -8
  38. package/src/presentation/screens/SettingsScreen.tsx +6 -3
  39. package/src/presentation/screens/components/SettingsContent.tsx +16 -1
  40. package/src/domains/appearance/hooks/index.ts +0 -6
  41. package/src/domains/appearance/presentation/screens/index.ts +0 -2
  42. package/src/domains/gamification/components/GamificationScreenWrapper.tsx +0 -65
  43. package/src/presentation/navigation/components/wrappers/AboutScreenWrapper.tsx +0 -14
  44. package/src/presentation/navigation/components/wrappers/LegalScreenWrapper.tsx +0 -50
  45. package/src/presentation/navigation/components/wrappers/SettingsScreenWrapper.tsx +0 -44
  46. package/src/presentation/navigation/components/wrappers/index.ts +0 -7
@@ -137,9 +137,9 @@ export const useSettingsScreenConfig = (
137
137
 
138
138
  return {
139
139
  displayName: userProfileData?.displayName || anonymousName,
140
- userId: userProfileData?.userId ?? null,
140
+ userId: userProfileData?.userId ?? undefined,
141
141
  isAnonymous,
142
- avatarUrl: userProfileData?.avatarUrl ?? null,
142
+ avatarUrl: userProfileData?.avatarUrl ?? undefined,
143
143
  onPress: isAnonymous ? handleSignIn : undefined,
144
144
  accountSettingsRoute: isAnonymous ? undefined : "Account",
145
145
  };
@@ -155,7 +155,7 @@ export const useSettingsScreenConfig = (
155
155
  return {
156
156
  profile: {
157
157
  displayName: userProfileData?.displayName || user?.displayName || getTranslation("settings.profile.anonymousName", "Anonymous"),
158
- userId: userProfileData?.userId ?? user?.uid ?? null,
158
+ userId: userProfileData?.userId ?? user?.uid ?? undefined,
159
159
  isAnonymous,
160
160
  avatarUrl: userProfileData?.avatarUrl ?? user?.photoURL ?? undefined,
161
161
  benefits: isAnonymous ? [
@@ -13,18 +13,16 @@ import { AccountScreen } from "@umituz/react-native-auth";
13
13
  import { SettingsScreen } from "../screens/SettingsScreen";
14
14
  import { AppearanceScreen } from "../screens/AppearanceScreen";
15
15
  import { FAQScreen } from "../../domains/faqs";
16
+ import { AboutScreen } from "../../domains/about";
17
+ import { LegalScreen } from "../../domains/legal";
18
+ import { GamificationScreen } from "../../domains/gamification";
16
19
  import { useNavigationHandlers } from "./hooks";
17
- import {
18
- LegalScreenWrapper,
19
- AboutScreenWrapper,
20
- } from "./components/wrappers";
21
20
  import {
22
21
  createNotificationTranslations,
23
22
  createQuietHoursTranslations,
24
23
  createLegalScreenProps,
25
24
  } from "./utils";
26
25
  import type { SettingsStackParamList, SettingsStackNavigatorProps, AdditionalScreen } from "./types";
27
- import { GamificationScreenWrapper } from "../../domains/gamification";
28
26
 
29
27
  export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
30
28
  appInfo,
@@ -100,12 +98,12 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
100
98
  {
101
99
  name: "About",
102
100
  options: { headerTitle: t("settings.about.title") },
103
- children: () => <AboutScreenWrapper config={aboutConfig} />,
101
+ children: () => <AboutScreen config={aboutConfig} />,
104
102
  },
105
103
  {
106
104
  name: "Legal",
107
105
  options: { headerTitle: t("settings.legal.title") },
108
- children: () => <LegalScreenWrapper {...legalScreenProps} />,
106
+ children: () => <LegalScreen {...legalScreenProps} />,
109
107
  },
110
108
  {
111
109
  name: "Notifications",
@@ -163,7 +161,7 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
163
161
  ? {
164
162
  name: "Gamification",
165
163
  options: { headerTitle: t("settings.gamification.title") },
166
- children: () => <GamificationScreenWrapper config={gamificationConfig} />,
164
+ children: () => <GamificationScreen config={gamificationConfig} />,
167
165
  }
168
166
  : null;
169
167
 
@@ -80,10 +80,13 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
80
80
  [config]
81
81
  );
82
82
 
83
- // Memoize feature detection to prevent unnecessary recalculations
83
+ // Feature detection hook (must be called at top level)
84
+ const detectedFeatures = useFeatureDetection(normalizedConfig, navigation, featureOptions);
85
+
86
+ // Memoize features to prevent unnecessary recalculations
84
87
  const features = React.useMemo(
85
- () => useFeatureDetection(normalizedConfig, navigation, featureOptions),
86
- [normalizedConfig, navigation, featureOptions]
88
+ () => detectedFeatures,
89
+ [detectedFeatures]
87
90
  );
88
91
 
89
92
  // Determine if user profile should be shown (explicit prop takes priority, then config)
@@ -70,6 +70,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
70
70
  }) => {
71
71
  const { t } = useLocalization();
72
72
 
73
+ // Optimize: Only track individual feature flags instead of entire object
73
74
  const hasAnyFeatures = useMemo(() =>
74
75
  features.appearance ||
75
76
  features.language ||
@@ -84,7 +85,21 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
84
85
  features.wallet ||
85
86
  features.gamification ||
86
87
  customSections.length > 0,
87
- [features, customSections.length]
88
+ [
89
+ features.appearance,
90
+ features.language,
91
+ features.notifications,
92
+ features.about,
93
+ features.legal,
94
+ features.disclaimer,
95
+ features.feedback,
96
+ features.rating,
97
+ features.faqs,
98
+ features.subscription,
99
+ features.wallet,
100
+ features.gamification,
101
+ customSections.length,
102
+ ]
88
103
  );
89
104
 
90
105
  return (
@@ -1,6 +0,0 @@
1
- /**
2
- * Appearance Hooks
3
- */
4
-
5
- export { useAppearance } from "./useAppearance";
6
- export { useAppearanceActions } from "./useAppearanceActions";
@@ -1,2 +0,0 @@
1
- export { AppearanceScreen } from "./AppearanceScreen";
2
- export type { AppearanceScreenProps } from "./AppearanceScreen";
@@ -1,65 +0,0 @@
1
- import React from 'react';
2
- import { useGamification } from '../hooks/useGamification';
3
- import { GamificationScreen } from './GamificationScreen';
4
- import type { GamificationConfig } from '../types';
5
- import type { AchievementItemProps } from '../components';
6
-
7
- interface GamificationScreenWrapperProps {
8
- config: GamificationConfig;
9
- }
10
-
11
- export const GamificationScreenWrapper: React.FC<GamificationScreenWrapperProps> = ({ config }) => {
12
- const {
13
- points,
14
- totalTasksCompleted,
15
- level,
16
- streak,
17
- achievements,
18
- } = useGamification(config);
19
-
20
- // Transform store achievements to UI props
21
- const achievementItems: AchievementItemProps[] = achievements.map(a => ({
22
- ...a,
23
- title: a.title,
24
- description: a.description,
25
- icon: a.icon,
26
- isUnlocked: a.isUnlocked,
27
- progress: a.progress,
28
- threshold: a.threshold,
29
- id: a.id,
30
- type: a.type
31
- }));
32
-
33
- return (
34
- <GamificationScreen
35
- title={config.translations.title}
36
- statsTitle={config.translations.statsTitle}
37
- achievementsTitle={config.translations.achievementsTitle}
38
- streakTitle={config.translations.streakTitle}
39
- levelProps={{
40
- level: level.currentLevel,
41
- points: level.currentPoints,
42
- pointsToNext: level.pointsToNext,
43
- progress: level.progress,
44
- levelTitle: config.translations.levelTitle,
45
- showPoints: true,
46
- }}
47
- streakProps={{
48
- current: streak.current,
49
- longest: streak.longest,
50
- currentLabel: config.translations.currentStreak,
51
- bestLabel: config.translations.bestStreak,
52
- daysLabel: config.translations.days,
53
- }}
54
- stats={[
55
- {
56
- label: config.translations.statsTitle,
57
- value: points, // Pass number directly
58
- icon: "star",
59
- },
60
- ]}
61
- achievements={achievementItems}
62
- emptyAchievementsText={config.translations.emptyAchievements}
63
- />
64
- );
65
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * About Screen Wrapper Component
3
- */
4
- import React from "react";
5
- import { AboutScreen } from "../../../../domains/about";
6
- import type { AboutConfig } from "../../../../domains/about/domain/entities/AppInfo";
7
-
8
- export interface AboutScreenWrapperProps {
9
- config: AboutConfig;
10
- }
11
-
12
- export const AboutScreenWrapper: React.FC<AboutScreenWrapperProps> = ({
13
- config,
14
- }) => <AboutScreen config={config} />;
@@ -1,50 +0,0 @@
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
- );
@@ -1,44 +0,0 @@
1
- /**
2
- * Settings Screen Wrapper Component
3
- */
4
- import React from "react";
5
- import { SettingsScreen } from "../../../screens/SettingsScreen";
6
- import type { SettingsConfig, CustomSettingsSection } from "../../../screens/types";
7
- import type { UserProfileDisplay } from "../../types";
8
- import type { DevSettingsProps } from "../../../../domains/dev";
9
-
10
- export interface SettingsScreenWrapperProps {
11
- config?: SettingsConfig;
12
- appVersion: string;
13
- showUserProfile: boolean;
14
- userProfile?: UserProfileDisplay;
15
- devSettings?: DevSettingsProps;
16
- customSections?: CustomSettingsSection[];
17
- showHeader?: boolean;
18
- showCloseButton?: boolean;
19
- onClose?: () => void;
20
- }
21
-
22
- export const SettingsScreenWrapper: React.FC<SettingsScreenWrapperProps> = ({
23
- config,
24
- appVersion,
25
- showUserProfile,
26
- userProfile,
27
- devSettings,
28
- customSections,
29
- showHeader,
30
- showCloseButton,
31
- onClose,
32
- }) => (
33
- <SettingsScreen
34
- config={config}
35
- appVersion={appVersion}
36
- showUserProfile={showUserProfile}
37
- userProfile={userProfile}
38
- devSettings={devSettings}
39
- customSections={customSections}
40
- showHeader={showHeader}
41
- showCloseButton={showCloseButton}
42
- onClose={onClose}
43
- />
44
- );
@@ -1,7 +0,0 @@
1
- /**
2
- * Wrapper Components
3
- */
4
- export { LegalScreenWrapper } from './LegalScreenWrapper';
5
- export type { LegalScreenWrapperProps } from './LegalScreenWrapper';
6
- export { AboutScreenWrapper } from './AboutScreenWrapper';
7
- export type { AboutScreenWrapperProps } from './AboutScreenWrapper';