@umituz/react-native-settings 5.2.41 → 5.2.43
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.43",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -40,12 +40,22 @@ export async function setEventCount(eventType: string, count: number): Promise<v
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Per-eventType locks to prevent concurrent read-modify-write races in incrementEventCount
|
|
44
|
+
const incrementLocks = new Map<string, Promise<void>>();
|
|
45
|
+
|
|
43
46
|
/**
|
|
44
|
-
* Increment event count for specific event type
|
|
47
|
+
* Increment event count for specific event type.
|
|
48
|
+
* Chains operations per-key to prevent concurrent read-modify-write races.
|
|
45
49
|
*/
|
|
46
50
|
export async function incrementEventCount(eventType: string): Promise<void> {
|
|
47
|
-
const
|
|
48
|
-
|
|
51
|
+
const prevLock = incrementLocks.get(eventType) ?? Promise.resolve();
|
|
52
|
+
const nextLock = prevLock.then(async () => {
|
|
53
|
+
const currentCount = await getEventCount(eventType);
|
|
54
|
+
await setEventCount(eventType, currentCount + 1);
|
|
55
|
+
});
|
|
56
|
+
// Store the lock that absorbs errors so the chain stays alive for future calls
|
|
57
|
+
incrementLocks.set(eventType, nextLock.catch(() => {}));
|
|
58
|
+
return nextLock;
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
/**
|
|
@@ -152,9 +152,9 @@ export const useSettingsScreenConfig = (
|
|
|
152
152
|
translations: translations?.account as any,
|
|
153
153
|
}), [user, userProfileData, handleSignIn, handleSignOut, handleDeleteAccount, translations]);
|
|
154
154
|
|
|
155
|
-
//
|
|
155
|
+
// FAQ data passed through as-is (app sends pre-translated data)
|
|
156
156
|
const translatedFaqData = useMemo(() =>
|
|
157
|
-
translateFAQData(faqData,
|
|
157
|
+
translateFAQData(faqData, appInfo),
|
|
158
158
|
[faqData, appInfo]
|
|
159
159
|
);
|
|
160
160
|
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FAQ Translation Utility
|
|
3
|
-
*
|
|
3
|
+
* App sends pre-translated FAQ data - this function passes it through unchanged.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
import type { FAQData } from "../navigation/types";
|
|
8
7
|
import type { AppInfo } from "../navigation/types";
|
|
9
|
-
import type { TranslationOptions } from "./config-creators/types";
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Passes FAQ data through unchanged.
|
|
11
|
+
* The main app is responsible for translating FAQ keys before passing them here.
|
|
14
12
|
*/
|
|
15
13
|
export const translateFAQData = (
|
|
16
14
|
faqData: FAQData | undefined,
|
|
17
|
-
_t: (key: string, params?: TranslationOptions) => string,
|
|
18
15
|
_appInfo: AppInfo
|
|
19
16
|
): FAQData | undefined => {
|
|
20
17
|
return faqData;
|