@sincpro/mobile 0.4.2 → 0.4.3
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.
|
@@ -25,6 +25,7 @@ interface ICommonContext {
|
|
|
25
25
|
geoError: string | null;
|
|
26
26
|
checkGeoPermission: () => Promise<void>;
|
|
27
27
|
requestGeoPermission: () => Promise<boolean>;
|
|
28
|
+
locale: string | null;
|
|
28
29
|
timezone: string | null;
|
|
29
30
|
updateTimezone: (tz: TimezoneLocale) => Promise<void>;
|
|
30
31
|
colorScheme: "light" | "dark" | "system";
|
|
@@ -23,6 +23,7 @@ export function CommonProvider({ children, lightTheme, darkTheme }) {
|
|
|
23
23
|
const [hasGeoPermission, setHasGeoPermission] = useState(false);
|
|
24
24
|
const [geoIsLoading, setGeoIsLoading] = useState(false);
|
|
25
25
|
const [geoError, setGeoError] = useState(null);
|
|
26
|
+
const [locale, setLocale] = useState(null);
|
|
26
27
|
const [timezone, setTimezone] = useState(null);
|
|
27
28
|
const [colorScheme, setColorSchemeState] = useState("system");
|
|
28
29
|
const errorTimeoutRef = useRef(null);
|
|
@@ -85,6 +86,7 @@ export function CommonProvider({ children, lightTheme, darkTheme }) {
|
|
|
85
86
|
await SettingsRepository.saveOneSetting(TIMEZONE_SETTING_KEY, tz.timezone);
|
|
86
87
|
await SettingsRepository.saveOneSetting(LOCALE_SETTING_KEY, tz.locale);
|
|
87
88
|
setTimezone(tz.timezone);
|
|
89
|
+
setLocale(tz.locale);
|
|
88
90
|
}
|
|
89
91
|
catch (error) {
|
|
90
92
|
logger.warn(error);
|
|
@@ -127,16 +129,20 @@ export function CommonProvider({ children, lightTheme, darkTheme }) {
|
|
|
127
129
|
return () => sub.remove();
|
|
128
130
|
}, [colorScheme, applyTheme]);
|
|
129
131
|
useEffect(() => {
|
|
130
|
-
async function
|
|
132
|
+
async function loadTimezoneAndLocale() {
|
|
131
133
|
try {
|
|
132
|
-
const timezoneResult = await
|
|
134
|
+
const [timezoneResult, localeResult] = await Promise.all([
|
|
135
|
+
SettingsRepository.getSettingByName(TIMEZONE_SETTING_KEY),
|
|
136
|
+
SettingsRepository.getSettingByName(LOCALE_SETTING_KEY),
|
|
137
|
+
]);
|
|
133
138
|
setTimezone(timezoneResult);
|
|
139
|
+
setLocale(localeResult);
|
|
134
140
|
}
|
|
135
141
|
catch (error) {
|
|
136
|
-
logger.warn("Failed to load timezone", error);
|
|
142
|
+
logger.warn("Failed to load timezone/locale", error);
|
|
137
143
|
}
|
|
138
144
|
}
|
|
139
|
-
|
|
145
|
+
loadTimezoneAndLocale();
|
|
140
146
|
}, []);
|
|
141
147
|
useEffect(() => {
|
|
142
148
|
loggerUseCases.debug("[CommonProvider] Setting up UIEventBus listeners");
|
|
@@ -255,6 +261,7 @@ export function CommonProvider({ children, lightTheme, darkTheme }) {
|
|
|
255
261
|
geoError,
|
|
256
262
|
checkGeoPermission,
|
|
257
263
|
requestGeoPermission,
|
|
264
|
+
locale,
|
|
258
265
|
timezone,
|
|
259
266
|
updateTimezone,
|
|
260
267
|
colorScheme,
|
|
@@ -272,6 +279,7 @@ export function CommonProvider({ children, lightTheme, darkTheme }) {
|
|
|
272
279
|
geoError,
|
|
273
280
|
checkGeoPermission,
|
|
274
281
|
requestGeoPermission,
|
|
282
|
+
locale,
|
|
275
283
|
timezone,
|
|
276
284
|
updateTimezone,
|
|
277
285
|
colorScheme,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/mobile",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Sincpro Mobile framework core: offline-first infra (DB, queue/events, cron), DDD patterns, adapters, AppShell and module-driven composition for React Native",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|