Skip to content

Commit

Permalink
feat: 웹뷰 라우팅 pop액션 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondanythings committed Sep 11, 2024
1 parent b6bbad4 commit df8f687
Show file tree
Hide file tree
Showing 9 changed files with 10,634 additions and 9,613 deletions.
2 changes: 1 addition & 1 deletion apps/mobile/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ expo-env.d.ts

gradle.properties

ios/Config.xcconfig
ios/tmp.xcconfig
19 changes: 13 additions & 6 deletions apps/mobile/bridge/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import EventEmitter3 from "eventemitter3";

export type SUSPENSE_STATE = { loading: boolean; message?: string };

type POP_ROUTE = { type: "POP" };
type POP_ROUTE = { type: "POP"; route?: Path };
type PUSH_ROUTE = { type: "PUSH"; route: Path };
type REPLACE_ROUTE = { type: "REPLACE"; route: Path };

Expand Down Expand Up @@ -46,14 +46,21 @@ export const appBridge = bridge({
});
},

async navigate(path: Path | -1, options?: { type?: "PUSH" | "REPLACE" }) {
async navigate<T extends Path | -1>(
path: T,
options?: T extends Path ? { type?: "PUSH" | "REPLACE" } : { route?: Path }
) {
if (path === -1) {
eventEmitter.emit("ROUTE_EVENT", { type: "POP" });
} else {
eventEmitter.emit("ROUTE_EVENT", {
type: options?.type ?? "PUSH",
route: path,
type: "POP",
route: (options as { route?: Path })?.route,
});
} else {
const routeEvent: ROUTE_EVENT = {
type: (options as { type?: "PUSH" | "REPLACE" })?.type ?? "PUSH",
route: path,
};
eventEmitter.emit("ROUTE_EVENT", routeEvent);
}
},
});
Expand Down
46 changes: 23 additions & 23 deletions apps/mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1506,18 +1506,18 @@ PODS:
DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- "EXConstants (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-constants/ios`)"
- "Expo (from `../../../node_modules/.pnpm/[email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13/node_modules/expo`)"
- "ExpoAdapterBranch (from `../../../node_modules/.pnpm/@[email protected][email protected]_@babel+core@7.24.5_@babel+preset-env@7_luqyqhuc2pxykg4onuuckfmd2a/node_modules/@config-plugins/react-native-branch/ios`)"
- "ExpoAsset (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-asset/ios`)"
- "ExpoFileSystem (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-file-system/ios`)"
- "ExpoFont (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-font/ios`)"
- "ExpoHead (from `../../../node_modules/.pnpm/[email protected].23_xu2aa2zoperybhzxj7rq3xnmlu/node_modules/expo-router/ios`)"
- "ExpoKeepAwake (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-keep-awake/ios`)"
- "EXConstants (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-constants/ios`)"
- "Expo (from `../../../node_modules/.pnpm/[email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13/node_modules/expo`)"
- "ExpoAdapterBranch (from `../../../node_modules/.pnpm/@[email protected][email protected]_@babel+core@7.25.2_@babel+preset-env@7_ycm7jmghyyjxxsxcm7acxbojya/node_modules/@config-plugins/react-native-branch/ios`)"
- "ExpoAsset (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-asset/ios`)"
- "ExpoFileSystem (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-file-system/ios`)"
- "ExpoFont (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-font/ios`)"
- "ExpoHead (from `../../../node_modules/.pnpm/[email protected].23_i7wlbfyhsntzquot4ocln2j7oq/node_modules/expo-router/ios`)"
- "ExpoKeepAwake (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-keep-awake/ios`)"
- "ExpoModulesCore (from `../../../node_modules/.pnpm/[email protected]/node_modules/expo-modules-core`)"
- "ExpoSystemUI (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-system-ui/ios`)"
- "ExpoWebBrowser (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-web-browser/ios`)"
- "EXSplashScreen (from `../../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]_@babel_qrmib74rbiege66zw26e3mbify/node_modules/expo-splash-screen/ios`)"
- "ExpoSystemUI (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-system-ui/ios`)"
- "ExpoWebBrowser (from `../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-web-browser/ios`)"
- "EXSplashScreen (from `../../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]_@babel_h2nplpzf5bxzverb3hpfmgjk5a/node_modules/expo-splash-screen/ios`)"
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
Expand Down Expand Up @@ -1612,29 +1612,29 @@ EXTERNAL SOURCES:
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXConstants:
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-constants/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-constants/ios"
Expo:
:path: "../../../node_modules/.pnpm/[email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13/node_modules/expo"
:path: "../../../node_modules/.pnpm/[email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13/node_modules/expo"
ExpoAdapterBranch:
:path: "../../../node_modules/.pnpm/@[email protected][email protected]_@babel+core@7.24.5_@babel+preset-env@7_luqyqhuc2pxykg4onuuckfmd2a/node_modules/@config-plugins/react-native-branch/ios"
:path: "../../../node_modules/.pnpm/@[email protected][email protected]_@babel+core@7.25.2_@babel+preset-env@7_ycm7jmghyyjxxsxcm7acxbojya/node_modules/@config-plugins/react-native-branch/ios"
ExpoAsset:
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-asset/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-asset/ios"
ExpoFileSystem:
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-file-system/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-file-system/ios"
ExpoFont:
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-font/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-font/ios"
ExpoHead:
:path: "../../../node_modules/.pnpm/[email protected].23_xu2aa2zoperybhzxj7rq3xnmlu/node_modules/expo-router/ios"
:path: "../../../node_modules/.pnpm/[email protected].23_i7wlbfyhsntzquot4ocln2j7oq/node_modules/expo-router/ios"
ExpoKeepAwake:
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-keep-awake/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-keep-awake/ios"
ExpoModulesCore:
:path: "../../../node_modules/.pnpm/[email protected]/node_modules/expo-modules-core"
ExpoSystemUI:
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-system-ui/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-system-ui/ios"
ExpoWebBrowser:
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.24.5_@[email protected].3_@babel+core@7.24.5__encoding@0.1.13_/node_modules/expo-web-browser/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected]_@babel+core@7.25.2_@[email protected].4_@babel+core@7.25.2__encoding@0.1.13_/node_modules/expo-web-browser/ios"
EXSplashScreen:
:path: "../../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]_@babel_qrmib74rbiege66zw26e3mbify/node_modules/expo-splash-screen/ios"
:path: "../../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]_@babel_h2nplpzf5bxzverb3hpfmgjk5a/node_modules/expo-splash-screen/ios"
FBLazyVector:
:path: "../node_modules/react-native/Libraries/FBLazyVector"
fmt:
Expand Down Expand Up @@ -1867,7 +1867,7 @@ SPEC CHECKSUMS:
RNCKakaoUser: 4bb56db5ec0619ec6f8f58730fc47a7e35c23b9e
RNGestureHandler: 2282cfbcf86c360d29f44ace393203afd5c6cff7
RNPermissions: 4da8c626e4ac9d71c1a199d500d52dd54da62e38
RNReanimated: e7705b6f95c139a3e793648659471a81ff85717f
RNReanimated: 1c5fc9cbb938ceefb9bce416f9447b79ddaec7ff
RNScreens: b32a9ff15bea7fcdbe5dff6477bc503f792b1208
RNSVG: 43b64ed39c14ce830d840903774154ca0c1f27ec
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Expand Down
6 changes: 2 additions & 4 deletions apps/mobile/ios/layer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
6C2E3173556A471DD304B334 /* Pods-layer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-layer.debug.xcconfig"; path = "Target Support Files/Pods-layer/Pods-layer.debug.xcconfig"; sourceTree = "<group>"; };
77203D4CF0F24E99942E94DB /* layer-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "layer-Bridging-Header.h"; path = "layer/layer-Bridging-Header.h"; sourceTree = "<group>"; };
7A4D352CD337FB3A3BF06240 /* Pods-layer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-layer.release.xcconfig"; path = "Target Support Files/Pods-layer/Pods-layer.release.xcconfig"; sourceTree = "<group>"; };
7FA4F0C42C8F366A0016D928 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
7FBCF6452C912A8F00F485C8 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
8F46C79D23705C174FDE920B /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = layer/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = layer/SplashScreen.storyboard; sourceTree = "<group>"; };
B56B8C86D6B14A489FBBA64E /* PretendardVariable.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = PretendardVariable.ttf; path = ../assets/fonts/PretendardVariable.ttf; sourceTree = "<group>"; };
Expand Down Expand Up @@ -92,7 +92,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
7FA4F0C42C8F366A0016D928 /* Config.xcconfig */,
7FBCF6452C912A8F00F485C8 /* Config.xcconfig */,
13B07FAE1A68108700A75B9A /* layer */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
83CBBA001A601CBA00E9B192 /* Products */,
Expand Down Expand Up @@ -447,7 +447,6 @@
};
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7FA4F0C42C8F366A0016D928 /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CC = "";
Expand Down Expand Up @@ -517,7 +516,6 @@
};
83CBBA211A601CBA00E9B192 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7FA4F0C42C8F366A0016D928 /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CC = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
8 changes: 6 additions & 2 deletions apps/mobile/provider/suspense-provider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PropsWithChildren, useCallback, useRef, useState } from "react";
import React, { useEffect } from "react";
import { View, Text, StyleSheet, Dimensions, Animated } from "react-native";
import { View, Text, StyleSheet, Animated } from "react-native";
import LottieView from "lottie-react-native";
import { BlurView } from "@react-native-community/blur";

Expand Down Expand Up @@ -32,7 +32,11 @@ const SuspenseProvider = ({ children }: PropsWithChildren) => {
const handleRoute = useCallback((event: ROUTE_EVENT) => {
switch (event.type) {
case "POP":
router.canGoBack() && router.back();
if (router.canGoBack()) {
router.back();
} else if (event.route) {
router.navigate(event.route);
}
break;
case "PUSH":
router.push({
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/app/space/SpaceViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ import { useBottomSheet } from "@/hooks/useBottomSheet";
import { useModal } from "@/hooks/useModal";
import { useRequiredParams } from "@/hooks/useRequiredParams";
import { DualToneLayout } from "@/layout/DualToneLayout";
import { useTestNatigate } from "@/lib/test-natigate";
import { DESIGN_TOKEN_COLOR } from "@/style/designTokens";
import { Retrospect } from "@/types/retrospect";

export function SpaceViewPage() {
const navigate = useNavigate();
const appNavigate = useTestNatigate();
const memberId = Cookies.get("memberId");
const { spaceId } = useRequiredParams<{ spaceId: string }>();
const { openBottomSheet, closeBottomSheet } = useBottomSheet();
Expand Down Expand Up @@ -106,7 +108,7 @@ export function SpaceViewPage() {
css={css`
cursor: pointer;
`}
onClick={() => navigate(PATHS.home())}
onClick={() => appNavigate(-1, { route: PATHS.home() })}
color={DESIGN_TOKEN_COLOR.gray00}
/>
}
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/lib/test-natigate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useBridge } from "@/lib/provider/bridge-provider";
const useTestNatigate = () => {
const { bridge } = useBridge();
const navigate = useNavigate();

return bridge.isWebViewBridgeAvailable && bridge?.navigate ? bridge.navigate : navigate;
};

Expand Down
Loading

0 comments on commit df8f687

Please sign in to comment.