Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDA-4178 Add support for SMS protocol #1893

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions installer/win/WixSharpInstaller/Symphony.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ public static ActionResult CleanRegistryCurrentUser(Session session)
{
key.DeleteSubKeyTree("symphony", false);
key.DeleteSubKeyTree("Symphony.tel", false);
key.DeleteSubKeyTree("Symphony.sms", false);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/app/child-window-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const verifyProtocolForNewUrl = (url: string): boolean => {
return false;
}

const allowedProtocols = ['http:', 'https:', 'mailto:', 'symphony:'];
const allowedProtocols = ['http:', 'https:', 'mailto:', 'symphony:', 'sms:'];
// url parse returns protocol with :
if (allowedProtocols.includes(parsedUrl.protocol)) {
logger.info(
Expand Down Expand Up @@ -207,7 +207,8 @@ export const handleChildWindow = (webContents: WebContents): void => {
webContents.on(
'did-create-window',
(browserWindow: BrowserWindow, details: DidCreateWindowDetails) => {
const newWinOptions = details.options as ICustomBrowserWindowConstructorOpts;
const newWinOptions =
details.options as ICustomBrowserWindowConstructorOpts;
const width = newWinOptions.width || DEFAULT_POP_OUT_WIDTH;
const height = newWinOptions.height || DEFAULT_POP_OUT_HEIGHT;
const newWinKey = getGuid();
Expand Down
9 changes: 7 additions & 2 deletions src/app/main-api-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,13 @@ ipcMain.on(
autoUpdate.checkUpdates();
}
break;
case apiCmds.registerVoiceServices:
voiceHandler.registerSymphonyAsDefaultCallApp();
case apiCmds.registerPhoneNumberServices:
voiceHandler.registerSymphonyAsDefaultApp(arg.protocols);
break;
case apiCmds.unregisterPhoneNumberServices:
voiceHandler.unregisterSymphonyAsDefaultApp(arg.protocols);
break;
default:
break;
}
},
Expand Down
18 changes: 13 additions & 5 deletions src/app/protocol-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { windowHandler } from './window-handler';
enum protocol {
SymphonyProtocol = 'symphony://',
TelProtocol = 'tel:',
SmsProtocol = 'sms:',
}

class ProtocolHandler {
Expand Down Expand Up @@ -87,11 +88,8 @@ class ProtocolHandler {
`protocol-handler: our protocol request is a valid url ${url}! sending request to SFE for further action!`,
);
this.preloadWebContents.send('protocol-action', url);
} else if (url?.includes('tel:')) {
this.preloadWebContents.send(
'phone-number-received',
url.split('tel:')[1],
);
} else if (url?.includes('tel:') || url?.includes('sms:')) {
this.preloadWebContents.send('phone-number-received', url);
}
}

Expand All @@ -112,6 +110,11 @@ class ProtocolHandler {
protocol.TelProtocol,
false,
);
const smsArgFromArgv = getCommandLineArgs(
argv || process.argv,
protocol.SmsProtocol,
false,
);
if (protocolUriFromArgv) {
logger.info(
`protocol-handler: we have a protocol request for the url ${protocolUriFromArgv}!`,
Expand All @@ -122,6 +125,11 @@ class ProtocolHandler {
`protocol-handler: we have a tel request for ${telArgFromArgv}!`,
);
this.sendProtocol(telArgFromArgv, isAppAlreadyOpen);
} else if (smsArgFromArgv) {
logger.info(
`protocol-handler: we have an sms request for ${smsArgFromArgv}!`,
);
this.sendProtocol(smsArgFromArgv, isAppAlreadyOpen);
}
}

Expand Down
Loading
Loading