Skip to content

Commit 27bfc65

Browse files
committed
fix: App hanging when changing passcode on iOS
- Add 300ms delay between authentication and passcode change modals - Add try-catch to handle authentication cancellation gracefully - Prevents iOS UI thread hang when two modals open back-to-back Fixes #6313
1 parent 3532447 commit 27bfc65

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

app/views/ScreenLockConfigView.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,15 @@ class ScreenLockConfigView extends React.Component<IScreenLockConfigViewProps, I
132132
changePasscode = async ({ force }: { force: boolean }) => {
133133
const { autoLock } = this.state;
134134
if (autoLock) {
135-
await handleLocalAuthentication(true);
135+
try {
136+
await handleLocalAuthentication(true);
137+
// Add a small delay to ensure the first modal is fully closed before opening the next one
138+
// This prevents the app from hanging on iOS when two modals open back-to-back
139+
await new Promise(resolve => setTimeout(resolve, 300));
140+
} catch {
141+
// User cancelled or authentication failed
142+
return;
143+
}
136144
}
137145
logEvent(events.SLC_CHANGE_PASSCODE);
138146
await changePasscode({ force });

app/views/SecurityPrivacyView.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ const SecurityPrivacyView = ({ navigation }: ISecurityPrivacyViewProps): JSX.Ele
5959

6060
const navigateToScreenLockConfigView = async () => {
6161
if (server?.autoLock) {
62-
await handleLocalAuthentication(true);
62+
try {
63+
await handleLocalAuthentication(true);
64+
// Add a small delay to prevent modal conflicts on iOS
65+
await new Promise(resolve => setTimeout(resolve, 300));
66+
} catch {
67+
// User cancelled or authentication failed
68+
return;
69+
}
6370
}
6471
navigateToScreen('ScreenLockConfigView');
6572
};

0 commit comments

Comments
 (0)