-불필요 코드 삭제
This commit is contained in:
@@ -9,7 +9,6 @@ export interface LoginTypeBottomSheetProps {
|
|||||||
loginType: LoginType;
|
loginType: LoginType;
|
||||||
setLoginType: (loginType: string) => void;
|
setLoginType: (loginType: string) => void;
|
||||||
onBiometricRegistered?: () => void;
|
onBiometricRegistered?: () => void;
|
||||||
isAndroid: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LoginTypeBottomSheet = ({
|
export const LoginTypeBottomSheet = ({
|
||||||
@@ -17,7 +16,6 @@ export const LoginTypeBottomSheet = ({
|
|||||||
loginType,
|
loginType,
|
||||||
setLoginType,
|
setLoginType,
|
||||||
onBiometricRegistered,
|
onBiometricRegistered,
|
||||||
isAndroid
|
|
||||||
}: LoginTypeBottomSheetProps) => {
|
}: LoginTypeBottomSheetProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { registerBiometric, setLoginType: setLoginTypeNative } = useAppBridge();
|
const { registerBiometric, setLoginType: setLoginTypeNative } = useAppBridge();
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ const callSettingSave = () => {
|
|||||||
snackBar(`[${t('common.failed')}] ${rs.error?.message}`)
|
snackBar(`[${t('common.failed')}] ${rs.error?.message}`)
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
const failReason = e?.response?.data?.message || e?.message || t('additionalService.alimtalk.unknownError');
|
const failReason = e?.response?.data?.error?.message || e?.message || t('additionalService.alimtalk.unknownError');
|
||||||
console.log(e)
|
console.log(e)
|
||||||
if (e.response?.data?.error?.root !== "SystemErrorCode") {
|
if (e.response?.data?.error?.root !== "SystemErrorCode") {
|
||||||
snackBar(`[${t('common.failed')}] ${failReason}`);
|
snackBar(`[${t('common.failed')}] ${failReason}`);
|
||||||
|
|||||||
@@ -92,94 +92,11 @@ export const SettingPage = () => {
|
|||||||
});
|
});
|
||||||
}, [getLoginType]);
|
}, [getLoginType]);
|
||||||
|
|
||||||
const loadLanguage = useCallback(() => {
|
|
||||||
getLanguage().then((language) => {
|
|
||||||
const languageType = language === 'en' ? AppLanguage.EN : AppLanguage.KO;
|
|
||||||
setAppLanguage(languageType);
|
|
||||||
// i18n 언어도 동기화
|
|
||||||
if (i18n.language !== language) {
|
|
||||||
i18n.changeLanguage(language);
|
|
||||||
localStorage.setItem('i18nextLng', language);
|
|
||||||
}
|
|
||||||
}).catch((e: any) => {
|
|
||||||
if(e.response?.data?.error?.message){
|
|
||||||
snackBar(e.response?.data?.error?.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, [getLanguage, i18n]);
|
|
||||||
|
|
||||||
const onClickPushNotificationToggle = () => {
|
const onClickPushNotificationToggle = () => {
|
||||||
openAppSettings();
|
openAppSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 알림 설정 로드 (Android만)
|
|
||||||
const loadNotificationSetting = useCallback(async () => {
|
|
||||||
if (!isAndroid) {
|
|
||||||
console.log('[loadNotificationSetting] Not Android, skipping');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
console.log('[loadNotificationSetting] Calling getNotificationSetting()...');
|
|
||||||
const enabled = await getNotificationSetting();
|
|
||||||
console.log('[loadNotificationSetting] Received value from bridge:', enabled);
|
|
||||||
console.log('[loadNotificationSetting] Type of enabled:', typeof enabled);
|
|
||||||
|
|
||||||
setNotificationSetting(enabled);
|
|
||||||
console.log('[loadNotificationSetting] State updated to:', enabled);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('[loadNotificationSetting] Failed to load notification setting:', error);
|
|
||||||
}
|
|
||||||
}, [isAndroid, getNotificationSetting]);
|
|
||||||
|
|
||||||
// 알림 설정 토글 핸들러 (Android만)
|
|
||||||
const onClickNotificationSettingToggle = useCallback(async () => {
|
|
||||||
if (!isAndroid) {
|
|
||||||
console.log('[onClickNotificationSettingToggle] Not Android, skipping');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const newValue = !notificationSetting;
|
|
||||||
console.log('[onClickNotificationSettingToggle] to save:', newValue);
|
|
||||||
|
|
||||||
const result = await updateNotificationSetting(newValue);
|
|
||||||
console.log('[onClickNotificationSettingToggle] result:', result);
|
|
||||||
|
|
||||||
// ✅ needsPermission이 true이면 설정 화면으로 이동한 것
|
|
||||||
if (result && typeof result === 'object' && 'needsPermission' in result && result.needsPermission) {
|
|
||||||
console.log('[onClickNotificationSettingToggle] Permission needed - opened settings');
|
|
||||||
// 설정이 변경되지 않았으므로 상태 유지
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ✅ 성공한 경우에만 상태 업데이트
|
|
||||||
if (result && typeof result === 'object' && 'enabled' in result) {
|
|
||||||
setNotificationSetting(result.enabled);
|
|
||||||
console.log('[onClickNotificationSettingToggle] State updated to:', result.enabled);
|
|
||||||
} else {
|
|
||||||
// Fallback
|
|
||||||
setNotificationSetting(newValue);
|
|
||||||
console.log('[onClickNotificationSettingToggle] State updated to (fallback):', newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ✅ 저장 후 바로 다시 읽어서 확인
|
|
||||||
console.log('[onClickNotificationSettingToggle] Verifying saved value...');
|
|
||||||
const verifyValue = await getNotificationSetting();
|
|
||||||
console.log('[onClickNotificationSettingToggle] Verified value:', verifyValue);
|
|
||||||
|
|
||||||
if (verifyValue !== result?.enabled && !result?.needsPermission) {
|
|
||||||
console.error('[onClickNotificationSettingToggle] WARNING: Saved value != Verified value', {
|
|
||||||
saved: result?.enabled,
|
|
||||||
verified: verifyValue
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('[onClickNotificationSettingToggle] Failed to update notification setting:', error);
|
|
||||||
}
|
|
||||||
}, [isAndroid, notificationSetting, updateNotificationSetting, getNotificationSetting]);
|
|
||||||
|
|
||||||
const responseAlarmSetting = useCallback((data: AppAlarmFindResponse) => {
|
const responseAlarmSetting = useCallback((data: AppAlarmFindResponse) => {
|
||||||
let responseAlarms: Record<string, boolean> = {};
|
let responseAlarms: Record<string, boolean> = {};
|
||||||
for(let i=0;i<data.alarmAgree.length;i++){
|
for(let i=0;i<data.alarmAgree.length;i++){
|
||||||
@@ -454,7 +371,6 @@ export const SettingPage = () => {
|
|||||||
loginType={ loginType }
|
loginType={ loginType }
|
||||||
setLoginType={ handleSetLoginType }
|
setLoginType={ handleSetLoginType }
|
||||||
onBiometricRegistered={ loadLoginType }
|
onBiometricRegistered={ loadLoginType }
|
||||||
isAndroid={ isAndroid }
|
|
||||||
></LoginTypeBottomSheet>
|
></LoginTypeBottomSheet>
|
||||||
}
|
}
|
||||||
{ !!serviceLanguageBottomSheetOn &&
|
{ !!serviceLanguageBottomSheetOn &&
|
||||||
|
|||||||
Reference in New Issue
Block a user