로그인 타입 설정 개선 및 생체인증 등록 플로우 수정
- registerBiometric으로 변경하고 bottomsheet 닫은 후 생체인증 팝업 표시 - ID 로그인 선택 시 네이티브 setLoginType AppBridge 호출 추가 - 생체인증 등록 완료 후 로그인 타입 재조회하여 설정 화면 갱신 - SET_LOGIN_TYPE 브릿지 메시지 타입 및 관련 메서드 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -8,16 +8,17 @@ export interface LoginTypeBottomSheetProps {
|
||||
setLoginTypeBottomSheetOn: (loginTypeBottomSheetOn: boolean) => void;
|
||||
loginType: LoginType;
|
||||
setLoginType: (loginType: string) => void;
|
||||
onBiometricRegistered?: () => void;
|
||||
};
|
||||
|
||||
export const LoginTypeBottomSheet = ({
|
||||
loginTypeBottomSheetOn,
|
||||
setLoginTypeBottomSheetOn,
|
||||
loginType,
|
||||
setLoginType
|
||||
setLoginType,
|
||||
onBiometricRegistered
|
||||
}: LoginTypeBottomSheetProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { openBiometricRegistrationPopup } = useAppBridge();
|
||||
const { registerBiometric, setLoginType: setLoginTypeNative } = useAppBridge();
|
||||
|
||||
const onClickToClose = () => {
|
||||
setLoginTypeBottomSheetOn(false);
|
||||
@@ -25,12 +26,21 @@ export const LoginTypeBottomSheet = ({
|
||||
const onChangeLoginType = async (type: string) => {
|
||||
if (loginType !== type) {
|
||||
if (type === 'BIOMETRIC') {
|
||||
await openBiometricRegistrationPopup();
|
||||
onClickToClose();
|
||||
registerBiometric().then(() => {
|
||||
onBiometricRegistered?.();
|
||||
}).catch(() => {
|
||||
// 에러 처리
|
||||
});
|
||||
} else {
|
||||
setLoginType(type);
|
||||
setLoginTypeNative(type).then(() => {
|
||||
setLoginType(type);
|
||||
onClickToClose();
|
||||
}).catch(() => {
|
||||
onClickToClose();
|
||||
});
|
||||
}
|
||||
}
|
||||
onClickToClose();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -63,6 +63,9 @@ interface UseAppBridgeReturn {
|
||||
// 로그인 방식 설정 조회
|
||||
getLoginType: () => Promise<string>;
|
||||
|
||||
// 로그인 방식 설정
|
||||
setLoginType: (type: string) => Promise<void>;
|
||||
|
||||
getNotificationSetting: () => Promise<boolean>;
|
||||
|
||||
setNotificationSetting: (enabled: boolean) => Promise<NotificationSettingResponse>;
|
||||
@@ -305,6 +308,13 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
return result || 'ko';
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const setLoginType = useCallback(async (type: string): Promise<void> => {
|
||||
if (!isNativeEnvironment) {
|
||||
return;
|
||||
}
|
||||
return appBridge.safeCall(() => appBridge.setLoginType(type));
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
return {
|
||||
isNativeEnvironment,
|
||||
isAndroid,
|
||||
@@ -329,6 +339,7 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
isPushNotificationEnabled,
|
||||
openAppSettings,
|
||||
getLoginType,
|
||||
setLoginType,
|
||||
getNotificationSetting,
|
||||
setNotificationSetting,
|
||||
getLanguage
|
||||
|
||||
@@ -439,6 +439,7 @@ export const SettingPage = () => {
|
||||
setLoginTypeBottomSheetOn={ setLoginTypeBottomSheetOn }
|
||||
loginType={ loginType }
|
||||
setLoginType={ handleSetLoginType }
|
||||
onBiometricRegistered={ loadLoginType }
|
||||
></LoginTypeBottomSheet>
|
||||
}
|
||||
{ !!serviceLanguageBottomSheetOn &&
|
||||
|
||||
@@ -75,6 +75,7 @@ export enum BridgeMessageType {
|
||||
|
||||
// 로그인 방식 설정
|
||||
GET_LOGIN_TYPE = 'getLoginType',
|
||||
SET_LOGIN_TYPE = 'setLoginType',
|
||||
|
||||
// 알림 수신 설정 (Android only)
|
||||
GET_NOTIFICATION_SETTING = 'getNotificationSetting',
|
||||
|
||||
@@ -210,6 +210,11 @@ class AppBridge {
|
||||
return this.sendMessage(BridgeMessageType.GET_LOGIN_TYPE);
|
||||
}
|
||||
|
||||
// 로그인 방식 설정
|
||||
async setLoginType(type: string): Promise<void> {
|
||||
return this.sendMessage(BridgeMessageType.SET_LOGIN_TYPE, { type });
|
||||
}
|
||||
|
||||
// 알림 수신 설정 가져오기 (Android only)
|
||||
async getNotificationSetting(): Promise<{ enabled: boolean }> {
|
||||
return this.sendMessage(BridgeMessageType.GET_NOTIFICATION_SETTING);
|
||||
|
||||
Reference in New Issue
Block a user