From 955e2d2f1eaa270d4eb6a7a167aad2f6006ab6ea Mon Sep 17 00:00:00 2001 From: George Lima Date: Fri, 15 Feb 2019 12:14:09 -0300 Subject: [PATCH] chore(deeplink): export searchUriInArgv --- config/handle-deeplink.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config/handle-deeplink.js b/config/handle-deeplink.js index 98c1ce1..d423cf7 100644 --- a/config/handle-deeplink.js +++ b/config/handle-deeplink.js @@ -11,6 +11,11 @@ const sendMessage = (mainWindow, url) => { } }; +export const searchUriInArgv = (argv: string[]): ?string => { + const argIndex = argv.findIndex(item => /zcash:(\/\/)?/.test(item)); + return argv[argIndex]; +}; + export const handleDeeplink = ({ app, mainWindow, @@ -30,7 +35,10 @@ export const handleDeeplink = ({ } if (process.platform === 'win32' || process.platform === 'linux') { - const argIndex = argv.findIndex(item => /zcash:(\/\/)?/.test(item)); - if (argIndex !== -1) sendMessage(mainWindow, argv[argIndex]); + const arg = searchUriInArgv(argv); + + if (arg) { + sendMessage(mainWindow, arg); + } } };