@umituz/react-native-settings 5.3.2 → 5.3.4
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 +78 -18
- package/src/account.ts +4 -40
- package/src/domains/about/presentation/components/AboutContent.tsx +2 -1
- package/src/domains/about/presentation/components/AboutHeader.tsx +2 -1
- package/src/domains/about/presentation/components/AboutSettingItem.tsx +2 -1
- package/src/domains/about/presentation/screens/AboutScreen.tsx +4 -1
- package/src/domains/about/presentation/screens/AboutScreenContent.tsx +1 -1
- package/src/domains/appearance/hooks/useAppearance.ts +1 -1
- package/src/domains/appearance/hooks/useAppearanceActions.ts +1 -1
- package/src/domains/appearance/presentation/components/AppearanceHeader.tsx +2 -2
- package/src/domains/appearance/presentation/components/AppearancePreview.tsx +2 -2
- package/src/domains/appearance/presentation/components/ColorPicker.tsx +2 -5
- package/src/domains/appearance/presentation/components/CustomColorsSection.tsx +2 -2
- package/src/domains/appearance/presentation/components/ThemeModeSection.tsx +2 -2
- package/src/domains/appearance/presentation/components/ThemeOption.tsx +2 -2
- package/src/domains/appearance/presentation/screens/AppearanceScreen.tsx +3 -6
- package/src/domains/appearance/types/index.ts +1 -4
- package/src/domains/dev/presentation/components/DevSettingsSection.tsx +2 -1
- package/src/domains/dev/presentation/components/EnvViewerSetting.tsx +2 -1
- package/src/domains/dev/presentation/screens/EnvViewerScreen.tsx +4 -10
- package/src/domains/disclaimer/presentation/components/DisclaimerCard.tsx +2 -3
- package/src/domains/disclaimer/presentation/components/DisclaimerModal.tsx +3 -1
- package/src/domains/disclaimer/presentation/components/DisclaimerSetting.tsx +1 -1
- package/src/domains/disclaimer/presentation/screens/DisclaimerScreen.tsx +4 -9
- package/src/domains/faqs/presentation/components/FAQCategory.tsx +2 -1
- package/src/domains/faqs/presentation/components/FAQEmptyState.tsx +2 -1
- package/src/domains/faqs/presentation/components/FAQItem.tsx +2 -1
- package/src/domains/faqs/presentation/components/FAQSearchBar.tsx +2 -1
- package/src/domains/faqs/presentation/screens/FAQScreen.tsx +4 -1
- package/src/domains/feedback/presentation/components/FeedbackForm.styles.ts +1 -1
- package/src/domains/feedback/presentation/components/FeedbackForm.tsx +2 -2
- package/src/domains/feedback/presentation/components/FeedbackModal.tsx +4 -1
- package/src/domains/gamification/components/AchievementCard.tsx +3 -1
- package/src/domains/gamification/components/AchievementItem.tsx +2 -1
- package/src/domains/gamification/components/AchievementToast.tsx +2 -1
- package/src/domains/gamification/components/GamificationScreen/AchievementsList.tsx +1 -1
- package/src/domains/gamification/components/GamificationScreen/GamificationScreen.tsx +4 -1
- package/src/domains/gamification/components/GamificationScreen/StatsGrid.tsx +1 -1
- package/src/domains/gamification/components/LevelProgress.tsx +3 -1
- package/src/domains/gamification/components/PointsBadge.tsx +3 -1
- package/src/domains/gamification/components/StatsCard.tsx +3 -1
- package/src/domains/gamification/components/StreakDisplay.tsx +3 -1
- package/src/domains/gamification/store/gamificationStore.ts +1 -1
- package/src/domains/legal/domain/services/StyleCacheService.ts +1 -1
- package/src/domains/legal/presentation/components/LegalDocumentsList.tsx +2 -1
- package/src/domains/legal/presentation/components/LegalItem.tsx +1 -1
- package/src/domains/legal/presentation/components/LegalScreenHeader.tsx +2 -1
- package/src/domains/legal/presentation/screens/LegalContentScreen.tsx +4 -3
- package/src/domains/legal/presentation/screens/LegalScreen.tsx +2 -1
- package/src/domains/legal/presentation/screens/PrivacyPolicyScreen.tsx +1 -1
- package/src/domains/legal/presentation/screens/TermsOfServiceScreen.tsx +1 -1
- package/src/domains/localization/infrastructure/components/LanguageSwitcher.tsx +2 -1
- package/src/domains/localization/infrastructure/storage/LanguageInitializer.ts +1 -1
- package/src/domains/localization/infrastructure/storage/LanguageSwitcher.ts +1 -1
- package/src/domains/localization/infrastructure/storage/LocalizationStore.ts +1 -1
- package/src/domains/localization/presentation/components/LanguageItem.tsx +2 -1
- package/src/domains/localization/presentation/components/LanguageSection.tsx +3 -5
- package/src/domains/localization/presentation/screens/LanguageSelectionScreen.tsx +3 -7
- package/src/domains/notifications/infrastructure/hooks/useNotificationSettings.ts +1 -1
- package/src/domains/notifications/infrastructure/storage/UnifiedNotificationStore.ts +1 -1
- package/src/domains/notifications/presentation/components/RemindersNavRow.styles.ts +1 -1
- package/src/domains/notifications/presentation/components/RemindersNavRow.tsx +2 -2
- package/src/domains/notifications/presentation/components/SettingRow.tsx +2 -2
- package/src/domains/notifications/presentation/screens/NotificationSettingsScreen.styles.ts +1 -1
- package/src/domains/notifications/presentation/screens/NotificationSettingsScreen.tsx +4 -9
- package/src/domains/notifications/presentation/screens/NotificationsScreen.tsx +4 -13
- package/src/domains/notifications/quietHours/presentation/components/QuietHoursCard.tsx +2 -2
- package/src/domains/notifications/reminders/presentation/components/FormButton.tsx +2 -2
- package/src/domains/notifications/reminders/presentation/components/FrequencySelector.tsx +2 -2
- package/src/domains/notifications/reminders/presentation/components/ReminderForm.styles.ts +1 -1
- package/src/domains/notifications/reminders/presentation/components/ReminderForm.tsx +2 -2
- package/src/domains/notifications/reminders/presentation/components/ReminderItem.tsx +2 -2
- package/src/domains/notifications/reminders/presentation/components/TimePresetSelector.tsx +2 -2
- package/src/domains/notifications/reminders/presentation/components/WeekdaySelector.tsx +2 -2
- package/src/domains/notifications/reminders/presentation/screens/ReminderListScreen.tsx +4 -9
- package/src/domains/rating/infrastructure/storage/RatingStorage.ts +1 -1
- package/src/domains/rating/presentation/components/RatingPromptModal.tsx +3 -7
- package/src/domains/rating/presentation/components/StarRating.tsx +2 -1
- package/src/domains/video-tutorials/presentation/components/VideoTutorialCard.tsx +2 -1
- package/src/domains/video-tutorials/presentation/screens/VideoTutorialsScreen.tsx +4 -9
- package/src/index.ts +1 -3
- package/src/infrastructure/repositories/SettingsRepository.ts +1 -1
- package/src/presentation/components/SettingsFooter.tsx +1 -1
- package/src/presentation/components/SettingsItemCard.tsx +2 -5
- package/src/presentation/components/SettingsNavigationItem.tsx +1 -1
- package/src/presentation/components/SettingsSection.tsx +2 -1
- package/src/presentation/components/settings/SettingsItemCardContent.tsx +2 -1
- package/src/presentation/components/settings/SettingsItemCardRightElement.tsx +1 -1
- package/src/presentation/components/settings/SettingsItemCardSection.tsx +1 -1
- package/src/presentation/hooks/mutations/useSettingsMutations.ts +1 -1
- package/src/presentation/hooks/queries/useSettingsQuery.ts +1 -1
- package/src/presentation/hooks/useSettingsScreenConfig.ts +26 -51
- package/src/presentation/navigation/SettingsStackNavigator.tsx +1 -4
- package/src/presentation/navigation/hooks/useSettingsScreens.ts +4 -8
- package/src/presentation/navigation/types.ts +4 -38
- package/src/presentation/screens/SettingsScreen.tsx +1 -7
- package/src/presentation/screens/components/SettingsContent.tsx +2 -4
- package/src/presentation/screens/components/SettingsHeader.tsx +3 -1
- package/src/presentation/screens/components/sections/ProfileSectionLoader.tsx +6 -7
- package/src/presentation/screens/components/types/SettingsContentProps.ts +0 -2
- package/src/presentation/screens/hooks/useSettingsScreen.ts +1 -1
- package/src/presentation/screens/types/CustomSection.ts +1 -1
- package/src/presentation/utils/accountConfigUtils.ts +1 -1
- package/src/presentation/utils/screenFactory.ts +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import React from "react";
|
|
8
|
-
import type { IconName } from "@umituz/react-native-design-system";
|
|
8
|
+
import type { IconName } from "@umituz/react-native-design-system/atoms";
|
|
9
9
|
import { SettingsItemCard } from "./SettingsItemCard";
|
|
10
10
|
import { useSettingsNavigation } from "../navigation/hooks/useSettingsNavigation";
|
|
11
11
|
import { createRouteOrPressHandler } from "../navigation/utils/navigationHelpers";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { AtomicText } from "@umituz/react-native-design-system/atoms";
|
|
4
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
|
|
4
5
|
|
|
5
6
|
export interface SettingsSectionProps {
|
|
6
7
|
title: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { AtomicIcon, AtomicText, type IconName } from "@umituz/react-native-design-system/atoms";
|
|
4
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
|
|
4
5
|
|
|
5
6
|
export interface SettingsItemCardContentProps {
|
|
6
7
|
icon: IconName;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AtomicIcon, AtomicSwitch, type IconName } from "@umituz/react-native-design-system";
|
|
2
|
+
import { AtomicIcon, AtomicSwitch, type IconName } from "@umituz/react-native-design-system/atoms";
|
|
3
3
|
|
|
4
4
|
export interface SettingsItemCardRightElementProps {
|
|
5
5
|
showSwitch: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { AtomicText } from "@umituz/react-native-design-system";
|
|
3
|
+
import { AtomicText } from "@umituz/react-native-design-system/atoms";
|
|
4
4
|
|
|
5
5
|
export interface SettingsItemCardSectionProps {
|
|
6
6
|
sectionTitle?: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Mutations for updating and resetting user settings
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { useMutation, useQueryClient } from '@umituz/react-native-design-system';
|
|
7
|
+
import { useMutation, useQueryClient } from '@umituz/react-native-design-system/tanstack';
|
|
8
8
|
import { getSettingsService } from '../../../infrastructure/services/SettingsService';
|
|
9
9
|
import { SETTINGS_QUERY_KEY } from '../queries/useSettingsQuery';
|
|
10
10
|
import type { UserSettings } from '../../../application/ports/ISettingsRepository';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Fetches user settings using TanStack Query
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { useQuery } from '@umituz/react-native-design-system';
|
|
7
|
+
import { useQuery } from '@umituz/react-native-design-system/tanstack';
|
|
8
8
|
import { getSettingsService } from '../../../infrastructure/services/SettingsService';
|
|
9
9
|
|
|
10
10
|
export const SETTINGS_QUERY_KEY = ['settings'];
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
* useSettingsScreenConfig Hook
|
|
3
3
|
*
|
|
4
4
|
* One-stop hook for settings screen configuration.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Handles auth, feedback, and all settings config internally.
|
|
6
|
+
* Apps pass subscription config from subscription package.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { useMemo } from "react";
|
|
10
|
+
import { useAuth, useUserProfile, useAuthHandlers } from "@umituz/react-native-auth";
|
|
10
11
|
import { createUserProfileDisplay } from "../utils/userProfileUtils";
|
|
11
12
|
import { createAccountConfig } from "../utils/accountConfigUtils";
|
|
12
13
|
import { translateFAQData } from "../utils/faqTranslator";
|
|
13
14
|
import { useSettingsConfigFactory } from "../utils/settingsConfigFactory";
|
|
14
15
|
import type { SettingsConfig, SettingsTranslations } from "../screens/types";
|
|
15
16
|
import type { FeedbackFormData } from "../utils/config-creators";
|
|
16
|
-
import type { AppInfo, FAQData, UserProfileDisplay, AdditionalScreen
|
|
17
|
+
import type { AppInfo, FAQData, UserProfileDisplay, AdditionalScreen } from "../navigation/types";
|
|
18
|
+
import type { AccountScreenConfig } from "@umituz/react-native-auth";
|
|
17
19
|
|
|
18
20
|
export interface SettingsFeatures {
|
|
19
21
|
notifications?: boolean;
|
|
@@ -29,18 +31,6 @@ export interface SettingsFeatures {
|
|
|
29
31
|
subscription?: boolean;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
/** Optional auth data - provide this if your app uses @umituz/react-native-auth */
|
|
33
|
-
export interface AuthData {
|
|
34
|
-
user: { displayName?: string | null; uid?: string; isAnonymous?: boolean; photoURL?: string | null } | null;
|
|
35
|
-
loading: boolean;
|
|
36
|
-
isAuthReady: boolean;
|
|
37
|
-
userProfileData: { displayName?: string; userId?: string; avatarUrl?: string } | null;
|
|
38
|
-
handleRatePress: () => void;
|
|
39
|
-
handleSignOut: () => Promise<void>;
|
|
40
|
-
handleDeleteAccount: () => Promise<void>;
|
|
41
|
-
handleSignIn: () => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
34
|
export interface UseSettingsScreenConfigParams {
|
|
45
35
|
appInfo: AppInfo;
|
|
46
36
|
faqData?: FAQData;
|
|
@@ -49,38 +39,21 @@ export interface UseSettingsScreenConfigParams {
|
|
|
49
39
|
additionalScreens?: AdditionalScreen[];
|
|
50
40
|
features?: SettingsFeatures;
|
|
51
41
|
translations?: SettingsTranslations;
|
|
52
|
-
/** Auth data - optional. For apps with auth, provide this or use '@umituz/react-native-settings/account' */
|
|
53
|
-
authData?: AuthData;
|
|
54
42
|
}
|
|
55
43
|
|
|
56
44
|
export interface SettingsScreenConfigResult {
|
|
57
45
|
settingsConfig: SettingsConfig;
|
|
58
46
|
userProfile: UserProfileDisplay;
|
|
59
|
-
accountConfig:
|
|
47
|
+
accountConfig: AccountScreenConfig;
|
|
60
48
|
translatedFaqData: FAQData | undefined;
|
|
61
49
|
isLoading: boolean;
|
|
62
50
|
isAuthReady: boolean;
|
|
63
51
|
}
|
|
64
52
|
|
|
65
|
-
/** Default auth state for apps without authentication */
|
|
66
|
-
const DEFAULT_AUTH: AuthData = {
|
|
67
|
-
user: null,
|
|
68
|
-
loading: false,
|
|
69
|
-
isAuthReady: true,
|
|
70
|
-
userProfileData: null,
|
|
71
|
-
handleRatePress: () => {},
|
|
72
|
-
handleSignOut: async () => {},
|
|
73
|
-
handleDeleteAccount: async () => {},
|
|
74
|
-
handleSignIn: () => {},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
53
|
export const useSettingsScreenConfig = (
|
|
78
54
|
params: UseSettingsScreenConfigParams
|
|
79
55
|
): SettingsScreenConfigResult => {
|
|
80
|
-
const { appInfo, faqData, isPremium, onFeedbackSubmit, features = {}, translations
|
|
81
|
-
|
|
82
|
-
const auth = authData || DEFAULT_AUTH;
|
|
83
|
-
const { user, loading, isAuthReady, userProfileData, handleRatePress, handleSignOut, handleDeleteAccount, handleSignIn } = auth;
|
|
56
|
+
const { appInfo, faqData, isPremium, onFeedbackSubmit, features = {}, translations } = params;
|
|
84
57
|
|
|
85
58
|
const {
|
|
86
59
|
notifications: showNotifications = true,
|
|
@@ -96,6 +69,13 @@ export const useSettingsScreenConfig = (
|
|
|
96
69
|
subscription: showSubscription = true,
|
|
97
70
|
} = features;
|
|
98
71
|
|
|
72
|
+
const { user, loading, isAuthReady } = useAuth();
|
|
73
|
+
const userProfileData = useUserProfile({});
|
|
74
|
+
|
|
75
|
+
// Use centralized auth handlers
|
|
76
|
+
const { handleRatePress, handleSignOut, handleDeleteAccount, handleSignIn } =
|
|
77
|
+
useAuthHandlers(appInfo, translations?.errors);
|
|
78
|
+
|
|
99
79
|
// Use settings config factory
|
|
100
80
|
const baseSettingsConfig = useSettingsConfigFactory({
|
|
101
81
|
onFeedbackSubmit,
|
|
@@ -156,26 +136,21 @@ export const useSettingsScreenConfig = (
|
|
|
156
136
|
}, [baseSettingsConfig, translations]);
|
|
157
137
|
|
|
158
138
|
const userProfile = useMemo(() => createUserProfileDisplay({
|
|
159
|
-
profileData: userProfileData
|
|
139
|
+
profileData: userProfileData,
|
|
160
140
|
onSignIn: handleSignIn,
|
|
161
141
|
}), [userProfileData, handleSignIn]);
|
|
162
142
|
|
|
163
|
-
const accountConfig = useMemo(() => {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
onLogout: handleSignOut,
|
|
175
|
-
onDeleteAccount: handleDeleteAccount,
|
|
176
|
-
translations: translations?.account as any,
|
|
177
|
-
});
|
|
178
|
-
}, [authData, user, userProfileData, handleSignIn, handleSignOut, handleDeleteAccount, translations]);
|
|
143
|
+
const accountConfig = useMemo(() => createAccountConfig({
|
|
144
|
+
displayName: userProfileData?.displayName || user?.displayName || undefined,
|
|
145
|
+
userId: userProfileData?.userId || user?.uid || undefined,
|
|
146
|
+
photoURL: user?.photoURL || undefined,
|
|
147
|
+
isAnonymous: user?.isAnonymous,
|
|
148
|
+
avatarUrl: userProfileData?.avatarUrl,
|
|
149
|
+
onSignIn: handleSignIn,
|
|
150
|
+
onLogout: handleSignOut,
|
|
151
|
+
onDeleteAccount: handleDeleteAccount,
|
|
152
|
+
translations: translations?.account as any,
|
|
153
|
+
}), [user, userProfileData, handleSignIn, handleSignOut, handleDeleteAccount, translations]);
|
|
179
154
|
|
|
180
155
|
const translatedFaqData = useMemo(() =>
|
|
181
156
|
translateFAQData(faqData, appInfo),
|
|
@@ -6,10 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
|
-
import {
|
|
10
|
-
StackNavigator,
|
|
11
|
-
type StackNavigatorConfig,
|
|
12
|
-
} from "@umituz/react-native-design-system";
|
|
9
|
+
import { StackNavigator, type StackNavigatorConfig } from "@umituz/react-native-design-system/molecules";
|
|
13
10
|
import { useNavigationHandlers, useSettingsScreens } from "./hooks";
|
|
14
11
|
import {
|
|
15
12
|
createNotificationTranslations,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import type { StackScreen } from "@umituz/react-native-design-system";
|
|
2
|
+
import type { StackScreen } from "@umituz/react-native-design-system/molecules";
|
|
3
3
|
import { LanguageSelectionScreen } from "../../../domains/localization";
|
|
4
4
|
import { NotificationSettingsScreen } from "../../../domains/notifications";
|
|
5
|
+
import { AccountScreen } from "@umituz/react-native-auth";
|
|
5
6
|
import { SettingsScreen } from "../../screens/SettingsScreen";
|
|
6
7
|
import { AppearanceScreen } from "../../screens/AppearanceScreen";
|
|
7
8
|
import { FAQScreen } from "../../../domains/faqs";
|
|
@@ -28,8 +29,6 @@ export interface UseSettingsScreensProps extends SettingsStackNavigatorProps {
|
|
|
28
29
|
legalProps: LegalScreenProps;
|
|
29
30
|
notificationTranslations: NotificationSettingsTranslations;
|
|
30
31
|
quietHoursTranslations: QuietHoursTranslations;
|
|
31
|
-
/** Optional AccountScreen component from @umituz/react-native-auth. If not provided, account screen is skipped. */
|
|
32
|
-
AccountScreenComponent?: React.ComponentType<any>;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
export const useSettingsScreens = (props: UseSettingsScreensProps): StackScreen[] => {
|
|
@@ -52,8 +51,6 @@ export const useSettingsScreens = (props: UseSettingsScreensProps): StackScreen[
|
|
|
52
51
|
gamificationConfig,
|
|
53
52
|
videoTutorialConfig,
|
|
54
53
|
accountConfig,
|
|
55
|
-
AccountScreenComponent,
|
|
56
|
-
ProfileSectionComponent,
|
|
57
54
|
} = props;
|
|
58
55
|
|
|
59
56
|
const translations = config?.translations?.features;
|
|
@@ -72,7 +69,6 @@ export const useSettingsScreens = (props: UseSettingsScreensProps): StackScreen[
|
|
|
72
69
|
showHeader,
|
|
73
70
|
showCloseButton,
|
|
74
71
|
onClose,
|
|
75
|
-
ProfileSectionComponent,
|
|
76
72
|
}
|
|
77
73
|
);
|
|
78
74
|
|
|
@@ -123,8 +119,8 @@ export const useSettingsScreens = (props: UseSettingsScreensProps): StackScreen[
|
|
|
123
119
|
});
|
|
124
120
|
|
|
125
121
|
const accountScreen = createConditionalScreen(
|
|
126
|
-
!!
|
|
127
|
-
() => createScreenWithProps("Account",
|
|
122
|
+
!!accountConfig,
|
|
123
|
+
() => createScreenWithProps("Account", AccountScreen as any, { config: accountConfig })
|
|
128
124
|
);
|
|
129
125
|
|
|
130
126
|
const videoTutorialScreen = createScreenWithProps("VideoTutorial", VideoTutorialsScreen as any, {
|
|
@@ -88,41 +88,11 @@ export interface FAQData {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
* Compatible with @umituz/react-native-auth's AccountScreenConfig
|
|
91
|
+
* Import AccountScreenConfig from auth package
|
|
93
92
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
userId?: string;
|
|
98
|
-
isAnonymous: boolean;
|
|
99
|
-
avatarUrl?: string;
|
|
100
|
-
accountSettingsRoute?: string;
|
|
101
|
-
benefits?: string[];
|
|
102
|
-
};
|
|
103
|
-
accountActions?: {
|
|
104
|
-
logoutText: string;
|
|
105
|
-
deleteAccountText: string;
|
|
106
|
-
changePasswordText?: string;
|
|
107
|
-
logoutConfirmTitle: string;
|
|
108
|
-
logoutConfirmMessage: string;
|
|
109
|
-
deleteConfirmTitle: string;
|
|
110
|
-
deleteConfirmMessage: string;
|
|
111
|
-
deleteErrorTitle?: string;
|
|
112
|
-
deleteErrorMessage?: string;
|
|
113
|
-
cancelText: string;
|
|
114
|
-
onLogout: () => Promise<void>;
|
|
115
|
-
onDeleteAccount: () => Promise<void>;
|
|
116
|
-
onChangePassword?: () => void;
|
|
117
|
-
showChangePassword?: boolean;
|
|
118
|
-
};
|
|
119
|
-
isAnonymous: boolean;
|
|
120
|
-
editProfileText?: string;
|
|
121
|
-
onEditProfile?: () => void;
|
|
122
|
-
onSignIn?: () => void;
|
|
123
|
-
title?: string;
|
|
124
|
-
PasswordPromptComponent?: React.ReactNode;
|
|
125
|
-
}
|
|
93
|
+
import type { AccountScreenConfig } from "@umituz/react-native-auth";
|
|
94
|
+
|
|
95
|
+
export type AccountConfig = AccountScreenConfig;
|
|
126
96
|
|
|
127
97
|
/**
|
|
128
98
|
* Settings Stack Navigator Props
|
|
@@ -145,8 +115,4 @@ export interface SettingsStackNavigatorProps {
|
|
|
145
115
|
onClose?: () => void;
|
|
146
116
|
gamificationConfig?: import("../../domains/gamification").GamificationSettingsConfig;
|
|
147
117
|
videoTutorialConfig?: import("../../domains/video-tutorials").VideoTutorialsScreenProps;
|
|
148
|
-
/** Injected AccountScreen component from @umituz/react-native-auth (via account subpath). If not provided, account screen is not registered. */
|
|
149
|
-
AccountScreenComponent?: React.ComponentType<any>;
|
|
150
|
-
/** Injected ProfileSection component from @umituz/react-native-auth (via account subpath). If not provided, profile section is not rendered. */
|
|
151
|
-
ProfileSectionComponent?: React.ComponentType<any>;
|
|
152
118
|
}
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import {
|
|
8
|
-
ScreenLayout,
|
|
9
|
-
} from "@umituz/react-native-design-system";
|
|
7
|
+
import { ScreenLayout } from "@umituz/react-native-design-system/layouts";
|
|
10
8
|
import { useSettingsScreen } from "./hooks/useSettingsScreen";
|
|
11
9
|
import { SettingsHeader } from "./components/SettingsHeader";
|
|
12
10
|
import { SettingsContent } from "./components/SettingsContent";
|
|
@@ -53,8 +51,6 @@ export interface SettingsScreenProps {
|
|
|
53
51
|
showHeader?: boolean;
|
|
54
52
|
/** Password prompt modal component */
|
|
55
53
|
PasswordPromptComponent?: React.ReactNode;
|
|
56
|
-
/** Injected ProfileSection component from @umituz/react-native-auth (via account subpath) */
|
|
57
|
-
ProfileSectionComponent?: React.ComponentType<any>;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
export const SettingsScreen: React.FC<SettingsScreenProps> = (props) => {
|
|
@@ -74,7 +70,6 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = (props) => {
|
|
|
74
70
|
devSettings,
|
|
75
71
|
gamificationConfig,
|
|
76
72
|
PasswordPromptComponent,
|
|
77
|
-
ProfileSectionComponent,
|
|
78
73
|
} = props;
|
|
79
74
|
|
|
80
75
|
const {
|
|
@@ -114,7 +109,6 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = (props) => {
|
|
|
114
109
|
customSections={customSections}
|
|
115
110
|
devSettings={devSettings}
|
|
116
111
|
gamificationConfig={gamificationConfig}
|
|
117
|
-
ProfileSectionComponent={ProfileSectionComponent}
|
|
118
112
|
/>
|
|
119
113
|
)}
|
|
120
114
|
</ScreenLayout>
|
|
@@ -29,7 +29,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
29
29
|
emptyStateText,
|
|
30
30
|
devSettings,
|
|
31
31
|
gamificationConfig,
|
|
32
|
-
ProfileSectionComponent,
|
|
33
32
|
}) => {
|
|
34
33
|
const translations = normalizedConfig.translations;
|
|
35
34
|
const { level } = useGamification(gamificationConfig);
|
|
@@ -49,10 +48,9 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
49
48
|
return (
|
|
50
49
|
<View style={styles.container}>
|
|
51
50
|
{showUserProfile && (
|
|
52
|
-
<ProfileSectionLoader
|
|
53
|
-
userProfile={userProfile}
|
|
51
|
+
<ProfileSectionLoader
|
|
52
|
+
userProfile={userProfile}
|
|
54
53
|
translations={translations?.profile}
|
|
55
|
-
ProfileSectionComponent={ProfileSectionComponent}
|
|
56
54
|
/>
|
|
57
55
|
)}
|
|
58
56
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Pressable } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { AtomicIcon } from "@umituz/react-native-design-system/atoms";
|
|
4
|
+
import { useAppNavigation, NavigationHeader } from "@umituz/react-native-design-system/molecules";
|
|
5
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
interface SettingsHeaderProps {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { ProfileSection } from "@umituz/react-native-auth";
|
|
4
|
+
import { useAppNavigation } from "@umituz/react-native-design-system/molecules";
|
|
4
5
|
|
|
5
6
|
export interface ProfileSectionLoaderProps {
|
|
6
7
|
userProfile?: {
|
|
@@ -16,11 +17,9 @@ export interface ProfileSectionLoaderProps {
|
|
|
16
17
|
anonymousName?: string;
|
|
17
18
|
signIn?: string;
|
|
18
19
|
};
|
|
19
|
-
/** Injected ProfileSection component from @umituz/react-native-auth (via account subpath) */
|
|
20
|
-
ProfileSectionComponent?: React.ComponentType<any>;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
export const ProfileSectionLoader: React.FC<ProfileSectionLoaderProps> = React.memo(({ userProfile, translations
|
|
22
|
+
export const ProfileSectionLoader: React.FC<ProfileSectionLoaderProps> = React.memo(({ userProfile, translations }) => {
|
|
24
23
|
const navigation = useAppNavigation();
|
|
25
24
|
|
|
26
25
|
const handlePress = React.useCallback(() => {
|
|
@@ -37,11 +36,11 @@ export const ProfileSectionLoader: React.FC<ProfileSectionLoaderProps> = React.m
|
|
|
37
36
|
return translations?.anonymousName || "";
|
|
38
37
|
}, [translations]);
|
|
39
38
|
|
|
40
|
-
if (!userProfile
|
|
39
|
+
if (!userProfile) return null;
|
|
41
40
|
|
|
42
41
|
return (
|
|
43
42
|
<View style={styles.profileContainer}>
|
|
44
|
-
<
|
|
43
|
+
<ProfileSection
|
|
45
44
|
profile={{
|
|
46
45
|
displayName: userProfile.displayName || anonymousDisplayName,
|
|
47
46
|
userId: userProfile.userId,
|
|
@@ -57,7 +56,7 @@ export const ProfileSectionLoader: React.FC<ProfileSectionLoaderProps> = React.m
|
|
|
57
56
|
/>
|
|
58
57
|
</View>
|
|
59
58
|
);
|
|
60
|
-
}, (prev, next) => prev.userProfile === next.userProfile && prev.translations === next.translations
|
|
59
|
+
}, (prev, next) => prev.userProfile === next.userProfile && prev.translations === next.translations);
|
|
61
60
|
|
|
62
61
|
ProfileSectionLoader.displayName = "ProfileSectionLoader";
|
|
63
62
|
|
|
@@ -48,6 +48,4 @@ export interface SettingsContentProps {
|
|
|
48
48
|
emptyStateText?: string;
|
|
49
49
|
devSettings?: DevSettingsProps;
|
|
50
50
|
gamificationConfig?: GamificationSettingsConfig;
|
|
51
|
-
/** Injected ProfileSection component from @umituz/react-native-auth (via account subpath) */
|
|
52
|
-
ProfileSectionComponent?: React.ComponentType<any>;
|
|
53
51
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useMemo, useCallback } from "react";
|
|
7
|
-
import { useAppNavigation } from "@umituz/react-native-design-system";
|
|
7
|
+
import { useAppNavigation } from "@umituz/react-native-design-system/molecules";
|
|
8
8
|
import { normalizeSettingsConfig } from "../utils/normalizeConfig";
|
|
9
9
|
import { useFeatureDetection } from "./useFeatureDetection";
|
|
10
10
|
import { getAppVersion } from "../../../utils/appUtils";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Helper functions for creating account screen configurations.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type { AccountScreenConfig } from "@umituz/react-native-auth";
|
|
8
8
|
|
|
9
9
|
export interface AccountTranslations {
|
|
10
10
|
editProfile?: string;
|