@apps-in-toss/framework 1.4.6 → 1.4.8
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/dist/index.cjs +75 -29
- package/dist/index.js +63 -17
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -1377,10 +1377,11 @@ var import_native_modules18 = require("@apps-in-toss/native-modules");
|
|
|
1377
1377
|
var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
|
|
1378
1378
|
var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
|
|
1379
1379
|
var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
|
|
1380
|
+
var import_react_native_safe_area_context4 = require("@granite-js/native/react-native-safe-area-context");
|
|
1380
1381
|
var import_react_native32 = require("@granite-js/react-native");
|
|
1381
1382
|
var import_tds_react_native14 = require("@toss/tds-react-native");
|
|
1382
1383
|
var import_private9 = require("@toss/tds-react-native/private");
|
|
1383
|
-
var
|
|
1384
|
+
var import_react29 = require("react");
|
|
1384
1385
|
var import_react_native33 = require("react-native");
|
|
1385
1386
|
|
|
1386
1387
|
// src/components/GameWebView.tsx
|
|
@@ -1609,6 +1610,9 @@ function useBridgeHandler({
|
|
|
1609
1610
|
)};`,
|
|
1610
1611
|
[constantHandlerMap]
|
|
1611
1612
|
);
|
|
1613
|
+
(0, import_react23.useEffect)(() => {
|
|
1614
|
+
ref.current?.injectJavaScript(injectedJavaScript);
|
|
1615
|
+
}, [injectedJavaScript]);
|
|
1612
1616
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
1613
1617
|
ref.current?.injectJavaScript(`
|
|
1614
1618
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
@@ -1678,14 +1682,50 @@ function parseNativeEventData(data) {
|
|
|
1678
1682
|
}
|
|
1679
1683
|
}
|
|
1680
1684
|
|
|
1685
|
+
// src/core/hooks/useSafeAreaInsetsEmitter.tsx
|
|
1686
|
+
var import_react_native_safe_area_context3 = require("@granite-js/native/react-native-safe-area-context");
|
|
1687
|
+
var import_react24 = require("react");
|
|
1688
|
+
var EventEmitter = class {
|
|
1689
|
+
listeners = {};
|
|
1690
|
+
on(event, listener) {
|
|
1691
|
+
if (!this.listeners[event]) {
|
|
1692
|
+
this.listeners[event] = [];
|
|
1693
|
+
}
|
|
1694
|
+
this.listeners[event].push(listener);
|
|
1695
|
+
}
|
|
1696
|
+
emit(event, ...args) {
|
|
1697
|
+
if (!this.listeners[event]) {
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
this.listeners[event].forEach((listener) => listener(...args));
|
|
1701
|
+
}
|
|
1702
|
+
off(event, listener) {
|
|
1703
|
+
if (!this.listeners[event]) {
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
this.listeners[event] = this.listeners[event].filter((l) => l !== listener);
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
function useSafeAreaInsetsEmitter() {
|
|
1710
|
+
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
1711
|
+
const emitter = (0, import_react24.useMemo)(() => new EventEmitter(), []);
|
|
1712
|
+
(0, import_react24.useEffect)(() => {
|
|
1713
|
+
emitter.emit("safeAreaInsetsChange", insets);
|
|
1714
|
+
return () => {
|
|
1715
|
+
emitter.off("safeAreaInsetsChange", (listener) => listener(insets));
|
|
1716
|
+
};
|
|
1717
|
+
}, [emitter, insets]);
|
|
1718
|
+
return emitter;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1681
1721
|
// src/core/hooks/useWebBackHandler.tsx
|
|
1682
1722
|
var import_react_native27 = require("@granite-js/react-native");
|
|
1683
1723
|
var import_tds_react_native13 = require("@toss/tds-react-native");
|
|
1684
1724
|
var import_es_hangul5 = require("es-hangul");
|
|
1685
|
-
var
|
|
1725
|
+
var import_react26 = require("react");
|
|
1686
1726
|
|
|
1687
1727
|
// src/hooks/useWebviewHistoryStack.tsx
|
|
1688
|
-
var
|
|
1728
|
+
var import_react25 = require("react");
|
|
1689
1729
|
var INITIAL_STATE = { stack: [], index: -1 };
|
|
1690
1730
|
function reducer(state, action) {
|
|
1691
1731
|
switch (action.type) {
|
|
@@ -1716,11 +1756,11 @@ function reducer(state, action) {
|
|
|
1716
1756
|
}
|
|
1717
1757
|
}
|
|
1718
1758
|
function useWebViewHistory() {
|
|
1719
|
-
const [state, dispatch] = (0,
|
|
1720
|
-
const onNavigationStateChange = (0,
|
|
1759
|
+
const [state, dispatch] = (0, import_react25.useReducer)(reducer, INITIAL_STATE);
|
|
1760
|
+
const onNavigationStateChange = (0, import_react25.useCallback)(({ url, canGoForward: canGoForward2 }) => {
|
|
1721
1761
|
dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
|
|
1722
1762
|
}, []);
|
|
1723
|
-
const { canGoBack, canGoForward } = (0,
|
|
1763
|
+
const { canGoBack, canGoForward } = (0, import_react25.useMemo)(() => {
|
|
1724
1764
|
const canBack = state.index > 0;
|
|
1725
1765
|
const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
|
|
1726
1766
|
return { canGoBack: canBack, canGoForward: canFwd };
|
|
@@ -1753,19 +1793,19 @@ function useWebBackHandler(webViewRef) {
|
|
|
1753
1793
|
const logging = useNavigationBarLogging();
|
|
1754
1794
|
const { openConfirm } = (0, import_tds_react_native13.useDialog)();
|
|
1755
1795
|
const global2 = getAppsInTossGlobals();
|
|
1756
|
-
const addEventListener = (0,
|
|
1796
|
+
const addEventListener = (0, import_react26.useCallback)(
|
|
1757
1797
|
(handler) => {
|
|
1758
1798
|
addWebBackEventListener(handler);
|
|
1759
1799
|
},
|
|
1760
1800
|
[addWebBackEventListener]
|
|
1761
1801
|
);
|
|
1762
|
-
const removeEventListener = (0,
|
|
1802
|
+
const removeEventListener = (0, import_react26.useCallback)(
|
|
1763
1803
|
(handler) => {
|
|
1764
1804
|
removeWebBackEventListener(handler);
|
|
1765
1805
|
},
|
|
1766
1806
|
[removeWebBackEventListener]
|
|
1767
1807
|
);
|
|
1768
|
-
const handleWebBack = (0,
|
|
1808
|
+
const handleWebBack = (0, import_react26.useCallback)(async () => {
|
|
1769
1809
|
if (hasWebBackEvent) {
|
|
1770
1810
|
for (const handler of webBackHandlersRef) {
|
|
1771
1811
|
handler();
|
|
@@ -1798,7 +1838,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1798
1838
|
openConfirm,
|
|
1799
1839
|
webViewRef
|
|
1800
1840
|
]);
|
|
1801
|
-
const handleWebHome = (0,
|
|
1841
|
+
const handleWebHome = (0, import_react26.useCallback)(() => {
|
|
1802
1842
|
logging.homeButtonClick();
|
|
1803
1843
|
if (hasWebBackEvent) {
|
|
1804
1844
|
for (const handler of webBackHandlersRef) {
|
|
@@ -1808,7 +1848,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1808
1848
|
}
|
|
1809
1849
|
webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
|
|
1810
1850
|
}, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
|
|
1811
|
-
return (0,
|
|
1851
|
+
return (0, import_react26.useMemo)(
|
|
1812
1852
|
() => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
|
|
1813
1853
|
[addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
|
|
1814
1854
|
);
|
|
@@ -1986,11 +2026,11 @@ function useCreateUserAgent({
|
|
|
1986
2026
|
// src/hooks/useGeolocation.ts
|
|
1987
2027
|
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1988
2028
|
var import_react_native29 = require("@granite-js/react-native");
|
|
1989
|
-
var
|
|
2029
|
+
var import_react27 = require("react");
|
|
1990
2030
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1991
2031
|
const isVisible = (0, import_react_native29.useVisibility)();
|
|
1992
|
-
const [location, setLocation] = (0,
|
|
1993
|
-
(0,
|
|
2032
|
+
const [location, setLocation] = (0, import_react27.useState)(null);
|
|
2033
|
+
(0, import_react27.useEffect)(() => {
|
|
1994
2034
|
if (!isVisible) {
|
|
1995
2035
|
return;
|
|
1996
2036
|
}
|
|
@@ -2009,11 +2049,11 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
2009
2049
|
|
|
2010
2050
|
// src/hooks/useWaitForReturnNavigator.tsx
|
|
2011
2051
|
var import_react_native30 = require("@granite-js/react-native");
|
|
2012
|
-
var
|
|
2052
|
+
var import_react28 = require("react");
|
|
2013
2053
|
function useWaitForReturnNavigator() {
|
|
2014
|
-
const callbacks = (0,
|
|
2054
|
+
const callbacks = (0, import_react28.useRef)([]).current;
|
|
2015
2055
|
const navigation = (0, import_react_native30.useNavigation)();
|
|
2016
|
-
const startNavigating = (0,
|
|
2056
|
+
const startNavigating = (0, import_react28.useCallback)(
|
|
2017
2057
|
(route, params) => {
|
|
2018
2058
|
return new Promise((resolve) => {
|
|
2019
2059
|
callbacks.push(resolve);
|
|
@@ -2022,7 +2062,7 @@ function useWaitForReturnNavigator() {
|
|
|
2022
2062
|
},
|
|
2023
2063
|
[callbacks, navigation]
|
|
2024
2064
|
);
|
|
2025
|
-
const handleVisibilityChange = (0,
|
|
2065
|
+
const handleVisibilityChange = (0, import_react28.useCallback)(
|
|
2026
2066
|
(state) => {
|
|
2027
2067
|
if (state === "visible" && callbacks.length > 0) {
|
|
2028
2068
|
for (const callback of callbacks) {
|
|
@@ -2130,14 +2170,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2130
2170
|
if (!TYPES.includes(type)) {
|
|
2131
2171
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
2132
2172
|
}
|
|
2133
|
-
const webViewRef = (0,
|
|
2173
|
+
const webViewRef = (0, import_react29.useRef)(null);
|
|
2134
2174
|
const webBackHandler = useWebBackHandler(webViewRef);
|
|
2135
|
-
const uri = (0,
|
|
2175
|
+
const uri = (0, import_react29.useMemo)(() => getWebViewUri(local), [local]);
|
|
2136
2176
|
const top = (0, import_private9.useSafeAreaTop)();
|
|
2137
2177
|
const bottom = (0, import_private9.useSafeAreaBottom)();
|
|
2178
|
+
const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
|
|
2138
2179
|
const global2 = getAppsInTossGlobals();
|
|
2139
2180
|
const navigationBarContext = useNavigationBarContext();
|
|
2140
|
-
const
|
|
2181
|
+
const safeAreaInsetsEmitter = useSafeAreaInsetsEmitter();
|
|
2182
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react29.useState)(
|
|
2141
2183
|
props.allowsBackForwardNavigationGestures
|
|
2142
2184
|
);
|
|
2143
2185
|
const handler = useBridgeHandler({
|
|
@@ -2154,6 +2196,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2154
2196
|
},
|
|
2155
2197
|
entryMessageExited: ({ onEvent, onError }) => import_native_modules18.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
2156
2198
|
updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
2199
|
+
safeAreaInsetsChange: ({ onEvent }) => {
|
|
2200
|
+
safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
|
|
2201
|
+
return () => {
|
|
2202
|
+
safeAreaInsetsEmitter.off("safeAreaInsetsChange", onEvent);
|
|
2203
|
+
};
|
|
2204
|
+
},
|
|
2157
2205
|
/** @internal */
|
|
2158
2206
|
appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
2159
2207
|
/** AdMob */
|
|
@@ -2172,6 +2220,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2172
2220
|
...appsInTossConstantBridges,
|
|
2173
2221
|
getSafeAreaTop: () => top,
|
|
2174
2222
|
getSafeAreaBottom: () => bottom,
|
|
2223
|
+
getSafeAreaLeft: () => insets.left,
|
|
2224
|
+
getSafeAreaRight: () => insets.right,
|
|
2175
2225
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
2176
2226
|
/** AdMob */
|
|
2177
2227
|
loadAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
@@ -2216,7 +2266,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2216
2266
|
completeProductGrant: import_native_modules18.IAP.completeProductGrant
|
|
2217
2267
|
}
|
|
2218
2268
|
});
|
|
2219
|
-
const headerPropForExternalWebView = (0,
|
|
2269
|
+
const headerPropForExternalWebView = (0, import_react29.useMemo)(() => {
|
|
2220
2270
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
2221
2271
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
2222
2272
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -2237,7 +2287,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2237
2287
|
colorPreference: "light"
|
|
2238
2288
|
});
|
|
2239
2289
|
const refs = mergeRefs(handler.ref, webViewRef);
|
|
2240
|
-
(0,
|
|
2290
|
+
(0, import_react29.useEffect)(() => {
|
|
2241
2291
|
const callback = () => {
|
|
2242
2292
|
webBackHandler.handleWebBack();
|
|
2243
2293
|
return true;
|
|
@@ -2334,12 +2384,8 @@ function useGlobalScripts() {
|
|
|
2334
2384
|
})();
|
|
2335
2385
|
`;
|
|
2336
2386
|
return {
|
|
2337
|
-
beforeLoad: mergeScripts(
|
|
2338
|
-
|
|
2339
|
-
),
|
|
2340
|
-
afterLoad: mergeScripts(
|
|
2341
|
-
disableTextSelectionCSS
|
|
2342
|
-
)
|
|
2387
|
+
beforeLoad: mergeScripts(global2.webViewType === "game" && applyGameResourcesCache),
|
|
2388
|
+
afterLoad: mergeScripts(disableTextSelectionCSS)
|
|
2343
2389
|
};
|
|
2344
2390
|
}
|
|
2345
2391
|
function mergeScripts(...scripts) {
|
package/dist/index.js
CHANGED
|
@@ -1358,10 +1358,11 @@ import {
|
|
|
1358
1358
|
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
1359
1359
|
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
1360
1360
|
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
1361
|
+
import { useSafeAreaInsets as useSafeAreaInsets4 } from "@granite-js/native/react-native-safe-area-context";
|
|
1361
1362
|
import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
|
|
1362
1363
|
import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
|
|
1363
1364
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3 } from "@toss/tds-react-native/private";
|
|
1364
|
-
import { useEffect as
|
|
1365
|
+
import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef6, useState as useState8 } from "react";
|
|
1365
1366
|
import { BackHandler as BackHandler2, Platform as Platform6 } from "react-native";
|
|
1366
1367
|
|
|
1367
1368
|
// src/components/GameWebView.tsx
|
|
@@ -1529,7 +1530,7 @@ var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ onBackButtonCli
|
|
|
1529
1530
|
});
|
|
1530
1531
|
|
|
1531
1532
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1532
|
-
import { useCallback as useCallback10, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
1533
|
+
import { useCallback as useCallback10, useEffect as useEffect11, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
1533
1534
|
function serializeError(error) {
|
|
1534
1535
|
return JSON.stringify(error, (_, value) => {
|
|
1535
1536
|
if (value instanceof Error) {
|
|
@@ -1594,6 +1595,9 @@ function useBridgeHandler({
|
|
|
1594
1595
|
)};`,
|
|
1595
1596
|
[constantHandlerMap]
|
|
1596
1597
|
);
|
|
1598
|
+
useEffect11(() => {
|
|
1599
|
+
ref.current?.injectJavaScript(injectedJavaScript);
|
|
1600
|
+
}, [injectedJavaScript]);
|
|
1597
1601
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
1598
1602
|
ref.current?.injectJavaScript(`
|
|
1599
1603
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
@@ -1663,14 +1667,50 @@ function parseNativeEventData(data) {
|
|
|
1663
1667
|
}
|
|
1664
1668
|
}
|
|
1665
1669
|
|
|
1670
|
+
// src/core/hooks/useSafeAreaInsetsEmitter.tsx
|
|
1671
|
+
import { useSafeAreaInsets as useSafeAreaInsets3 } from "@granite-js/native/react-native-safe-area-context";
|
|
1672
|
+
import { useEffect as useEffect12, useMemo as useMemo4 } from "react";
|
|
1673
|
+
var EventEmitter = class {
|
|
1674
|
+
listeners = {};
|
|
1675
|
+
on(event, listener) {
|
|
1676
|
+
if (!this.listeners[event]) {
|
|
1677
|
+
this.listeners[event] = [];
|
|
1678
|
+
}
|
|
1679
|
+
this.listeners[event].push(listener);
|
|
1680
|
+
}
|
|
1681
|
+
emit(event, ...args) {
|
|
1682
|
+
if (!this.listeners[event]) {
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
this.listeners[event].forEach((listener) => listener(...args));
|
|
1686
|
+
}
|
|
1687
|
+
off(event, listener) {
|
|
1688
|
+
if (!this.listeners[event]) {
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
this.listeners[event] = this.listeners[event].filter((l) => l !== listener);
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
function useSafeAreaInsetsEmitter() {
|
|
1695
|
+
const insets = useSafeAreaInsets3();
|
|
1696
|
+
const emitter = useMemo4(() => new EventEmitter(), []);
|
|
1697
|
+
useEffect12(() => {
|
|
1698
|
+
emitter.emit("safeAreaInsetsChange", insets);
|
|
1699
|
+
return () => {
|
|
1700
|
+
emitter.off("safeAreaInsetsChange", (listener) => listener(insets));
|
|
1701
|
+
};
|
|
1702
|
+
}, [emitter, insets]);
|
|
1703
|
+
return emitter;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1666
1706
|
// src/core/hooks/useWebBackHandler.tsx
|
|
1667
1707
|
import { closeView as closeView6, useBackEventState } from "@granite-js/react-native";
|
|
1668
1708
|
import { useDialog as useDialog7 } from "@toss/tds-react-native";
|
|
1669
1709
|
import { josa as josa5 } from "es-hangul";
|
|
1670
|
-
import { useCallback as useCallback12, useMemo as
|
|
1710
|
+
import { useCallback as useCallback12, useMemo as useMemo6 } from "react";
|
|
1671
1711
|
|
|
1672
1712
|
// src/hooks/useWebviewHistoryStack.tsx
|
|
1673
|
-
import { useCallback as useCallback11, useMemo as
|
|
1713
|
+
import { useCallback as useCallback11, useMemo as useMemo5, useReducer } from "react";
|
|
1674
1714
|
var INITIAL_STATE = { stack: [], index: -1 };
|
|
1675
1715
|
function reducer(state, action) {
|
|
1676
1716
|
switch (action.type) {
|
|
@@ -1705,7 +1745,7 @@ function useWebViewHistory() {
|
|
|
1705
1745
|
const onNavigationStateChange = useCallback11(({ url, canGoForward: canGoForward2 }) => {
|
|
1706
1746
|
dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
|
|
1707
1747
|
}, []);
|
|
1708
|
-
const { canGoBack, canGoForward } =
|
|
1748
|
+
const { canGoBack, canGoForward } = useMemo5(() => {
|
|
1709
1749
|
const canBack = state.index > 0;
|
|
1710
1750
|
const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
|
|
1711
1751
|
return { canGoBack: canBack, canGoForward: canFwd };
|
|
@@ -1793,7 +1833,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1793
1833
|
}
|
|
1794
1834
|
webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
|
|
1795
1835
|
}, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
|
|
1796
|
-
return
|
|
1836
|
+
return useMemo6(
|
|
1797
1837
|
() => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
|
|
1798
1838
|
[addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
|
|
1799
1839
|
);
|
|
@@ -1971,11 +2011,11 @@ function useCreateUserAgent({
|
|
|
1971
2011
|
// src/hooks/useGeolocation.ts
|
|
1972
2012
|
import { startUpdateLocation } from "@apps-in-toss/native-modules";
|
|
1973
2013
|
import { useVisibility as useVisibility3 } from "@granite-js/react-native";
|
|
1974
|
-
import { useEffect as
|
|
2014
|
+
import { useEffect as useEffect13, useState as useState7 } from "react";
|
|
1975
2015
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1976
2016
|
const isVisible = useVisibility3();
|
|
1977
2017
|
const [location, setLocation] = useState7(null);
|
|
1978
|
-
|
|
2018
|
+
useEffect13(() => {
|
|
1979
2019
|
if (!isVisible) {
|
|
1980
2020
|
return;
|
|
1981
2021
|
}
|
|
@@ -2117,11 +2157,13 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2117
2157
|
}
|
|
2118
2158
|
const webViewRef = useRef6(null);
|
|
2119
2159
|
const webBackHandler = useWebBackHandler(webViewRef);
|
|
2120
|
-
const uri =
|
|
2160
|
+
const uri = useMemo7(() => getWebViewUri(local), [local]);
|
|
2121
2161
|
const top = useSafeAreaTop3();
|
|
2122
2162
|
const bottom = useSafeAreaBottom();
|
|
2163
|
+
const insets = useSafeAreaInsets4();
|
|
2123
2164
|
const global2 = getAppsInTossGlobals();
|
|
2124
2165
|
const navigationBarContext = useNavigationBarContext();
|
|
2166
|
+
const safeAreaInsetsEmitter = useSafeAreaInsetsEmitter();
|
|
2125
2167
|
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState8(
|
|
2126
2168
|
props.allowsBackForwardNavigationGestures
|
|
2127
2169
|
);
|
|
@@ -2139,6 +2181,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2139
2181
|
},
|
|
2140
2182
|
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent4.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
2141
2183
|
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
2184
|
+
safeAreaInsetsChange: ({ onEvent }) => {
|
|
2185
|
+
safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
|
|
2186
|
+
return () => {
|
|
2187
|
+
safeAreaInsetsEmitter.off("safeAreaInsetsChange", onEvent);
|
|
2188
|
+
};
|
|
2189
|
+
},
|
|
2142
2190
|
/** @internal */
|
|
2143
2191
|
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
2144
2192
|
/** AdMob */
|
|
@@ -2157,6 +2205,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2157
2205
|
...appsInTossConstantBridges,
|
|
2158
2206
|
getSafeAreaTop: () => top,
|
|
2159
2207
|
getSafeAreaBottom: () => bottom,
|
|
2208
|
+
getSafeAreaLeft: () => insets.left,
|
|
2209
|
+
getSafeAreaRight: () => insets.right,
|
|
2160
2210
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
2161
2211
|
/** AdMob */
|
|
2162
2212
|
loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
@@ -2201,7 +2251,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2201
2251
|
completeProductGrant: IAP.completeProductGrant
|
|
2202
2252
|
}
|
|
2203
2253
|
});
|
|
2204
|
-
const headerPropForExternalWebView =
|
|
2254
|
+
const headerPropForExternalWebView = useMemo7(() => {
|
|
2205
2255
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
2206
2256
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
2207
2257
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -2222,7 +2272,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2222
2272
|
colorPreference: "light"
|
|
2223
2273
|
});
|
|
2224
2274
|
const refs = mergeRefs(handler.ref, webViewRef);
|
|
2225
|
-
|
|
2275
|
+
useEffect14(() => {
|
|
2226
2276
|
const callback = () => {
|
|
2227
2277
|
webBackHandler.handleWebBack();
|
|
2228
2278
|
return true;
|
|
@@ -2319,12 +2369,8 @@ function useGlobalScripts() {
|
|
|
2319
2369
|
})();
|
|
2320
2370
|
`;
|
|
2321
2371
|
return {
|
|
2322
|
-
beforeLoad: mergeScripts(
|
|
2323
|
-
|
|
2324
|
-
),
|
|
2325
|
-
afterLoad: mergeScripts(
|
|
2326
|
-
disableTextSelectionCSS
|
|
2327
|
-
)
|
|
2372
|
+
beforeLoad: mergeScripts(global2.webViewType === "game" && applyGameResourcesCache),
|
|
2373
|
+
afterLoad: mergeScripts(disableTextSelectionCSS)
|
|
2328
2374
|
};
|
|
2329
2375
|
}
|
|
2330
2376
|
function mergeScripts(...scripts) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/framework",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.8",
|
|
5
5
|
"description": "The framework for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"ait": "./bin/ait.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@apps-in-toss/analytics": "1.4.
|
|
60
|
-
"@apps-in-toss/cli": "1.4.
|
|
61
|
-
"@apps-in-toss/native-modules": "1.4.
|
|
62
|
-
"@apps-in-toss/plugins": "1.4.
|
|
63
|
-
"@apps-in-toss/types": "1.4.
|
|
59
|
+
"@apps-in-toss/analytics": "1.4.8",
|
|
60
|
+
"@apps-in-toss/cli": "1.4.8",
|
|
61
|
+
"@apps-in-toss/native-modules": "1.4.8",
|
|
62
|
+
"@apps-in-toss/plugins": "1.4.8",
|
|
63
|
+
"@apps-in-toss/types": "1.4.8",
|
|
64
64
|
"es-hangul": "^2.3.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "cc855970b30e1ce9098bd639b48212b8e21c0722"
|
|
100
100
|
}
|