Skip to content

Commit

Permalink
hotfix: RN SplashScreen 버그 수정, webview error 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-dong-su committed Apr 6, 2024
1 parent d1d7feb commit 6833caf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
12 changes: 6 additions & 6 deletions packages/app/ios/gloddy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = gloddy/gloddy.entitlements;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U67926J84S;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = gloddy/Info.plist;
Expand All @@ -521,7 +521,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.3;
MARKETING_VERSION = 1.4.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -546,15 +546,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = gloddy/gloddy.entitlements;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U67926J84S;
INFOPLIST_FILE = gloddy/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.3;
MARKETING_VERSION = 1.4.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -804,15 +804,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = gloddy/gloddy.entitlements;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U67926J84S;
INFOPLIST_FILE = gloddy/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.3;
MARKETING_VERSION = 1.4.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
5 changes: 4 additions & 1 deletion packages/app/src/components/OnBoarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export default function OnBoarding() {

const preloading = async () => {
const isUserOnBoardSeen = await AsyncStorage.getItem('onBoarding');
if (!isUserOnBoardSeen) return;
if (!isUserOnBoardSeen) {
setIsPreloadingDone(true);
return;
}

navigation.replace('WebViewContainer', {
url: `${SOURCE_URL}`,
Expand Down
15 changes: 13 additions & 2 deletions packages/app/src/components/WebViewContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Alert, BackHandler, Dimensions, Linking, Platform } from 'react-native'
import RNRestart from 'react-native-restart';
import { SafeAreaView } from 'react-native-safe-area-context';
import WebView, { WebViewMessageEvent, WebViewNavigation } from 'react-native-webview';
import { WebViewErrorEvent } from 'react-native-webview/lib/WebViewTypes';

import Error from './Error';
import { SOURCE_URL } from '../config';
Expand Down Expand Up @@ -178,10 +179,20 @@ export default function WebViewContainer() {

const useAppError = () => {
const [isError, setIsError] = useState(false);
const [errorMessage, setErrorMessage] = useState('');

const onWebViewError = () => {
const onWebViewError = (event: WebViewErrorEvent) => {
// 에러 객체에서 메시지 추출
const errorMesage = event.nativeEvent.description;
console.error('WebView Error:', errorMesage);

// 에러 상태 및 메시지 업데이트
setIsError(true);
setErrorMessage(errorMesage);

// 사용자에게 에러 메시지를 보여주는 Alert
Alert.alert('Error', 'An error occurred: ' + errorMesage);
};

return { isError, setIsError, onWebViewError };
return { isError, setIsError, onWebViewError, errorMessage };
};

0 comments on commit 6833caf

Please sign in to comment.