chore(deeplink): export searchUriInArgv

This commit is contained in:
George Lima 2019-02-15 12:14:09 -03:00
parent b3c277f7fe
commit 955e2d2f1e
1 changed files with 10 additions and 2 deletions

View File

@ -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);
}
}
};