Update blue_modules/clipboard.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Marcos Rodriguez Vélez 2024-11-10 10:50:42 -04:00 committed by GitHub
parent f77df0e949
commit 048ac83bf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,8 +17,13 @@ export const isReadClipboardAllowed = async (): Promise<boolean> => {
} }
}; };
export const setReadClipboardAllowed = (value: boolean): Promise<void> => { export const setReadClipboardAllowed = async (value: boolean): Promise<void> => {
return AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(!!value)); try {
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(Boolean(value)));
} catch (error) {
console.error('Failed to set clipboard permission:', error);
throw error;
}
}; };
export const getClipboardContent = async (): Promise<string | undefined> => { export const getClipboardContent = async (): Promise<string | undefined> => {