File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed
provider/AppBridgeProvider Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change 11import styles from "@/components/Home/Home.module.scss" ;
2+ import { AppBridgeMessageType } from "@/components/provider/AppBridgeProvider/AppBridgeMessage.types" ;
3+ import { useAppBridge } from "@/components/provider/AppBridgeProvider/AppBridgeProvider" ;
24import IconButton from "@/components/ui/IconButton/IconButton" ;
35import Text from "@/components/ui/Text/Text" ;
46
5- import { useRoute } from "@/hooks/common/useRoute" ;
6-
77const Home = ( ) => {
8- // 이후 네이티브 라우팅으로 변경
9- const { navigateToReceiptEdit, navigateToRecognitionFail } = useRoute ( ) ;
8+ const { send } = useAppBridge ( ) ;
109
1110 return (
1211 < div className = { styles . Home } >
@@ -22,8 +21,16 @@ const Home = () => {
2221 < img src = "/assets/img/img-graphic-logo.png" alt = "mainLogo" />
2322 </ div >
2423 < div className = { styles . HomeBottom } >
25- < IconButton text = "갤러리" iconName = "gallery" onClick = { navigateToRecognitionFail } />
26- < IconButton text = "카메라" iconName = "camera" onClick = { navigateToReceiptEdit } />
24+ < IconButton
25+ text = "갤러리"
26+ iconName = "gallery"
27+ onClick = { ( ) => send ( { type : AppBridgeMessageType . OPEN_GALLERY } ) }
28+ />
29+ < IconButton
30+ text = "카메라"
31+ iconName = "camera"
32+ onClick = { ( ) => send ( { type : AppBridgeMessageType . OPEN_CAMERA } ) }
33+ />
2734 </ div >
2835 </ div >
2936 ) ;
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const androidHandlers = {
2424
2525export function convertToIOSAppBridge ( message : AppBridgeMessage ) {
2626 const handler = iosHandlers [ message . type ] ;
27+
2728 if ( handler ) {
2829 // eslint-disable-next-line @typescript-eslint/no-explicit-any
2930 handler ( message as any ) ;
@@ -34,6 +35,7 @@ export function convertToIOSAppBridge(message: AppBridgeMessage) {
3435
3536export function convertToAndroidAppBridge ( message : AppBridgeMessage ) {
3637 const handler = androidHandlers [ message . type ] ;
38+
3739 if ( handler ) {
3840 // eslint-disable-next-line @typescript-eslint/no-explicit-any
3941 handler ( message as any ) ;
Original file line number Diff line number Diff line change @@ -5,16 +5,22 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
55
66import AppRouter from "@/router/AppRouter" ;
77
8+ import { AppBridgeProvider } from "@/components/provider/AppBridgeProvider/AppBridgeProvider" ;
89import ReactQueryClientProvider from "@/components/provider/ReactQueryClientProvider" ;
10+ import { UserAgentProvider } from "@/components/provider/UserAgentProvider" ;
911
1012import "@/styles/reset.scss" ;
1113import "@/styles/global.scss" ;
1214
1315ReactDom . createRoot ( document . getElementById ( "root" ) ! ) . render (
1416 < StrictMode >
1517 < ReactQueryClientProvider >
16- < AppRouter />
17- < ReactQueryDevtools initialIsOpen = { false } />
18+ < UserAgentProvider >
19+ < AppBridgeProvider >
20+ < AppRouter />
21+ < ReactQueryDevtools initialIsOpen = { false } />
22+ </ AppBridgeProvider >
23+ </ UserAgentProvider >
1824 </ ReactQueryClientProvider >
1925 </ StrictMode > ,
2026) ;
You can’t perform that action at this time.
0 commit comments