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
62 changes: 30 additions & 32 deletions Time-Up/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ import SetRemindAlarmPage from './src/pages/SetPage/SetRemindAlarmPage';
import SetScheduleRepeatPage from './src/pages/SetScheduleRepeatPage';
import ViewScheduleDetailPage from './src/pages/ViewScheduleDetailPage';

import { saveFCMPushToken } from './src/apis/pushToken';
import { getAccessToken } from './src/utils/storage';
import { requestWebPushToken } from './src/utils/webPush';

const queryClient = new QueryClient();

Expand Down Expand Up @@ -113,36 +111,36 @@ export default function App() {
// return () => { cancelled = true; };
// }, []);

useEffect(() => {
if (Platform.OS !== 'web') return;
if (webPushInitRef.current) return;
webPushInitRef.current = true;
let cancelled = false;

(async () => {
try {
const token = await requestWebPushToken();
if (!token || cancelled) {
console.warn('웹 푸시 권한 거부 또는 토큰 없음');
return;
}
console.log('Web FCM Token:', token);

const res = await saveFCMPushToken(token);
if ((res as any)?.result === 'Error') {
console.warn('웹 push-token 저장 실패:', (res as any)?.error);
} else {
console.log('웹 push-token 저장 성공');
}
} catch (e) {
console.warn('웹 푸시 토큰 발급/저장 실패:', e);
}
})();

return () => {
cancelled = true;
};
}, []);
// useEffect(() => {
// if (Platform.OS !== 'web') return;
// if (webPushInitRef.current) return;
// webPushInitRef.current = true;
// let cancelled = false;

// (async () => {
// try {
// const token = await requestWebPushToken();
// if (!token || cancelled) {
// console.warn('웹 푸시 권한 거부 또는 토큰 없음');
// return;
// }
// console.log('Web FCM Token:', token);

// const res = await saveFCMPushToken(token);
// if ((res as any)?.result === 'Error') {
// console.warn('웹 push-token 저장 실패:', (res as any)?.error);
// } else {
// console.log('웹 push-token 저장 성공');
// }
// } catch (e) {
// console.warn('웹 푸시 토큰 발급/저장 실패:', e);
// }
// })();

// return () => {
// cancelled = true;
// };
// }, []);

if (!mapsLoaded || !initialRoute) return null;
const content = (
Expand Down
5 changes: 3 additions & 2 deletions Time-Up/src/pages/Alarm/My/EditMyAlarmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Alert, Dimensions, Platform, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { Calendar } from 'react-native-calendars';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { GestureHandlerRootView, ScrollView } from 'react-native-gesture-handler';

import IconBiv from '../../../../assets/images/AlarmBiv.svg';
import IconMemo from '../../../../assets/images/AlarmMemo.svg';
Expand Down Expand Up @@ -90,7 +90,7 @@
} catch (error: any) {
const status = error?.response?.status;
const apiErr = error?.response?.data?.error;
const apiMsg = error?.response?.data?.message;

Check warning on line 93 in Time-Up/src/pages/Alarm/My/EditMyAlarmPage.tsx

View workflow job for this annotation

GitHub Actions / Lint & Type Check

'apiMsg' is assigned a value but never used

if ((status === 422 || status === 400) &&
(apiErr === 'BusinessLogicError')) {
Expand All @@ -115,7 +115,7 @@
} catch (error) {
console.error(`알람 ${selectedAlarmId} 상태 토글 실패:`, error);
}
}, [selectedAlarmId, isActive]);

Check warning on line 118 in Time-Up/src/pages/Alarm/My/EditMyAlarmPage.tsx

View workflow job for this annotation

GitHub Actions / Lint & Type Check

React Hook useCallback has missing dependencies: 'toggleMyAlarmActivation' and 'updateAlarmField'. Either include them or remove the dependency array

const handleSelectSound = () => {
navigation.navigate('SelectMyAlarmSoundPage');
Expand Down Expand Up @@ -194,6 +194,7 @@
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<BottomLayout>
<ScrollView>
<BottomSheetModal
ref={bottomSheetModalRef}
snapPoints={snapPoints}
Expand Down Expand Up @@ -469,7 +470,7 @@
<AlarmButton title="취소" onPress={handleCancel} backgroundColor="#1C1F21" textColor="#CFD3D7" style={{ width: 120, height: 48 }} />
<AlarmButton title="저장" onPress={handleSave} backgroundColor="#CCCCFF" textColor="black" style={{ width: 120, height: 48 }} />
</View>

</ScrollView>
</BottomLayout>
</GestureHandlerRootView>
);
Expand Down
4 changes: 3 additions & 1 deletion Time-Up/src/pages/Alarm/My/MyAlarmDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ToggleSwitch from '../../../components/common/ToggleSwitch';
import useAppNavigation from '../../../hooks/useAppNavigation';
import BottomLayout from '../../../Layouts/BottomLayout';

import { ScrollView } from 'react-native-gesture-handler';
import IconBiv from '../../../../assets/images/AlarmBiv.svg';
import IconMemo from '../../../../assets/images/AlarmMemo.svg';
import IconMusic from '../../../../assets/images/AlarmMusic.svg';
Expand Down Expand Up @@ -79,6 +80,7 @@ export default function MyAlarmDetailPage() {

return (
<BottomLayout>
<ScrollView>
<View className="flex-row items-center justify-between mr-[4%]" style={{ marginTop: Platform.OS === 'web' ? 30 : 0 }}>
<PageBackButton goTo="MyAlarmPage" />
<Text className="font-pretendard text-white text-[24px] mr-[4%]" style={{ width: Platform.OS === 'web' ? 300 : 210 }}>{alarm.title}</Text>
Expand Down Expand Up @@ -174,7 +176,7 @@ export default function MyAlarmDetailPage() {
<AlarmButton title="삭제" onPress={handleDelete} backgroundColor="#1C1F21" textColor="#CFD3D7" style={{ width: 120, height: 48 }} />
<AlarmButton title="편집" onPress={handleEdit} backgroundColor="#CCCCFF" textColor="black" style={{ width: 120, height: 48 }} />
</View>

</ScrollView>
</BottomLayout>
);
}
5 changes: 3 additions & 2 deletions Time-Up/src/pages/Alarm/WakeUp/EditWakeUpAlarmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AlarmItem } from '@/src/types/alarm';
import { toPutWakeupAlarmRequest } from '@/src/utils/alarmTransform';
import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet';
import React, { useCallback, useMemo, useRef, useState } from 'react';
import { Dimensions, Platform, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { Dimensions, Platform, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import ToggleSwitch from '../../../components/common/ToggleSwitch';
import { Day, useAlarmContext } from '../../../contexts/AlarmContext';
Expand Down Expand Up @@ -159,6 +159,7 @@ export default function EditWakeUpAlarmPage() {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<BottomLayout>
<ScrollView>
<BottomSheetModal
ref={bottomSheetModalRef}
snapPoints={snapPoints}
Expand Down Expand Up @@ -355,12 +356,12 @@ export default function EditWakeUpAlarmPage() {
</View>
</View>

</ScrollView>

<View className="flex-row items-center justify-center gap-10 -mt-[4%]">
<AlarmButton title="취소" onPress={handleCancel} backgroundColor="#1C1F21" textColor="#CFD3D7" style={{ width: 120, height: 48 }} />
<AlarmButton title="저장" onPress={handleSave} backgroundColor="#CCCCFF" textColor="black" style={{ width: 120, height: 48 }} />
</View>

</BottomLayout>
</GestureHandlerRootView>
);
Expand Down
4 changes: 3 additions & 1 deletion Time-Up/src/pages/Alarm/WakeUp/WakeUpAlarmDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Day, useAlarmContext } from '../../../contexts/AlarmContext';
import useAppNavigation from '../../../hooks/useAppNavigation';
import BottomLayout from '../../../Layouts/BottomLayout';

import { ScrollView } from 'react-native-gesture-handler';
import IconBiv from '../../../../assets/images/AlarmBiv.svg';
import IconCalendar from '../../../../assets/images/AlarmCalendar.svg';
import IconMemo from '../../../../assets/images/AlarmMemo.svg';
Expand Down Expand Up @@ -52,6 +53,7 @@ export default function WakeUpAlarmDetailPage() {

return (
<BottomLayout>
<ScrollView>
<View className="flex-row items-center justify-between mr-[4%]"
style={{ marginTop: Platform.OS === 'web' ? 30 : 15 }}>
<PageBackButton goTo="WakeUpAlarmPage" />
Expand Down Expand Up @@ -183,7 +185,7 @@ export default function WakeUpAlarmDetailPage() {
<View className="flex-row items-center justify-center -mt-[6%]">
<AlarmButton title="편집" onPress={handleEdit} backgroundColor="#CCCCFF" textColor="black" style={{ width: 120, height: 48 }} />
</View>

</ScrollView>
</BottomLayout>
);
}
7 changes: 3 additions & 4 deletions Time-Up/src/pages/Alarm/WakeUp/WakeUpAlarmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export default function WakeUpAlarmPage() {
};
const formatAutoTimeLine = (iso: string) => {
const d = new Date(iso);
const h = d.getHours();
const m = d.getMinutes();
const h = d.getUTCHours();
const m = d.getUTCMinutes();
const period = h < 12 ? '오전' : '오후';
const hh = (h % 12) || 12;
return `${period} ${String(hh).padStart(2, '0')} : ${String(m).padStart(2, '0')}`;
Expand Down Expand Up @@ -199,12 +199,11 @@ export default function WakeUpAlarmPage() {
내 알람
</Text>
</View>
<ScrollView>
<View className="flex-row items-start mt-2">
<View className="h-[2px] w-[21%] bg-white ml-[4%]" />
<View className="h-[2px] w-[15%] bg-black ml-[4%]" />
</View>

<ScrollView>
<View className="mt-3">
{weekdays.map((day) => {
const alarm = wakeupAlarms.find((a) => a.date.dayOfWeek === day);
Expand Down
Loading