@apps-in-toss/framework 0.0.0-dev.1752114017143 → 0.0.0-dev.1753241576118
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 +663 -128
- package/dist/index.d.cts +592 -439
- package/dist/index.d.ts +592 -439
- package/dist/index.js +637 -106
- package/package.json +6 -5
- package/src/async-bridges.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -445,11 +445,14 @@ __export(async_bridges_exports, {
|
|
|
445
445
|
fetchContacts: () => fetchContacts,
|
|
446
446
|
getClipboardText: () => getClipboardText,
|
|
447
447
|
getCurrentLocation: () => getCurrentLocation,
|
|
448
|
+
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
448
449
|
getTossShareLink: () => getTossShareLink,
|
|
449
450
|
openCamera: () => openCamera,
|
|
451
|
+
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
450
452
|
saveBase64Data: () => saveBase64Data,
|
|
451
453
|
setClipboardText: () => setClipboardText,
|
|
452
|
-
setDeviceOrientation: () => setDeviceOrientation
|
|
454
|
+
setDeviceOrientation: () => setDeviceOrientation,
|
|
455
|
+
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore
|
|
453
456
|
});
|
|
454
457
|
|
|
455
458
|
// src/native-modules/setClipboardText.ts
|
|
@@ -601,6 +604,43 @@ async function saveBase64Data(params) {
|
|
|
601
604
|
await AppsInTossModule.saveBase64Data(params);
|
|
602
605
|
}
|
|
603
606
|
|
|
607
|
+
// src/constant/game-center.ts
|
|
608
|
+
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
609
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
610
|
+
android: "5.221.0",
|
|
611
|
+
ios: "5.221.0"
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
// src/native-modules/getGameCenterGameProfile.ts
|
|
615
|
+
async function getGameCenterGameProfile() {
|
|
616
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
617
|
+
if (!isSupported) {
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
return AppsInTossModule.getGameCenterGameProfile({});
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// src/native-modules/openGameCenterLeaderboard.ts
|
|
624
|
+
import { openURL } from "react-native-bedrock";
|
|
625
|
+
async function openGameCenterLeaderboard() {
|
|
626
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
630
|
+
url.searchParams.set("appName", getAppName());
|
|
631
|
+
url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
|
|
632
|
+
return openURL(url.toString());
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// src/native-modules/submitGameCenterLeaderBoardScore.ts
|
|
636
|
+
async function submitGameCenterLeaderBoardScore(params) {
|
|
637
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
638
|
+
if (!isSupported) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
|
|
642
|
+
}
|
|
643
|
+
|
|
604
644
|
// src/core/registerApp.tsx
|
|
605
645
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
606
646
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
@@ -755,38 +795,15 @@ loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
|
755
795
|
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
756
796
|
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
757
797
|
|
|
758
|
-
// src/native-modules/getTossAppVersion.ts
|
|
759
|
-
function getTossAppVersion() {
|
|
760
|
-
return AppsInTossModule.tossAppVersion;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
798
|
// src/native-modules/getDeviceId.ts
|
|
764
799
|
function getDeviceId() {
|
|
765
800
|
return AppsInTossModule.deviceId;
|
|
766
801
|
}
|
|
767
802
|
|
|
768
|
-
// src/native-modules/
|
|
769
|
-
function
|
|
770
|
-
return AppsInTossModule.
|
|
771
|
-
}
|
|
772
|
-
function setItem(key, value) {
|
|
773
|
-
return AppsInTossModule.setStorageItem({
|
|
774
|
-
key,
|
|
775
|
-
value
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
function removeItem(key) {
|
|
779
|
-
return AppsInTossModule.removeStorageItem({ key });
|
|
780
|
-
}
|
|
781
|
-
function clearItems() {
|
|
782
|
-
return AppsInTossModule.clearStorage({});
|
|
803
|
+
// src/native-modules/getTossAppVersion.ts
|
|
804
|
+
function getTossAppVersion() {
|
|
805
|
+
return AppsInTossModule.tossAppVersion;
|
|
783
806
|
}
|
|
784
|
-
var Storage = {
|
|
785
|
-
getItem,
|
|
786
|
-
setItem,
|
|
787
|
-
removeItem,
|
|
788
|
-
clearItems
|
|
789
|
-
};
|
|
790
807
|
|
|
791
808
|
// src/native-modules/iap.ts
|
|
792
809
|
async function createOneTimePurchaseOrder(params) {
|
|
@@ -814,6 +831,29 @@ var IAP = {
|
|
|
814
831
|
getProductItemList
|
|
815
832
|
};
|
|
816
833
|
|
|
834
|
+
// src/native-modules/storage.ts
|
|
835
|
+
function getItem(key) {
|
|
836
|
+
return AppsInTossModule.getStorageItem({ key });
|
|
837
|
+
}
|
|
838
|
+
function setItem(key, value) {
|
|
839
|
+
return AppsInTossModule.setStorageItem({
|
|
840
|
+
key,
|
|
841
|
+
value
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
function removeItem(key) {
|
|
845
|
+
return AppsInTossModule.removeStorageItem({ key });
|
|
846
|
+
}
|
|
847
|
+
function clearItems() {
|
|
848
|
+
return AppsInTossModule.clearStorage({});
|
|
849
|
+
}
|
|
850
|
+
var Storage = {
|
|
851
|
+
getItem,
|
|
852
|
+
setItem,
|
|
853
|
+
removeItem,
|
|
854
|
+
clearItems
|
|
855
|
+
};
|
|
856
|
+
|
|
817
857
|
// src/native-modules/index.ts
|
|
818
858
|
var TossPay = {
|
|
819
859
|
checkoutPayment
|
|
@@ -827,11 +867,12 @@ var GoogleAdMob = {
|
|
|
827
867
|
|
|
828
868
|
// src/components/WebView.tsx
|
|
829
869
|
import {
|
|
830
|
-
|
|
831
|
-
|
|
870
|
+
ExternalWebViewScreen,
|
|
871
|
+
PartnerWebViewScreen
|
|
832
872
|
} from "@toss-design-system/react-native";
|
|
833
873
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
834
|
-
import { useCallback as
|
|
874
|
+
import { useCallback as useCallback4, useMemo as useMemo3 } from "react";
|
|
875
|
+
import { Platform as Platform7 } from "react-native";
|
|
835
876
|
import { getSchemeUri as getSchemeUri4, useBedrockEvent } from "react-native-bedrock";
|
|
836
877
|
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
837
878
|
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
@@ -840,26 +881,343 @@ import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
|
840
881
|
import {
|
|
841
882
|
WebView as PlainWebView
|
|
842
883
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
884
|
+
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
885
|
+
import { josa as josa2 } from "es-hangul";
|
|
886
|
+
import { forwardRef, useCallback as useCallback2, useEffect as useEffect4, useState as useState2 } from "react";
|
|
887
|
+
import { BackHandler, Platform as Platform6 } from "react-native";
|
|
888
|
+
import { closeView as closeView2, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
889
|
+
|
|
890
|
+
// src/components/GameProfile.tsx
|
|
891
|
+
import { Loader } from "@toss-design-system/react-native";
|
|
892
|
+
import { useEffect as useEffect3 } from "react";
|
|
893
|
+
import { Pressable, View } from "react-native";
|
|
894
|
+
|
|
895
|
+
// src/hooks/useGameCenterProfile.ts
|
|
843
896
|
import { useDialog } from "@toss-design-system/react-native";
|
|
844
897
|
import { josa } from "es-hangul";
|
|
845
|
-
import {
|
|
846
|
-
import {
|
|
847
|
-
|
|
898
|
+
import { useCallback, useRef, useState } from "react";
|
|
899
|
+
import { closeView, openURL as openURL3 } from "react-native-bedrock";
|
|
900
|
+
|
|
901
|
+
// src/components/GameProfileToast.tsx
|
|
902
|
+
import { Asset, Toast } from "@toss-design-system/react-native";
|
|
903
|
+
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay } from "@toss-design-system/react-native/private";
|
|
904
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
905
|
+
var useGameProfileToast = () => {
|
|
906
|
+
const overlay = useOverlay();
|
|
907
|
+
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
908
|
+
return new Promise((resolve) => {
|
|
909
|
+
overlay.open(({ isOpen, close, exit }) => {
|
|
910
|
+
return /* @__PURE__ */ jsx2(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx2(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx2(
|
|
911
|
+
Toast,
|
|
912
|
+
{
|
|
913
|
+
open: isOpen,
|
|
914
|
+
onClose: () => {
|
|
915
|
+
resolve();
|
|
916
|
+
close();
|
|
917
|
+
},
|
|
918
|
+
onExited: exit,
|
|
919
|
+
position: "top",
|
|
920
|
+
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
921
|
+
icon: /* @__PURE__ */ jsx2(
|
|
922
|
+
Asset.Image,
|
|
923
|
+
{
|
|
924
|
+
style: { borderRadius: 64, overflow: "hidden" },
|
|
925
|
+
frameShape: Asset.frameShape.CleanW32,
|
|
926
|
+
source: { uri: profileImageUri }
|
|
927
|
+
}
|
|
928
|
+
)
|
|
929
|
+
}
|
|
930
|
+
) }) });
|
|
931
|
+
});
|
|
932
|
+
});
|
|
933
|
+
};
|
|
934
|
+
return { openGameProfileToast };
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
// src/utils/error.ts
|
|
938
|
+
var DEFAULT_ERROR = {
|
|
939
|
+
title: "\uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694",
|
|
940
|
+
description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
// src/utils/market.ts
|
|
944
|
+
import { Platform as Platform2 } from "react-native";
|
|
945
|
+
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
946
|
+
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
947
|
+
var getMarketLink = () => {
|
|
948
|
+
return Platform2.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
// src/utils/openTransparentWebView.ts
|
|
952
|
+
import { openURL as openURL2 } from "react-native-bedrock";
|
|
953
|
+
|
|
954
|
+
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
955
|
+
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
956
|
+
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// src/private.ts
|
|
960
|
+
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
961
|
+
|
|
962
|
+
// src/utils/openTransparentWebView.ts
|
|
963
|
+
var openTransparentWebView = ({
|
|
964
|
+
webUrl,
|
|
965
|
+
cleanupWhenDismissed = true,
|
|
966
|
+
onEvent,
|
|
967
|
+
onError,
|
|
968
|
+
callbackId = "fn",
|
|
969
|
+
params
|
|
970
|
+
}) => {
|
|
971
|
+
const url = new URL("supertoss://transparent-service-web");
|
|
972
|
+
url.searchParams.set("url", webUrl);
|
|
973
|
+
url.searchParams.set("onVisibilityChangeCallback", callbackId);
|
|
974
|
+
Object.entries(params ?? {}).forEach(([key, value]) => {
|
|
975
|
+
url.searchParams.set(key, value);
|
|
976
|
+
});
|
|
977
|
+
const cleanup = INTERNAL__onVisibilityChangedByTransparentServiceWeb({
|
|
978
|
+
options: { callbackId },
|
|
979
|
+
onError: (error) => {
|
|
980
|
+
onError(error);
|
|
981
|
+
cleanup();
|
|
982
|
+
},
|
|
983
|
+
onEvent: (value) => {
|
|
984
|
+
onEvent(value);
|
|
985
|
+
if (cleanupWhenDismissed && value === true) {
|
|
986
|
+
cleanup();
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
openURL2(url.toString());
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
// src/hooks/useGameCenterProfile.ts
|
|
994
|
+
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
995
|
+
const [profileData, setProfileData] = useState(void 0);
|
|
996
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = useState(true);
|
|
997
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = useState(false);
|
|
998
|
+
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
999
|
+
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1000
|
+
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1001
|
+
const [isWebviewLoading, setIsWebviewLoading] = useState(false);
|
|
1002
|
+
const isCompletedProfileFlow = useRef(false);
|
|
1003
|
+
const { openAlert, openConfirm } = useDialog();
|
|
1004
|
+
const { openGameProfileToast } = useGameProfileToast();
|
|
1005
|
+
const openErrorAlert = useCallback(async () => {
|
|
1006
|
+
await openAlert({
|
|
1007
|
+
title: DEFAULT_ERROR.title,
|
|
1008
|
+
description: DEFAULT_ERROR.description
|
|
1009
|
+
});
|
|
1010
|
+
closeView();
|
|
1011
|
+
}, [openAlert]);
|
|
1012
|
+
const openProfileWebview = useCallback(() => {
|
|
1013
|
+
if (isWebviewLoading) {
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
setIsWebviewLoading(true);
|
|
1017
|
+
openTransparentWebView({
|
|
1018
|
+
webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
|
|
1019
|
+
onEvent: async (isClosedTransparentWebView) => {
|
|
1020
|
+
if (isClosedTransparentWebView) {
|
|
1021
|
+
try {
|
|
1022
|
+
setIsWebviewLoading(false);
|
|
1023
|
+
setIsProfileDataRefetching(true);
|
|
1024
|
+
const data = await getGameCenterGameProfile();
|
|
1025
|
+
setProfileData(data);
|
|
1026
|
+
setIsProfileDataRefetching(false);
|
|
1027
|
+
if (data?.statusCode === "SUCCESS") {
|
|
1028
|
+
openGameProfileToast(data.nickname, data.profileImageUri);
|
|
1029
|
+
}
|
|
1030
|
+
} catch (_) {
|
|
1031
|
+
setIsProfileDataRefetching(false);
|
|
1032
|
+
openErrorAlert();
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
onError: () => {
|
|
1037
|
+
openErrorAlert();
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1041
|
+
const updateAppToSupportedMinVersion = useCallback(async () => {
|
|
1042
|
+
const upddateConfirmDialogLabel = {
|
|
1043
|
+
title: `${josa(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1044
|
+
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
1045
|
+
leftButton: "\uB2EB\uAE30",
|
|
1046
|
+
rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
|
|
1047
|
+
};
|
|
1048
|
+
const isConfirmed = await openConfirm({
|
|
1049
|
+
title: upddateConfirmDialogLabel.title,
|
|
1050
|
+
leftButton: upddateConfirmDialogLabel.leftButton,
|
|
1051
|
+
rightButton: upddateConfirmDialogLabel.rightButton,
|
|
1052
|
+
closeOnDimmerClick: true
|
|
1053
|
+
});
|
|
1054
|
+
if (!isConfirmed) {
|
|
1055
|
+
closeView();
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
const STORE_SCHEME = getMarketLink();
|
|
1059
|
+
openURL3(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
1060
|
+
}, [openConfirm]);
|
|
1061
|
+
return {
|
|
1062
|
+
profileData,
|
|
1063
|
+
isProfileDataLoading,
|
|
1064
|
+
isProfileDataRefetching,
|
|
1065
|
+
shouldShowLoadingOverlay,
|
|
1066
|
+
shouldShowProfileNotFoundOverlay,
|
|
1067
|
+
canShowBottomSheetOrToast,
|
|
1068
|
+
isCompletedProfileFlow,
|
|
1069
|
+
updateAppToSupportedMinVersion,
|
|
1070
|
+
setIsProfileDataLoading,
|
|
1071
|
+
openProfileWebview,
|
|
1072
|
+
setProfileData,
|
|
1073
|
+
openErrorAlert,
|
|
1074
|
+
openGameProfileToast
|
|
1075
|
+
};
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
// src/utils/zIndex.ts
|
|
1079
|
+
var Z_INDEX = {
|
|
1080
|
+
/* 게임 프로필을 위한 overlay
|
|
1081
|
+
*/
|
|
1082
|
+
PROFILE_OVERLAY: 9998,
|
|
1083
|
+
// 게임을 종료할 수 있는 X 버튼
|
|
1084
|
+
CLOSE_BUTTON: 9999
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
// src/components/GameProfile.tsx
|
|
1088
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1089
|
+
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1090
|
+
const {
|
|
1091
|
+
profileData,
|
|
1092
|
+
isProfileDataRefetching,
|
|
1093
|
+
shouldShowLoadingOverlay,
|
|
1094
|
+
shouldShowProfileNotFoundOverlay,
|
|
1095
|
+
canShowBottomSheetOrToast,
|
|
1096
|
+
isCompletedProfileFlow,
|
|
1097
|
+
openProfileWebview,
|
|
1098
|
+
updateAppToSupportedMinVersion,
|
|
1099
|
+
setIsProfileDataLoading,
|
|
1100
|
+
setProfileData,
|
|
1101
|
+
openErrorAlert,
|
|
1102
|
+
openGameProfileToast
|
|
1103
|
+
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1104
|
+
useEffect3(() => {
|
|
1105
|
+
try {
|
|
1106
|
+
const getProfileData = async () => {
|
|
1107
|
+
const data = await getGameCenterGameProfile();
|
|
1108
|
+
setProfileData(data);
|
|
1109
|
+
setIsProfileDataLoading(false);
|
|
1110
|
+
};
|
|
1111
|
+
getProfileData();
|
|
1112
|
+
} catch (_) {
|
|
1113
|
+
openErrorAlert();
|
|
1114
|
+
setIsProfileDataLoading(false);
|
|
1115
|
+
}
|
|
1116
|
+
}, []);
|
|
1117
|
+
useEffect3(() => {
|
|
1118
|
+
const handleGameProfileFlow = async () => {
|
|
1119
|
+
if (!canShowBottomSheetOrToast) {
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
if (isCompletedProfileFlow.current) {
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
isCompletedProfileFlow.current = true;
|
|
1126
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
1127
|
+
updateAppToSupportedMinVersion();
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
if (profileData?.statusCode === "SUCCESS") {
|
|
1131
|
+
openGameProfileToast(profileData.nickname, profileData.profileImageUri);
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
if (profileData?.statusCode === "PROFILE_NOT_FOUND") {
|
|
1135
|
+
openProfileWebview();
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
handleGameProfileFlow();
|
|
1139
|
+
}, [
|
|
1140
|
+
canShowBottomSheetOrToast,
|
|
1141
|
+
isCompletedProfileFlow,
|
|
1142
|
+
openGameProfileToast,
|
|
1143
|
+
openProfileWebview,
|
|
1144
|
+
profileData,
|
|
1145
|
+
updateAppToSupportedMinVersion
|
|
1146
|
+
]);
|
|
1147
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
1148
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1149
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1150
|
+
/* @__PURE__ */ jsx3(
|
|
1151
|
+
Pressable,
|
|
1152
|
+
{
|
|
1153
|
+
style: {
|
|
1154
|
+
...overlayStyle
|
|
1155
|
+
},
|
|
1156
|
+
onPress: () => {
|
|
1157
|
+
updateAppToSupportedMinVersion();
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
)
|
|
1161
|
+
] });
|
|
1162
|
+
}
|
|
1163
|
+
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1164
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1165
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1166
|
+
/* @__PURE__ */ jsx3(
|
|
1167
|
+
View,
|
|
1168
|
+
{
|
|
1169
|
+
style: {
|
|
1170
|
+
...overlayStyle,
|
|
1171
|
+
justifyContent: "center",
|
|
1172
|
+
alignItems: "center",
|
|
1173
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1174
|
+
},
|
|
1175
|
+
children: /* @__PURE__ */ jsx3(Loader, { size: "large", type: "light" })
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1178
|
+
] });
|
|
1179
|
+
}
|
|
1180
|
+
if (shouldShowProfileNotFoundOverlay) {
|
|
1181
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1182
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1183
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx3(
|
|
1184
|
+
Pressable,
|
|
1185
|
+
{
|
|
1186
|
+
style: {
|
|
1187
|
+
...overlayStyle
|
|
1188
|
+
},
|
|
1189
|
+
onPress: () => {
|
|
1190
|
+
openProfileWebview();
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
)
|
|
1194
|
+
] });
|
|
1195
|
+
}
|
|
1196
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1197
|
+
};
|
|
1198
|
+
var overlayStyle = {
|
|
1199
|
+
position: "absolute",
|
|
1200
|
+
top: 0,
|
|
1201
|
+
left: 0,
|
|
1202
|
+
right: 0,
|
|
1203
|
+
bottom: 0,
|
|
1204
|
+
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1205
|
+
};
|
|
848
1206
|
|
|
849
1207
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
850
1208
|
import { SvgXml } from "@react-native-bedrock/native/react-native-svg";
|
|
851
1209
|
import { PageNavbar } from "@toss-design-system/react-native";
|
|
852
|
-
import { Platform as
|
|
1210
|
+
import { Platform as Platform5, TouchableOpacity, View as View3 } from "react-native";
|
|
853
1211
|
|
|
854
1212
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
855
|
-
import { StyleSheet, View } from "react-native";
|
|
1213
|
+
import { StyleSheet, View as View2 } from "react-native";
|
|
856
1214
|
|
|
857
1215
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
858
|
-
import { Platform as
|
|
1216
|
+
import { Platform as Platform3 } from "react-native";
|
|
859
1217
|
function byPlatform({
|
|
860
1218
|
...props
|
|
861
1219
|
}) {
|
|
862
|
-
return (props[
|
|
1220
|
+
return (props[Platform3.OS] ?? props.fallback)();
|
|
863
1221
|
}
|
|
864
1222
|
|
|
865
1223
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -867,18 +1225,18 @@ var RIGHT_MARGIN = 24;
|
|
|
867
1225
|
var IOS_DEFAULT_MARGIN = 20;
|
|
868
1226
|
|
|
869
1227
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
870
|
-
import { jsx as
|
|
1228
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
871
1229
|
function IOSHeaderRight(props) {
|
|
872
|
-
return /* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */ jsx4(View2, { style: styles.ios, ...props });
|
|
873
1231
|
}
|
|
874
1232
|
function AndroidHeaderRight(props) {
|
|
875
|
-
return /* @__PURE__ */
|
|
1233
|
+
return /* @__PURE__ */ jsx4(View2, { style: styles.android, ...props });
|
|
876
1234
|
}
|
|
877
1235
|
function HeaderRight(props) {
|
|
878
1236
|
return byPlatform({
|
|
879
|
-
ios: () => /* @__PURE__ */
|
|
880
|
-
android: () => /* @__PURE__ */
|
|
881
|
-
fallback: () => /* @__PURE__ */
|
|
1237
|
+
ios: () => /* @__PURE__ */ jsx4(IOSHeaderRight, { ...props }),
|
|
1238
|
+
android: () => /* @__PURE__ */ jsx4(AndroidHeaderRight, { ...props }),
|
|
1239
|
+
fallback: () => /* @__PURE__ */ jsx4(IOSHeaderRight, { ...props })
|
|
882
1240
|
});
|
|
883
1241
|
}
|
|
884
1242
|
var styles = StyleSheet.create({
|
|
@@ -893,37 +1251,37 @@ var styles = StyleSheet.create({
|
|
|
893
1251
|
|
|
894
1252
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
895
1253
|
import { useSafeAreaInsets } from "@react-native-bedrock/native/react-native-safe-area-context";
|
|
896
|
-
import { Platform as
|
|
1254
|
+
import { Platform as Platform4 } from "react-native";
|
|
897
1255
|
function useSafeAreaTop() {
|
|
898
1256
|
const safeAreaInsets = useSafeAreaInsets();
|
|
899
|
-
const hasDynamicIsland =
|
|
1257
|
+
const hasDynamicIsland = Platform4.OS === "ios" && safeAreaInsets.top > 50;
|
|
900
1258
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
901
1259
|
return safeAreaTop;
|
|
902
1260
|
}
|
|
903
1261
|
|
|
904
1262
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
905
|
-
import { Fragment as
|
|
1263
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
906
1264
|
var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xmlns="https://www.w3.org/2000/svg"><rect fill="#031832" fill-opacity=".46" height="30" rx="15" width="30"/><rect height="29.5" rx="14.75" stroke="#d9d9ff" stroke-opacity=".11" stroke-width=".5" width="29.5" x=".25" y=".25"/><path clip-rule="evenodd" d="m16.5119 15.0014 4.7092-4.7092c.0929-.0928.1666-.2031.2169-.32441.0503-.12134.0762-.25141.0762-.38276.0001-.13136-.0258-.26144-.076-.38281s-.1239-.23166-.2167-.32457c-.0929-.09291-.2031-.16662-.3245-.21692-.1213-.05031-.2514-.07622-.3827-.07626-.1314-.00004-.2615.0258-.3828.07603-.1214.05023-.2317.12388-.3246.21673l-4.7092 4.70997-4.71-4.70997c-.1897-.17718-.4408-.27373-.70034-.26927s-.5072.10959-.69069.2932c-.1835.1836-.28848.43132-.29279.69087-.00432.25954.09238.51057.26968.70017l4.71004 4.7092-4.71004 4.7092c-.1392.1401-.23385.3183-.27204.5121-.0382.1939-.01823.3946.05739.5771s.20351.3386.36759.4486.35702.169.55456.1697c.25583 0 .51164-.0975.70664-.2925l4.71-4.71 4.7092 4.71c.0927.093.2029.1668.3243.2172.1213.0504.2514.0763.3828.0763s.2614-.0259.3828-.0763c.1213-.0504.2315-.1242.3243-.2172.0929-.0929.1667-.2032.217-.3246s.0762-.2515.0762-.3829-.0259-.2616-.0762-.383-.1241-.2317-.217-.3245z" fill="#fdfdfe" fill-opacity=".89" fill-rule="evenodd"/></svg>';
|
|
907
1265
|
function GameNavigationBar({ onClose }) {
|
|
908
1266
|
const safeAreaTop = useSafeAreaTop();
|
|
909
|
-
return /* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
/* @__PURE__ */
|
|
912
|
-
|
|
1267
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
1268
|
+
/* @__PURE__ */ jsx5(PageNavbar, { preference: { type: "none" } }),
|
|
1269
|
+
/* @__PURE__ */ jsx5(
|
|
1270
|
+
View3,
|
|
913
1271
|
{
|
|
914
1272
|
style: {
|
|
915
1273
|
width: "100%",
|
|
916
|
-
height:
|
|
1274
|
+
height: Platform5.OS === "ios" ? 44 : 54,
|
|
917
1275
|
flexDirection: "row",
|
|
918
1276
|
alignItems: "center",
|
|
919
1277
|
justifyContent: "flex-end",
|
|
920
1278
|
position: "absolute",
|
|
921
|
-
zIndex:
|
|
1279
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
922
1280
|
marginTop: safeAreaTop,
|
|
923
|
-
paddingRight:
|
|
1281
|
+
paddingRight: Platform5.OS === "ios" ? 10 : 8
|
|
924
1282
|
},
|
|
925
1283
|
pointerEvents: "box-none",
|
|
926
|
-
children: /* @__PURE__ */
|
|
1284
|
+
children: /* @__PURE__ */ jsx5(HeaderRight, { children: /* @__PURE__ */ jsx5(
|
|
927
1285
|
TouchableOpacity,
|
|
928
1286
|
{
|
|
929
1287
|
hitSlop: { left: 8, right: 8 },
|
|
@@ -931,10 +1289,10 @@ function GameNavigationBar({ onClose }) {
|
|
|
931
1289
|
accessible: true,
|
|
932
1290
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
933
1291
|
style: {
|
|
934
|
-
padding:
|
|
1292
|
+
padding: Platform5.OS === "ios" ? 7 : 9
|
|
935
1293
|
},
|
|
936
1294
|
onPress: onClose,
|
|
937
|
-
children: /* @__PURE__ */
|
|
1295
|
+
children: /* @__PURE__ */ jsx5(SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
938
1296
|
}
|
|
939
1297
|
) })
|
|
940
1298
|
}
|
|
@@ -943,23 +1301,24 @@ function GameNavigationBar({ onClose }) {
|
|
|
943
1301
|
}
|
|
944
1302
|
|
|
945
1303
|
// src/components/GameWebView.tsx
|
|
946
|
-
import { Fragment as
|
|
1304
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
947
1305
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
948
|
-
const { openConfirm } =
|
|
1306
|
+
const { openConfirm } = useDialog2();
|
|
949
1307
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
950
|
-
const
|
|
1308
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = useState2(false);
|
|
1309
|
+
const handleClose = useCallback2(async () => {
|
|
951
1310
|
const isConfirmed = await openConfirm({
|
|
952
|
-
title: `${
|
|
1311
|
+
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
953
1312
|
leftButton: "\uCDE8\uC18C",
|
|
954
1313
|
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
955
1314
|
closeOnDimmerClick: true
|
|
956
1315
|
});
|
|
957
1316
|
if (isConfirmed) {
|
|
958
|
-
|
|
1317
|
+
closeView2();
|
|
959
1318
|
}
|
|
960
1319
|
}, [brandDisplayName, openConfirm]);
|
|
961
|
-
|
|
962
|
-
if (
|
|
1320
|
+
useEffect4(() => {
|
|
1321
|
+
if (Platform6.OS === "ios") {
|
|
963
1322
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
964
1323
|
return () => {
|
|
965
1324
|
setIosSwipeGestureEnabled({ isEnabled: true });
|
|
@@ -967,7 +1326,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
967
1326
|
}
|
|
968
1327
|
return;
|
|
969
1328
|
}, []);
|
|
970
|
-
|
|
1329
|
+
useEffect4(() => {
|
|
971
1330
|
const backHandler = () => {
|
|
972
1331
|
handleClose();
|
|
973
1332
|
return true;
|
|
@@ -977,14 +1336,21 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
977
1336
|
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
978
1337
|
};
|
|
979
1338
|
}, [handleClose]);
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1339
|
+
useEffect4(() => {
|
|
1340
|
+
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1341
|
+
onEvent: () => {
|
|
1342
|
+
setIsEntryMessageExited(true);
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
}, []);
|
|
1346
|
+
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
1347
|
+
/* @__PURE__ */ jsx6(GameNavigationBar, { onClose: handleClose }),
|
|
1348
|
+
getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx6(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx6(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx6(PlainWebView, { ref, ...props })
|
|
983
1349
|
] });
|
|
984
1350
|
});
|
|
985
1351
|
|
|
986
1352
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
987
|
-
import { useCallback as
|
|
1353
|
+
import { useCallback as useCallback3, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
988
1354
|
function serializeError(error) {
|
|
989
1355
|
return JSON.stringify(error, (_, value) => {
|
|
990
1356
|
if (value instanceof Error) {
|
|
@@ -1033,7 +1399,7 @@ function useBridgeHandler({
|
|
|
1033
1399
|
eventListenerMap,
|
|
1034
1400
|
injectedJavaScript: originalInjectedJavaScript
|
|
1035
1401
|
}) {
|
|
1036
|
-
const ref =
|
|
1402
|
+
const ref = useRef2(null);
|
|
1037
1403
|
const injectedJavaScript = useMemo2(
|
|
1038
1404
|
() => [
|
|
1039
1405
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
@@ -1060,7 +1426,7 @@ function useBridgeHandler({
|
|
|
1060
1426
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1061
1427
|
`);
|
|
1062
1428
|
};
|
|
1063
|
-
const $onMessage =
|
|
1429
|
+
const $onMessage = useCallback3(
|
|
1064
1430
|
async (e) => {
|
|
1065
1431
|
onMessage?.(e);
|
|
1066
1432
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1124,6 +1490,185 @@ __export(event_bridges_exports, {
|
|
|
1124
1490
|
startUpdateLocation: () => startUpdateLocation
|
|
1125
1491
|
});
|
|
1126
1492
|
|
|
1493
|
+
// src/hooks/useCreateUserAgent.ts
|
|
1494
|
+
import { useWindowDimensions } from "react-native";
|
|
1495
|
+
import { getPlatformOS } from "react-native-bedrock";
|
|
1496
|
+
var FontA11yCategory = {
|
|
1497
|
+
Large: "Large",
|
|
1498
|
+
xLarge: "xLarge",
|
|
1499
|
+
xxLarge: "xxLarge",
|
|
1500
|
+
xxxLarge: "xxxLarge",
|
|
1501
|
+
A11y_Medium: "A11y_Medium",
|
|
1502
|
+
A11y_Large: "A11y_Large",
|
|
1503
|
+
A11y_xLarge: "A11y_xLarge",
|
|
1504
|
+
A11y_xxLarge: "A11y_xxLarge",
|
|
1505
|
+
A11y_xxxLarge: "A11y_xxxLarge"
|
|
1506
|
+
};
|
|
1507
|
+
var androidFontScaleMap = {
|
|
1508
|
+
100: FontA11yCategory.Large,
|
|
1509
|
+
110: FontA11yCategory.xLarge,
|
|
1510
|
+
120: FontA11yCategory.xxLarge,
|
|
1511
|
+
135: FontA11yCategory.xxxLarge,
|
|
1512
|
+
160: FontA11yCategory.A11y_Medium,
|
|
1513
|
+
190: FontA11yCategory.A11y_Large,
|
|
1514
|
+
235: FontA11yCategory.A11y_xLarge,
|
|
1515
|
+
275: FontA11yCategory.A11y_xxLarge,
|
|
1516
|
+
310: FontA11yCategory.A11y_xxxLarge
|
|
1517
|
+
};
|
|
1518
|
+
var iosScaleToAndroidScale = {
|
|
1519
|
+
0.823: 100,
|
|
1520
|
+
0.882: 100,
|
|
1521
|
+
0.941: 100,
|
|
1522
|
+
1: 100,
|
|
1523
|
+
1.118: 110,
|
|
1524
|
+
1.235: 120,
|
|
1525
|
+
1.353: 135,
|
|
1526
|
+
1.786: 160,
|
|
1527
|
+
2.143: 190,
|
|
1528
|
+
2.643: 235,
|
|
1529
|
+
3.143: 275,
|
|
1530
|
+
3.571: 310
|
|
1531
|
+
};
|
|
1532
|
+
function convertToAndroidStyleScale(fontScale, platform) {
|
|
1533
|
+
if (platform === "android") {
|
|
1534
|
+
if (fontScale <= 1) {
|
|
1535
|
+
return 100;
|
|
1536
|
+
}
|
|
1537
|
+
const scaledValue = Math.round(fontScale * 100);
|
|
1538
|
+
const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
|
|
1539
|
+
let closestKey = keys[0];
|
|
1540
|
+
let minDiff = Math.abs(scaledValue - closestKey);
|
|
1541
|
+
for (const key of keys) {
|
|
1542
|
+
const diff = Math.abs(scaledValue - key);
|
|
1543
|
+
if (diff < minDiff) {
|
|
1544
|
+
minDiff = diff;
|
|
1545
|
+
closestKey = key;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
return closestKey;
|
|
1549
|
+
} else {
|
|
1550
|
+
const iosScales = Object.keys(iosScaleToAndroidScale).map(Number);
|
|
1551
|
+
let closestScale = iosScales[0];
|
|
1552
|
+
let minDiff = Math.abs(fontScale - closestScale);
|
|
1553
|
+
for (const scale of iosScales) {
|
|
1554
|
+
const diff = Math.abs(fontScale - scale);
|
|
1555
|
+
if (diff < minDiff) {
|
|
1556
|
+
minDiff = diff;
|
|
1557
|
+
closestScale = scale;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
return iosScaleToAndroidScale[closestScale];
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
function mapIOSFontScaleToCategory(fontScale) {
|
|
1564
|
+
if (fontScale < 1) {
|
|
1565
|
+
return FontA11yCategory.Large;
|
|
1566
|
+
}
|
|
1567
|
+
if (Math.abs(fontScale - 1) < 0.05) {
|
|
1568
|
+
return FontA11yCategory.Large;
|
|
1569
|
+
}
|
|
1570
|
+
if (Math.abs(fontScale - 1.118) < 0.05) {
|
|
1571
|
+
return FontA11yCategory.xLarge;
|
|
1572
|
+
}
|
|
1573
|
+
if (Math.abs(fontScale - 1.235) < 0.05) {
|
|
1574
|
+
return FontA11yCategory.xxLarge;
|
|
1575
|
+
}
|
|
1576
|
+
if (Math.abs(fontScale - 1.353) < 0.05) {
|
|
1577
|
+
return FontA11yCategory.xxxLarge;
|
|
1578
|
+
}
|
|
1579
|
+
if (Math.abs(fontScale - 1.786) < 0.05) {
|
|
1580
|
+
return FontA11yCategory.A11y_Medium;
|
|
1581
|
+
}
|
|
1582
|
+
if (Math.abs(fontScale - 2.143) < 0.05) {
|
|
1583
|
+
return FontA11yCategory.A11y_Large;
|
|
1584
|
+
}
|
|
1585
|
+
if (Math.abs(fontScale - 2.643) < 0.05) {
|
|
1586
|
+
return FontA11yCategory.A11y_xLarge;
|
|
1587
|
+
}
|
|
1588
|
+
if (Math.abs(fontScale - 3.143) < 0.05) {
|
|
1589
|
+
return FontA11yCategory.A11y_xxLarge;
|
|
1590
|
+
}
|
|
1591
|
+
if (Math.abs(fontScale - 3.571) < 0.05) {
|
|
1592
|
+
return FontA11yCategory.A11y_xxxLarge;
|
|
1593
|
+
}
|
|
1594
|
+
return FontA11yCategory.Large;
|
|
1595
|
+
}
|
|
1596
|
+
function mapAndroidFontScaleToCategory(fontScale) {
|
|
1597
|
+
if (fontScale <= 1) {
|
|
1598
|
+
return androidFontScaleMap[100];
|
|
1599
|
+
}
|
|
1600
|
+
const scaledValue = Math.round(fontScale * 100);
|
|
1601
|
+
const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
|
|
1602
|
+
if (keys.length === 0) {
|
|
1603
|
+
return androidFontScaleMap[100];
|
|
1604
|
+
}
|
|
1605
|
+
let closestKey = keys[0];
|
|
1606
|
+
let minDiff = Math.abs(scaledValue - closestKey);
|
|
1607
|
+
for (const key of keys) {
|
|
1608
|
+
const diff = Math.abs(scaledValue - key);
|
|
1609
|
+
if (diff < minDiff) {
|
|
1610
|
+
minDiff = diff;
|
|
1611
|
+
closestKey = key;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
return androidFontScaleMap[closestKey];
|
|
1615
|
+
}
|
|
1616
|
+
function mapFontScaleToCategory(fontScale, platform) {
|
|
1617
|
+
return platform === "ios" ? mapIOSFontScaleToCategory(fontScale) : mapAndroidFontScaleToCategory(fontScale);
|
|
1618
|
+
}
|
|
1619
|
+
function useCreateUserAgent({
|
|
1620
|
+
batteryModePreference,
|
|
1621
|
+
colorPreference,
|
|
1622
|
+
locale,
|
|
1623
|
+
navbarPreference,
|
|
1624
|
+
pureSafeArea,
|
|
1625
|
+
safeArea,
|
|
1626
|
+
safeAreaBottomTransparency
|
|
1627
|
+
}) {
|
|
1628
|
+
const platform = getPlatformOS();
|
|
1629
|
+
const appVersion = getTossAppVersion();
|
|
1630
|
+
const { fontScale } = useWindowDimensions();
|
|
1631
|
+
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1632
|
+
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1633
|
+
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1634
|
+
return [
|
|
1635
|
+
`TossApp/${appVersion}`,
|
|
1636
|
+
batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
|
|
1637
|
+
colorPreference && `TossColorPreference/${colorPreference}`,
|
|
1638
|
+
`TossFontAccessibility/${fontA11y}`,
|
|
1639
|
+
`TossFontScale/${normalizedFontScale}`,
|
|
1640
|
+
locale && `TossLocale/${locale}`,
|
|
1641
|
+
navbarPreference && `TossNavbarPreference/${navbarPreference}`,
|
|
1642
|
+
pureSafeArea && `TossPureSafeArea/${pureSafeArea}`,
|
|
1643
|
+
safeArea && `TossSafeArea/${safeArea}`,
|
|
1644
|
+
safeAreaBottomTransparency && `TossSafeAreaBottomTransparency/${safeAreaBottomTransparency}`,
|
|
1645
|
+
platformString
|
|
1646
|
+
].filter(Boolean).join(" ");
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
// src/hooks/useGeolocation.ts
|
|
1650
|
+
import { useState as useState3, useEffect as useEffect5 } from "react";
|
|
1651
|
+
import { useVisibility } from "react-native-bedrock";
|
|
1652
|
+
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1653
|
+
const isVisible = useVisibility();
|
|
1654
|
+
const [location, setLocation] = useState3(null);
|
|
1655
|
+
useEffect5(() => {
|
|
1656
|
+
if (!isVisible) {
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
return startUpdateLocation({
|
|
1660
|
+
options: {
|
|
1661
|
+
accuracy,
|
|
1662
|
+
distanceInterval,
|
|
1663
|
+
timeInterval
|
|
1664
|
+
},
|
|
1665
|
+
onEvent: setLocation,
|
|
1666
|
+
onError: console.error
|
|
1667
|
+
});
|
|
1668
|
+
}, [accuracy, distanceInterval, timeInterval, isVisible]);
|
|
1669
|
+
return location;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1127
1672
|
// src/utils/log.ts
|
|
1128
1673
|
import { getSchemeUri as getSchemeUri3 } from "react-native-bedrock";
|
|
1129
1674
|
|
|
@@ -1173,7 +1718,7 @@ var trackScreen = (url) => {
|
|
|
1173
1718
|
};
|
|
1174
1719
|
|
|
1175
1720
|
// src/components/WebView.tsx
|
|
1176
|
-
import { jsx as
|
|
1721
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1177
1722
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1178
1723
|
var operationalEnvironment = getOperationalEnvironment();
|
|
1179
1724
|
var TYPES = ["partner", "external", "game"];
|
|
@@ -1212,6 +1757,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1212
1757
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1213
1758
|
const top = useSafeAreaTop2();
|
|
1214
1759
|
const bottom = useSafeAreaBottom();
|
|
1760
|
+
const global2 = getAppsInTossGlobals();
|
|
1215
1761
|
const handler = useBridgeHandler({
|
|
1216
1762
|
onMessage,
|
|
1217
1763
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1233,6 +1779,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1233
1779
|
...constant_bridges_exports,
|
|
1234
1780
|
getSafeAreaTop: () => top,
|
|
1235
1781
|
getSafeAreaBottom: () => bottom,
|
|
1782
|
+
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
1236
1783
|
/** AdMob */
|
|
1237
1784
|
loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1238
1785
|
showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
@@ -1287,25 +1834,36 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1287
1834
|
}, [type, props]);
|
|
1288
1835
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1289
1836
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1290
|
-
const handleNavigationStateChange =
|
|
1837
|
+
const handleNavigationStateChange = useCallback4((event) => {
|
|
1291
1838
|
if (event.url) {
|
|
1292
1839
|
trackScreen(event.url);
|
|
1293
1840
|
}
|
|
1294
1841
|
}, []);
|
|
1295
|
-
|
|
1842
|
+
const userAgent = useCreateUserAgent({
|
|
1843
|
+
colorPreference: "light"
|
|
1844
|
+
});
|
|
1845
|
+
return /* @__PURE__ */ jsx7(
|
|
1296
1846
|
BaseWebView,
|
|
1297
1847
|
{
|
|
1298
1848
|
ref: handler.ref,
|
|
1299
1849
|
...props,
|
|
1300
1850
|
...baseProps,
|
|
1301
|
-
source: {
|
|
1851
|
+
source: {
|
|
1852
|
+
uri,
|
|
1853
|
+
// NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
|
|
1854
|
+
headers: {
|
|
1855
|
+
"User-Agent": userAgent
|
|
1856
|
+
}
|
|
1857
|
+
},
|
|
1858
|
+
userAgent: Platform7.OS === "ios" ? userAgent : void 0,
|
|
1302
1859
|
sharedCookiesEnabled: true,
|
|
1303
1860
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1304
1861
|
thirdPartyCookiesEnabled: true,
|
|
1305
1862
|
onMessage: handler.onMessage,
|
|
1306
1863
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1307
1864
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1308
|
-
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
1865
|
+
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1866
|
+
decelerationRate: Platform7.OS === "ios" ? 1 : void 0
|
|
1309
1867
|
}
|
|
1310
1868
|
);
|
|
1311
1869
|
}
|
|
@@ -1316,29 +1874,6 @@ function ensureValue(value, name) {
|
|
|
1316
1874
|
return value;
|
|
1317
1875
|
}
|
|
1318
1876
|
|
|
1319
|
-
// src/hooks/useGeolocation.ts
|
|
1320
|
-
import { useState, useEffect as useEffect4 } from "react";
|
|
1321
|
-
import { useVisibility } from "react-native-bedrock";
|
|
1322
|
-
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1323
|
-
const isVisible = useVisibility();
|
|
1324
|
-
const [location, setLocation] = useState(null);
|
|
1325
|
-
useEffect4(() => {
|
|
1326
|
-
if (!isVisible) {
|
|
1327
|
-
return;
|
|
1328
|
-
}
|
|
1329
|
-
return startUpdateLocation({
|
|
1330
|
-
options: {
|
|
1331
|
-
accuracy,
|
|
1332
|
-
distanceInterval,
|
|
1333
|
-
timeInterval
|
|
1334
|
-
},
|
|
1335
|
-
onEvent: setLocation,
|
|
1336
|
-
onError: console.error
|
|
1337
|
-
});
|
|
1338
|
-
}, [accuracy, distanceInterval, timeInterval, isVisible]);
|
|
1339
|
-
return location;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
1877
|
// src/types.ts
|
|
1343
1878
|
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
1344
1879
|
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
@@ -1350,14 +1885,6 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
1350
1885
|
return Accuracy3;
|
|
1351
1886
|
})(Accuracy2 || {});
|
|
1352
1887
|
|
|
1353
|
-
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1354
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1355
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
// src/private.ts
|
|
1359
|
-
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1360
|
-
|
|
1361
1888
|
// src/index.ts
|
|
1362
1889
|
export * from "@apps-in-toss/analytics";
|
|
1363
1890
|
var Analytics2 = {
|
|
@@ -1385,14 +1912,18 @@ export {
|
|
|
1385
1912
|
getClipboardText,
|
|
1386
1913
|
getCurrentLocation,
|
|
1387
1914
|
getDeviceId,
|
|
1915
|
+
getGameCenterGameProfile,
|
|
1388
1916
|
getOperationalEnvironment,
|
|
1389
1917
|
getTossAppVersion,
|
|
1390
1918
|
getTossShareLink,
|
|
1391
1919
|
isMinVersionSupported,
|
|
1392
1920
|
openCamera,
|
|
1921
|
+
openGameCenterLeaderboard,
|
|
1393
1922
|
saveBase64Data,
|
|
1394
1923
|
setClipboardText,
|
|
1395
1924
|
setDeviceOrientation,
|
|
1396
1925
|
startUpdateLocation,
|
|
1926
|
+
submitGameCenterLeaderBoardScore,
|
|
1927
|
+
useCreateUserAgent,
|
|
1397
1928
|
useGeolocation
|
|
1398
1929
|
};
|