@edge-zuq/core 1.4.1 → 1.4.2
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/lib/module/presentation/components/organisms/UIAppUpdateAlert.js +14 -2
- package/lib/module/presentation/components/organisms/UIAppUpdateAlert.js.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/UIAppUpdateAlert.d.ts +3 -2
- package/lib/typescript/src/presentation/components/organisms/UIAppUpdateAlert.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/presentation/components/organisms/UIAppUpdateAlert.tsx +19 -3
|
@@ -4,12 +4,13 @@ import React from 'react';
|
|
|
4
4
|
import { useActionSheet } from "../../domain/utils/index.js";
|
|
5
5
|
import { UIIcon, UIStack, UIText } from "../atoms/index.js";
|
|
6
6
|
import { UIActionSheet, UIButton } from "../molecules/index.js";
|
|
7
|
-
import { StyleSheet } from 'react-native';
|
|
7
|
+
import { Linking, Platform, StyleSheet } from 'react-native';
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
export const UIAppUpdateAlert = ({
|
|
10
10
|
currentVersion,
|
|
11
11
|
expectedVersion,
|
|
12
|
-
|
|
12
|
+
androidUrl,
|
|
13
|
+
iosUrl
|
|
13
14
|
}) => {
|
|
14
15
|
const {
|
|
15
16
|
visible,
|
|
@@ -22,6 +23,17 @@ export const UIAppUpdateAlert = ({
|
|
|
22
23
|
const shouldUpdate = parsedCurrentVersion < parsedExpectedVersion;
|
|
23
24
|
if (shouldUpdate) onOpen();
|
|
24
25
|
}, [currentVersion, expectedVersion, onOpen]);
|
|
26
|
+
const onUpdate = async () => {
|
|
27
|
+
const canOpenUrlOnAndroid = Platform.OS === 'android' && (await Linking.canOpenURL(androidUrl));
|
|
28
|
+
const canOpenUrlOnIOS = Platform.OS === 'ios' && (await Linking.canOpenURL(iosUrl));
|
|
29
|
+
const canOpen = !canOpenUrlOnAndroid && !canOpenUrlOnIOS;
|
|
30
|
+
if (!canOpen) return;
|
|
31
|
+
if (canOpenUrlOnAndroid) {
|
|
32
|
+
await Linking.openURL(androidUrl);
|
|
33
|
+
} else if (canOpenUrlOnIOS) {
|
|
34
|
+
await Linking.openURL(iosUrl);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
25
37
|
return /*#__PURE__*/_jsx(UIActionSheet, {
|
|
26
38
|
visible: visible,
|
|
27
39
|
onRequestClose: onClose,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useActionSheet","UIIcon","UIStack","UIText","UIActionSheet","UIButton","StyleSheet","jsx","_jsx","jsxs","_jsxs","UIAppUpdateAlert","currentVersion","expectedVersion","
|
|
1
|
+
{"version":3,"names":["React","useActionSheet","UIIcon","UIStack","UIText","UIActionSheet","UIButton","Linking","Platform","StyleSheet","jsx","_jsx","jsxs","_jsxs","UIAppUpdateAlert","currentVersion","expectedVersion","androidUrl","iosUrl","visible","onClose","onOpen","useEffect","parsedCurrentVersion","Number","replace","parsedExpectedVersion","shouldUpdate","onUpdate","canOpenUrlOnAndroid","OS","canOpenURL","canOpenUrlOnIOS","canOpen","openURL","onRequestClose","title","estimatedHeight","children","size","style","styles","content","align","onPress","horizontal","center","justify","weight","name","create","marginTop"],"sourceRoot":"../../../../../src","sources":["presentation/components/organisms/UIAppUpdateAlert.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,6BAAoB;AACnD,SAASC,MAAM,EAAEC,OAAO,EAAEC,MAAM,QAAQ,mBAAU;AAClD,SAASC,aAAa,EAAEC,QAAQ,QAAQ,uBAAc;AACtD,SAASC,OAAO,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS7D,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,cAAc;EACdC,eAAe;EACfC,UAAU;EACVC;AACK,CAAC,KAAK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C,IAAI,EAAC,IAAI;MAAAD,QAAA,gBAChBzB,KAAA,CAACV,OAAO;QAACqC,KAAK,EAAEC,MAAM,CAACC,OAAQ;QAAAJ,QAAA,gBAC7B3B,IAAA,CAACP,MAAM;UAACuC,KAAK,EAAC,QAAQ;UAAAL,QAAA,EAAC;QAEvB,CAAQ,CAAC,eACT3B,IAAA,CAACP,MAAM;UAACuC,KAAK,EAAC,QAAQ;UAAAL,QAAA,EAAC;QAAmC,CAAQ,CAAC;MAAA,CAC5D,CAAC,eACV3B,IAAA,CAACL,QAAQ;QAACsC,OAAO,EAAEhB,QAAS;QAAAU,QAAA,eAC1BzB,KAAA,CAACV,OAAO;UAAC0C,UAAU;UAACC,MAAM;UAACP,IAAI,EAAC,IAAI;UAACQ,OAAO,EAAC,QAAQ;UAAAT,QAAA,gBACnD3B,IAAA,CAACP,MAAM;YAAC4C,MAAM,EAAC,KAAK;YAAAV,QAAA,EAAC;UAAe,CAAQ,CAAC,eAC7C3B,IAAA,CAACT,MAAM;YAAC+C,IAAI,EAAC;UAAe,CAAE,CAAC;QAAA,CACxB;MAAC,CACF,CAAC;IAAA,CACJ;EAAC,CACG,CAAC;AAEpB,CAAC;AAED,MAAMR,MAAM,GAAGhC,UAAU,CAACyC,MAAM,CAAC;EAC/BR,OAAO,EAAE;IACPS,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
type Props = {
|
|
2
2
|
currentVersion: string;
|
|
3
3
|
expectedVersion: string;
|
|
4
|
-
|
|
4
|
+
androidUrl: string;
|
|
5
|
+
iosUrl: string;
|
|
5
6
|
};
|
|
6
|
-
export declare const UIAppUpdateAlert: ({ currentVersion, expectedVersion,
|
|
7
|
+
export declare const UIAppUpdateAlert: ({ currentVersion, expectedVersion, androidUrl, iosUrl, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=UIAppUpdateAlert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIAppUpdateAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/organisms/UIAppUpdateAlert.tsx"],"names":[],"mappings":"AAMA,KAAK,KAAK,GAAG;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,
|
|
1
|
+
{"version":3,"file":"UIAppUpdateAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/organisms/UIAppUpdateAlert.tsx"],"names":[],"mappings":"AAMA,KAAK,KAAK,GAAG;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,0DAK9B,KAAK,4CA8CP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edge-zuq/core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "ZUQ App core components",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"start": "yarn workspace storybook start",
|
|
36
36
|
"android": "yarn workspace storybook android",
|
|
37
37
|
"ios": "yarn workspace storybook ios",
|
|
38
|
-
"bundle": "yarn prepare && yarn pack --filename zuq-core-1.4.
|
|
38
|
+
"bundle": "yarn prepare && yarn pack --filename zuq-core-1.4.2-local.tgz",
|
|
39
39
|
"clean": "del-cli lib",
|
|
40
40
|
"prepare": "bob build",
|
|
41
41
|
"typecheck": "tsc",
|
|
@@ -2,18 +2,20 @@ import React from 'react';
|
|
|
2
2
|
import { useActionSheet } from '../../domain/utils';
|
|
3
3
|
import { UIIcon, UIStack, UIText } from '../atoms';
|
|
4
4
|
import { UIActionSheet, UIButton } from '../molecules';
|
|
5
|
-
import { StyleSheet } from 'react-native';
|
|
5
|
+
import { Linking, Platform, StyleSheet } from 'react-native';
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
currentVersion: string;
|
|
9
9
|
expectedVersion: string;
|
|
10
|
-
|
|
10
|
+
androidUrl: string;
|
|
11
|
+
iosUrl: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export const UIAppUpdateAlert = ({
|
|
14
15
|
currentVersion,
|
|
15
16
|
expectedVersion,
|
|
16
|
-
|
|
17
|
+
androidUrl,
|
|
18
|
+
iosUrl,
|
|
17
19
|
}: Props) => {
|
|
18
20
|
const { visible, onClose, onOpen } = useActionSheet();
|
|
19
21
|
|
|
@@ -24,6 +26,20 @@ export const UIAppUpdateAlert = ({
|
|
|
24
26
|
if (shouldUpdate) onOpen();
|
|
25
27
|
}, [currentVersion, expectedVersion, onOpen]);
|
|
26
28
|
|
|
29
|
+
const onUpdate = async () => {
|
|
30
|
+
const canOpenUrlOnAndroid =
|
|
31
|
+
Platform.OS === 'android' && (await Linking.canOpenURL(androidUrl));
|
|
32
|
+
const canOpenUrlOnIOS =
|
|
33
|
+
Platform.OS === 'ios' && (await Linking.canOpenURL(iosUrl));
|
|
34
|
+
const canOpen = !canOpenUrlOnAndroid && !canOpenUrlOnIOS;
|
|
35
|
+
if (!canOpen) return;
|
|
36
|
+
if (canOpenUrlOnAndroid) {
|
|
37
|
+
await Linking.openURL(androidUrl);
|
|
38
|
+
} else if (canOpenUrlOnIOS) {
|
|
39
|
+
await Linking.openURL(iosUrl);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
27
43
|
return (
|
|
28
44
|
<UIActionSheet
|
|
29
45
|
visible={visible}
|