Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/native/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { colors } from '@theme/tokens';
import '@/app/providers/global.css';
import '@/app/providers/api';

import { useLoadAssets, useDeepLinkHandler } from '@hooks';
import { useLoadAssets, useDeepLinkHandler, useOTAUpdate } from '@hooks';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { Text, TextInput } from 'react-native';
import Toast from 'react-native-toast-message';
Expand Down Expand Up @@ -48,6 +48,7 @@ if ((TextInput as any).defaultProps == null) (TextInput as any).defaultProps = {

export default function App() {
const { isReady } = useLoadAssets();
useOTAUpdate();

// FCM 푸시 알림 딥링크 핸들러
useDeepLinkHandler();
Expand Down
12 changes: 11 additions & 1 deletion apps/native/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,17 @@ const isDev =
const config: ExpoConfig = {
name: 'Pointer',
slug: 'pointer',
version: '1.0.0',
version: '1.2.0',
orientation: 'portrait',
runtimeVersion: {
policy: 'fingerprint',
},
updates: {
url: 'https://u.expo.dev/76a68921-8c65-4e50-98b0-fb5ef457ab7e',
enabled: true,
fallbackToCacheTimeout: 0,
checkAutomatically: 'NEVER',
},
icon: './assets/images/icon.png',
scheme: 'pointer',
userInterfaceStyle: 'automatic',
Expand Down Expand Up @@ -128,6 +137,7 @@ const config: ExpoConfig = {
backgroundColor: '#F8F9FC',
},
],
'expo-updates',
[
'@react-native-google-signin/google-signin',
{
Expand Down
7 changes: 5 additions & 2 deletions apps/native/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
"development": {
"developmentClient": true,
"distribution": "internal",
"channel": "development",
"env": {
"EXPO_NO_CAPABILITY_SYNC": "1"
}
},
"preview": {
"distribution": "internal"
"distribution": "internal",
"channel": "preview"
},
"production": {
"autoIncrement": true
"autoIncrement": true,
"channel": "production"
}
},
"submit": {
Expand Down
2 changes: 2 additions & 0 deletions apps/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"test": "jest",
"sync-webview-html": "pnpm --filter @repo/pointer-content-renderer build && mkdir -p ./assets/webview && cp ../../packages/pointer-content-renderer/dist/index.html ./assets/webview/content.html",
"eas-build-post-install": "pnpm sync-webview-html",
"eas-update": "sh -c 'test -n \"$1\" || { echo \"Usage: pnpm eas-update <channel> [eas update args...]\"; exit 1; }; pnpm sync-webview-html && eas update --channel \"$1\" \"${@:2}\"' --",
"openapi": "sh -c 'set -a; [ -f .env ] && . ./.env; set +a; test -n \"$OPENAPI_BASIC_AUTH_USERNAME\" && test -n \"$OPENAPI_BASIC_AUTH_PASSWORD\" && curl -fsS -u \"$OPENAPI_BASIC_AUTH_USERNAME:$OPENAPI_BASIC_AUTH_PASSWORD\" https://dev.api.math-pointer.com/v3/api-docs -o /tmp/native-openapi.json && pnpm dlx openapi-typescript /tmp/native-openapi.json --output ./src/types/api/schema.d.ts && prettier --write ./src/types/api/schema.d.ts'"
},
"dependencies": {
Expand Down Expand Up @@ -66,6 +67,7 @@
"expo-status-bar": "~3.0.8",
"expo-symbols": "~1.0.7",
"expo-system-ui": "~6.0.8",
"expo-updates": "^29.0.17",
"expo-web-browser": "~15.0.9",
"lottie-react-native": "^7.3.4",
"lucide-react-native": "^0.554.0",
Expand Down
5 changes: 4 additions & 1 deletion apps/native/src/features/student/menu/screens/MenuScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useNavigation, useFocusEffect } from '@react-navigation/native';
import { type NativeStackNavigationProp } from '@react-navigation/native-stack';
import { useQueryClient } from '@tanstack/react-query';
import { Bell, Headset, Megaphone, ThumbsUp, History } from 'lucide-react-native';
import Constants from 'expo-constants';

import { TanstackQueryClient, useGetMe, useGetNoticeCount } from '@apis';
import { useAuthStore } from '@stores';
Expand Down Expand Up @@ -105,7 +106,9 @@ const MenuScreen = () => {
/>
<MenuListItem icon={History} title='앱 버전' showChevron={false}>
<View className='justify-center'>
<Text className='text-16m text-blue-500'>1.0.1 최신 버전</Text>
<Text className='text-16m text-blue-500'>
{Constants.nativeAppVersion ?? Constants.expoConfig?.version ?? 'unknown'}
</Text>
</View>
</MenuListItem>
</MenuSection>
Expand Down
1 change: 1 addition & 0 deletions apps/native/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export { default as useFcmToken } from './useFcmToken';
export { default as useInvalidateStudyData } from './useInvalidateStudyData';
export { default as useIsTablet } from './useIsTablet';
export { default as useLoadAssets } from './useLoadAssets';
export { default as useOTAUpdate } from './useOTAUpdate';
export { default as useInvalidateAll } from './useInvalidateAll';
34 changes: 34 additions & 0 deletions apps/native/src/hooks/useOTAUpdate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useEffect } from 'react';
import * as Updates from 'expo-updates';

/**
* OTA 업데이트 체크 및 적용 훅.
* 앱 시작 시 백그라운드에서 업데이트를 확인하고,
* 새 업데이트가 있으면 다음 앱 실행 시 자동 적용.
*/
const useOTAUpdate = () => {
useEffect(() => {
// 개발 환경에서는 스킵
if (__DEV__) return;

const checkForUpdate = async () => {
try {
const update = await Updates.checkForUpdateAsync();

if (update.isAvailable) {
await Updates.fetchUpdateAsync();
// 기본: 다음 앱 실행 시 적용
// 즉시 적용이 필요하면 아래 주석 해제:
// await Updates.reloadAsync();
}
} catch (error) {
// 업데이트 체크 실패는 무시 (네트워크 오류 등)
console.warn('OTA 업데이트 체크 실패:', error);
Comment thread
sterdsterd marked this conversation as resolved.
}
};

checkForUpdate();
}, []);
};

Comment thread
sterdsterd marked this conversation as resolved.
export default useOTAUpdate;
86 changes: 63 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading