Skip to content

Commit

Permalink
Merge pull request #3 from Booda-YAMYAM/feature/sw/webViewcheck
Browse files Browse the repository at this point in the history
feat : 통신을 위함
  • Loading branch information
IGhost-P authored Jun 23, 2022
2 parents 7232799 + 718a24e commit ce8580e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions yam-view/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const RNListener = () => {
/** react native 환경에서만 가능 */
const listener = (event) => {
const { data, type } = JSON.parse(event.data);
console.log(data);
if (type === "RN_TO_YAM_VIEW") {
console.log("RN_TO_YAM_VIEW", data);
}

if (type === "TOKEN") {
// type이 TOKEN이기 때문에 이곳에 콘솔이 찍히게 됩니다.
console.log(data); // xxxxx
Expand All @@ -27,7 +30,7 @@ const RNListener = () => {
window.addEventListener("message", listener);
} else {
// 모바일이 아니라면 모바일 아님을 alert로 띄웁니다.
alert({ message: "모바일이 아님" });
console.log("모바일이 아님");
}
};

Expand Down
4 changes: 2 additions & 2 deletions yam-view/src/pages/WebView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const requestPermission = () => {
if (window.ReactNativeWebView) {
// 모바일이라면 모바일의 카메라 권한을 물어보는 액션을 전달합니다.
window.ReactNativeWebView.postMessage(
JSON.stringify({ type: "REQ_CAMERA_PERMISSION" })
JSON.stringify({ type: "REQ_CAMERA_PERMISSION_HI_HELLO" })
);
} else {
// 모바일이 아니라면 모바일 아님을 alert로 띄웁니다.
alert({ message: "" });
console.log("모바일이 아님");
}
};

Expand Down

2 comments on commit ce8580e

@vercel
Copy link

@vercel vercel bot commented on ce8580e Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

yamyma-webview – ./yam-view/public

yamyma-webview-booda.vercel.app
yamyma-webview-gamma.vercel.app
yamyma-webview-git-main-booda.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ce8580e Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

yamyma-webview2 – ./yam-view

yamyma-webview2-git-main-booda.vercel.app
yamyma-webview2.vercel.app
yamyma-webview2-booda.vercel.app

Please sign in to comment.