Add biometric authentication registration functionality
- Implement biometric registration methods in appBridge - Add openBiometricRegistrationPopup and closeBiometricRegistrationPopup functions - Integrate biometric registration UI in home page and auth register component - Fix TypeScript errors in useAppBridge hook 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { appBridge } from '@/utils/appBridge';
|
||||
import { DeviceInfo, LocationInfo, ContactInfo, ShareContent } from '@/types';
|
||||
import { DeviceInfo, ShareContent } from '@/types';
|
||||
|
||||
interface UseAppBridgeReturn {
|
||||
isNativeEnvironment: boolean;
|
||||
@@ -37,6 +37,14 @@ interface UseAppBridgeReturn {
|
||||
*/
|
||||
// 공유
|
||||
shareContent: (content: ShareContent) => Promise<void>;
|
||||
|
||||
// 간편 인증 등록
|
||||
registerBiometric: () => Promise<void>;
|
||||
|
||||
// 간편 인증 등록 팝업 열기
|
||||
openBiometricRegistrationPopup: () => Promise<boolean>;
|
||||
// 간편 인증 등록 팝업 닫기
|
||||
closeBiometricRegistrationPopup: () => Promise<void>;
|
||||
}
|
||||
|
||||
export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
@@ -149,6 +157,28 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
return appBridge.safeCall(() => appBridge.removeStorage(key));
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const registerBiometric = useCallback(async (): Promise<void> => {
|
||||
if (!isNativeEnvironment) {
|
||||
throw new Error('Biometric auth is only available in native environment');
|
||||
}
|
||||
return appBridge.safeCall(() => appBridge.registerBiometric());
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const openBiometricRegistrationPopup = useCallback(async (): Promise<boolean> => {
|
||||
if (!isNativeEnvironment) {
|
||||
return false;
|
||||
}
|
||||
const result = await appBridge.safeCall(() => appBridge.openBiometricRegistrationPopup(), false);
|
||||
return result || false;
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const closeBiometricRegistrationPopup = useCallback(async (): Promise<void> => {
|
||||
if (!isNativeEnvironment) {
|
||||
return;
|
||||
}
|
||||
return appBridge.safeCall(() => appBridge.closeBiometricRegistrationPopup());
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
/*
|
||||
const openCamera = useCallback(async (
|
||||
options?: { quality?: number; allowEdit?: boolean }
|
||||
@@ -265,6 +295,9 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
getLocation,
|
||||
getContacts,
|
||||
*/
|
||||
shareContent
|
||||
shareContent,
|
||||
registerBiometric,
|
||||
openBiometricRegistrationPopup,
|
||||
closeBiometricRegistrationPopup
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user