mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
Fix proof messaging (#487)
* rename handleProofVerified to handleProofResult * from the app, call proof_verified or proof_generation_failed instead of always proof_verified * messaging for when proof fails * bump sdk version * yarn nice
This commit is contained in:
@@ -57,7 +57,7 @@ export default function Disclosures({ disclosures }: DisclosureProps) {
|
||||
break;
|
||||
case 'excludedCountries':
|
||||
text = `I am not a citizen of the following countries: ${countriesToSentence(
|
||||
disclosures.excludedCountries as Country3LetterCode[] || [],
|
||||
(disclosures.excludedCountries as Country3LetterCode[]) || [],
|
||||
)}`;
|
||||
break;
|
||||
case 'minimumAge':
|
||||
|
||||
@@ -42,7 +42,7 @@ const ProveScreen: React.FC = () => {
|
||||
const { navigate } = useNavigation();
|
||||
const { getPassportDataAndSecret } = usePassport();
|
||||
const { selectedApp, resetProof, cleanSelfApp } = useProofInfo();
|
||||
const { handleProofVerified } = useApp();
|
||||
const { handleProofResult } = useApp();
|
||||
const selectedAppRef = useRef(selectedApp);
|
||||
const isProcessing = useRef(false);
|
||||
|
||||
@@ -168,7 +168,7 @@ const ProveScreen: React.FC = () => {
|
||||
passportData,
|
||||
currentApp,
|
||||
);
|
||||
handleProofVerified(
|
||||
handleProofResult(
|
||||
currentApp.sessionId,
|
||||
status === ProofStatusEnum.SUCCESS,
|
||||
);
|
||||
@@ -179,7 +179,7 @@ const ProveScreen: React.FC = () => {
|
||||
isProcessing.current = false;
|
||||
}
|
||||
},
|
||||
[navigate, getPassportDataAndSecret, handleProofVerified, resetProof],
|
||||
[navigate, getPassportDataAndSecret, handleProofResult, resetProof],
|
||||
);
|
||||
|
||||
const handleScroll = useCallback(
|
||||
|
||||
@@ -28,12 +28,12 @@ interface IAppContext {
|
||||
* @param sessionId - The session ID from the scanned QR code.
|
||||
* @param success - Whether the proof was verified successfully.
|
||||
*/
|
||||
handleProofVerified: (sessionId: string, success: boolean) => void;
|
||||
handleProofResult: (sessionId: string, success: boolean) => void;
|
||||
}
|
||||
|
||||
const AppContext = createContext<IAppContext>({
|
||||
startAppListener: () => {},
|
||||
handleProofVerified: () => {},
|
||||
handleProofResult: () => {},
|
||||
});
|
||||
|
||||
const initSocket = (sessionId: string) => {
|
||||
@@ -120,9 +120,9 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleProofVerified = (sessionId: string, proof_verified: boolean) => {
|
||||
const handleProofResult = (sessionId: string, proof_verified: boolean) => {
|
||||
console.log(
|
||||
'[AppProvider] handleProofVerified called with sessionId:',
|
||||
'[AppProvider] handleProofResult called with sessionId:',
|
||||
sessionId,
|
||||
);
|
||||
|
||||
@@ -130,15 +130,26 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
socketRef.current = initSocket(sessionId);
|
||||
}
|
||||
|
||||
console.log('[AppProvider] Emitting proof_verified event with data:', {
|
||||
session_id: sessionId,
|
||||
proof_verified,
|
||||
});
|
||||
if (proof_verified) {
|
||||
console.log('[AppProvider] Emitting proof_verified event with data:', {
|
||||
session_id: sessionId,
|
||||
});
|
||||
|
||||
socketRef.current.emit('proof_verified', {
|
||||
session_id: sessionId,
|
||||
proof_verified,
|
||||
});
|
||||
socketRef.current.emit('proof_verified', {
|
||||
session_id: sessionId,
|
||||
});
|
||||
} else {
|
||||
console.log(
|
||||
'[AppProvider] Emitting proof_generation_failed event with data:',
|
||||
{
|
||||
session_id: sessionId,
|
||||
},
|
||||
);
|
||||
|
||||
socketRef.current.emit('proof_generation_failed', {
|
||||
session_id: sessionId,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -151,7 +162,7 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<AppContext.Provider value={{ startAppListener, handleProofVerified }}>
|
||||
<AppContext.Provider value={{ startAppListener, handleProofResult }}>
|
||||
{children}
|
||||
</AppContext.Provider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user