앱브리지 getLoginType 메소드 추가 및 로그인 방식 설정 초기화
- 앱브리지에 getLoginType 메소드 추가 - 설정 페이지에서 로그인 방식을 앱에서 가져와 초기화 - 로그인 타입을 지문/안면에서 생체 인증으로 통합 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -52,13 +52,9 @@ export const LoginTypeBottomSheet = ({
|
||||
onClick={ () => onChangeLoginType(LoginType.ID) }
|
||||
>{ APP_LOGIN_TYPE[LoginType.ID] }</li>
|
||||
<li
|
||||
className={ `${(loginType === LoginType.FINGER)? 'selected': ''}` }
|
||||
onClick={ () => onChangeLoginType(LoginType.FINGER) }
|
||||
>{ APP_LOGIN_TYPE[LoginType.FINGER] }</li>
|
||||
<li
|
||||
className={ `${(loginType === LoginType.FACE)? 'selected': ''}` }
|
||||
onClick={ () => onChangeLoginType(LoginType.FACE) }
|
||||
>{ APP_LOGIN_TYPE[LoginType.FACE] }</li>
|
||||
className={ `${(loginType === LoginType.BIOMETRIC)? 'selected': ''}` }
|
||||
onClick={ () => onChangeLoginType(LoginType.BIOMETRIC) }
|
||||
>{ APP_LOGIN_TYPE[LoginType.BIOMETRIC] }</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,7 @@ export const APP_LANGUAGE = {
|
||||
};
|
||||
export const APP_LOGIN_TYPE = {
|
||||
ID: 'ID/PW 입력',
|
||||
FINGER: '지문 인증',
|
||||
FACE: '안면 인증'
|
||||
BIOMETRIC: '생체 인증',
|
||||
};
|
||||
export const DEFAULT_PAGE_PARAM = {
|
||||
cursor: null,
|
||||
|
||||
@@ -5,8 +5,7 @@ export enum AppLanguage {
|
||||
};
|
||||
export enum LoginType {
|
||||
ID = 'ID',
|
||||
FINGER = 'FINGER',
|
||||
FACE = 'FACE'
|
||||
BIOMETRIC = 'BIOMETRIC',
|
||||
};
|
||||
export enum SuccessResult {
|
||||
SUCCESS = 'SUCCESS',
|
||||
|
||||
@@ -59,6 +59,9 @@ interface UseAppBridgeReturn {
|
||||
|
||||
// 앱 설정 화면 열기
|
||||
openAppSettings: () => Promise<void>;
|
||||
|
||||
// 로그인 방식 설정 조회
|
||||
getLoginType: () => Promise<string>;
|
||||
}
|
||||
|
||||
export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
@@ -250,6 +253,14 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
return appBridge.safeCall(() => appBridge.openAppSettings());
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const getLoginType = useCallback(async (): Promise<string> => {
|
||||
if (!isNativeEnvironment) {
|
||||
return 'ID';
|
||||
}
|
||||
const result = await appBridge.safeCall(() => appBridge.getLoginType(), 'ID');
|
||||
return result || 'ID';
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
return {
|
||||
isNativeEnvironment,
|
||||
isAndroid,
|
||||
@@ -272,6 +283,7 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
openBiometricRegistrationPopup,
|
||||
closeBiometricRegistrationPopup,
|
||||
isPushNotificationEnabled,
|
||||
openAppSettings
|
||||
openAppSettings,
|
||||
getLoginType
|
||||
};
|
||||
};
|
||||
@@ -11,12 +11,12 @@ import {
|
||||
useSetHeaderType,
|
||||
useSetFooterMode
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import { ChangeEvent, useEffect, useState } from 'react';
|
||||
import { ChangeEvent, useCallback, useEffect, useState } from 'react';
|
||||
import { useAppBridge } from '@/hooks/useAppBridge';
|
||||
|
||||
export const SettingPage = () => {
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
const { isPushNotificationEnabled, openAppSettings } = useAppBridge();
|
||||
const { isPushNotificationEnabled, openAppSettings, logout, getLoginType } = useAppBridge();
|
||||
|
||||
useSetHeaderTitle('설정');
|
||||
useSetHeaderType(HeaderType.LeftArrow);
|
||||
@@ -45,11 +45,22 @@ export const SettingPage = () => {
|
||||
window.open('https://www.nicevan.co.kr/privacy-policy', '_blank');
|
||||
};
|
||||
|
||||
const checkPushNotificationStatus = () => {
|
||||
const onClickLogout = () => {
|
||||
logout();
|
||||
};
|
||||
|
||||
const checkPushNotificationStatus = useCallback(() => {
|
||||
console.log('checkPushNotificationStatus');
|
||||
isPushNotificationEnabled().then((enabled) => {
|
||||
setPushNotificationEnabled(enabled);
|
||||
});
|
||||
};
|
||||
}, [isPushNotificationEnabled]);
|
||||
|
||||
const loadLoginType = useCallback(() => {
|
||||
getLoginType().then((type) => {
|
||||
setLoginType(type as LoginType);
|
||||
});
|
||||
}, [getLoginType]);
|
||||
|
||||
const onClickPushNotificationToggle = () => {
|
||||
openAppSettings();
|
||||
@@ -103,6 +114,7 @@ export const SettingPage = () => {
|
||||
useEffect(() => {
|
||||
callAppAlarmFind();
|
||||
checkPushNotificationStatus();
|
||||
loadLoginType();
|
||||
|
||||
// 앱이 포어그라운드로 돌아올 때 푸시 알림 권한 상태 재확인
|
||||
const handleVisibilityChange = () => {
|
||||
@@ -122,7 +134,7 @@ export const SettingPage = () => {
|
||||
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
||||
window.removeEventListener('focus', handleFocus);
|
||||
};
|
||||
}, []);
|
||||
}, [checkPushNotificationStatus, loadLoginType]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -131,7 +143,12 @@ export const SettingPage = () => {
|
||||
<div className="settings-header">
|
||||
<div className="settings-title">알림 수신 설정</div>
|
||||
<label className="settings-switch" onClick={onClickPushNotificationToggle}>
|
||||
<input type="checkbox" checked={pushNotificationEnabled} readOnly />
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={pushNotificationEnabled}
|
||||
readOnly
|
||||
onClick={(e) => e.preventDefault()}
|
||||
/>
|
||||
<span className="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -252,7 +269,7 @@ export const SettingPage = () => {
|
||||
|
||||
<div className="settings-divider"></div>
|
||||
|
||||
<div className="settings-row danger">
|
||||
<div className="settings-row danger" onClick={onClickLogout}>
|
||||
<div className="settings-row-title bd-style">로그아웃</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -71,7 +71,10 @@ export enum BridgeMessageType {
|
||||
IS_PUSH_NOTIFICATION_ENABLED = 'isPushNotificationEnabled',
|
||||
|
||||
// 앱 설정 화면 열기
|
||||
OPEN_APP_SETTINGS = 'openAppSettings'
|
||||
OPEN_APP_SETTINGS = 'openAppSettings',
|
||||
|
||||
// 로그인 방식 설정
|
||||
GET_LOGIN_TYPE = 'getLoginType'
|
||||
}
|
||||
|
||||
export interface DeviceInfo {
|
||||
|
||||
@@ -205,6 +205,11 @@ class AppBridge {
|
||||
return this.sendMessage(BridgeMessageType.OPEN_APP_SETTINGS);
|
||||
}
|
||||
|
||||
// 로그인 방식 설정 조회
|
||||
async getLoginType(): Promise<string> {
|
||||
return this.sendMessage(BridgeMessageType.GET_LOGIN_TYPE);
|
||||
}
|
||||
|
||||
// 네이티브 환경 체크
|
||||
isNativeEnvironment(): boolean {
|
||||
return !!(
|
||||
|
||||
Reference in New Issue
Block a user