From 34fbe4b43cee99c172a2f9ccff6b5c36fa4a26b3 Mon Sep 17 00:00:00 2001 From: Jack Greenlee Date: Mon, 9 Dec 2024 14:59:59 -0500 Subject: [PATCH] allow paste opcode to continue if clipboard Cordova plugin is missing Until we generate a new release of em-devapp, it does not have the cordova clipboard plugin. To make local development easier I'm adding this small change that will allow auto-paste to be no-op if the clipboard plugin is not present; we then fall back to manual text entry of the opcode --- www/js/onboarding/WelcomePage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/js/onboarding/WelcomePage.tsx b/www/js/onboarding/WelcomePage.tsx index ff8214578..36b27ded8 100644 --- a/www/js/onboarding/WelcomePage.tsx +++ b/www/js/onboarding/WelcomePage.tsx @@ -62,7 +62,9 @@ const WelcomePage = () => { } function pasteCode() { - window['cordova'].plugins.clipboard.paste((clipboardContent: string) => { + // if clipboard plugin not available, the callback will be a no-op + const pasteFn = window['cordova'].plugins.clipboard?.paste || ((cb) => cb('')); + pasteFn((clipboardContent: string) => { addStatReading('paste_token'); try { if (!clipboardContent?.startsWith('nrelop_') && !clipboardContent?.includes('://')) {