@applicaster/quick-brick-core 14.0.9 → 14.0.10-alpha.5112243140
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.
|
@@ -90,8 +90,13 @@ export function ActionsProvider(props: Props) {
|
|
|
90
90
|
[]
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
+
const contextValue = React.useMemo(
|
|
94
|
+
() => ({ actions: actionPlugins }),
|
|
95
|
+
[actionPlugins]
|
|
96
|
+
);
|
|
97
|
+
|
|
93
98
|
return (
|
|
94
|
-
<ActionsContext.Provider value={
|
|
99
|
+
<ActionsContext.Provider value={contextValue}>
|
|
95
100
|
<Context>{children}</Context>
|
|
96
101
|
</ActionsContext.Provider>
|
|
97
102
|
);
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
partitionByKeys,
|
|
10
10
|
} from "@applicaster/zapp-react-native-utils/objectUtils";
|
|
11
11
|
import { getLocalizations } from "@applicaster/zapp-react-native-utils/appUtils/localizationsHelper";
|
|
12
|
+
import { saveNetworkStatusLocalizations } from "./utils";
|
|
12
13
|
|
|
13
14
|
type Props = {
|
|
14
15
|
children: React.ReactNode;
|
|
@@ -104,6 +105,14 @@ function ThemeManagerComponent({ children, plugins }: Props) {
|
|
|
104
105
|
const [selectedThemeId, setSelectedThemeId] =
|
|
105
106
|
React.useState(DEFAULT_THEME_ID);
|
|
106
107
|
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
const selectedTheme = themes[selectedThemeId];
|
|
110
|
+
|
|
111
|
+
if (selectedTheme) {
|
|
112
|
+
saveNetworkStatusLocalizations(selectedTheme);
|
|
113
|
+
}
|
|
114
|
+
}, [themes, selectedThemeId]);
|
|
115
|
+
|
|
107
116
|
return (
|
|
108
117
|
<MemoizedThemeContextProvider
|
|
109
118
|
themes={themes}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
|
|
2
|
+
|
|
3
|
+
const NETWORK_STATUS_LOCALIZATIONS_KEY = "network_status_localizations";
|
|
4
|
+
const THEME_STORAGE_NAMESPACE = "quick-brick-theme";
|
|
5
|
+
|
|
6
|
+
const DEFAULT_NETWORK_STATUS_LOCALIZATIONS: Record<string, string> = {
|
|
7
|
+
offline_notification_title: "No internet connection",
|
|
8
|
+
offline_notification_subtitle: "Please check your connection",
|
|
9
|
+
online_notification_title: "You are back online",
|
|
10
|
+
online_notification_subtitle: "Feel free to continue where you left off",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const NETWORK_STATUS_KEYS = Object.keys(
|
|
14
|
+
DEFAULT_NETWORK_STATUS_LOCALIZATIONS
|
|
15
|
+
) as (keyof typeof DEFAULT_NETWORK_STATUS_LOCALIZATIONS)[];
|
|
16
|
+
|
|
17
|
+
export async function saveNetworkStatusLocalizations(
|
|
18
|
+
themeOrLocalizations: Record<string, unknown>
|
|
19
|
+
) {
|
|
20
|
+
try {
|
|
21
|
+
const storedLocalizations = await sessionStorage.getItem(
|
|
22
|
+
NETWORK_STATUS_LOCALIZATIONS_KEY,
|
|
23
|
+
THEME_STORAGE_NAMESPACE
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (storedLocalizations) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const networkStatusLocalizations = NETWORK_STATUS_KEYS.reduce(
|
|
31
|
+
(acc, key) => {
|
|
32
|
+
const value = themeOrLocalizations[key];
|
|
33
|
+
|
|
34
|
+
acc[key] =
|
|
35
|
+
typeof value === "string"
|
|
36
|
+
? value
|
|
37
|
+
: DEFAULT_NETWORK_STATUS_LOCALIZATIONS[key];
|
|
38
|
+
|
|
39
|
+
return acc;
|
|
40
|
+
},
|
|
41
|
+
{} as Record<string, string>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (Object.keys(networkStatusLocalizations).length > 0) {
|
|
45
|
+
await sessionStorage.setItem(
|
|
46
|
+
NETWORK_STATUS_LOCALIZATIONS_KEY,
|
|
47
|
+
JSON.stringify(networkStatusLocalizations),
|
|
48
|
+
THEME_STORAGE_NAMESPACE
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error("Error saving network status localizations", error);
|
|
53
|
+
}
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.10-alpha.5112243140",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "14.0.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "14.0.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "14.0.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "14.0.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "14.0.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "14.0.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "14.0.
|
|
31
|
+
"@applicaster/applicaster-types": "14.0.10-alpha.5112243140",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "14.0.10-alpha.5112243140",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "14.0.10-alpha.5112243140",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "14.0.10-alpha.5112243140",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "14.0.10-alpha.5112243140",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "14.0.10-alpha.5112243140",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "14.0.10-alpha.5112243140",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|