Refactor Signal app routing
This commit is contained in:
parent
86e6c2499c
commit
3ef0d221d1
28 changed files with 1347 additions and 1044 deletions
18
ts/CI.ts
18
ts/CI.ts
|
@ -9,6 +9,8 @@ import * as log from './logging/log';
|
|||
import { explodePromise } from './util/explodePromise';
|
||||
import { ipcInvoke } from './sql/channels';
|
||||
import { SECOND } from './util/durations';
|
||||
import { isSignalRoute } from './util/signalRoutes';
|
||||
import { strictAssert } from './util/assert';
|
||||
|
||||
type ResolveType = (data: unknown) => void;
|
||||
|
||||
|
@ -28,6 +30,7 @@ export type CIType = {
|
|||
ignorePastEvents?: boolean;
|
||||
}
|
||||
) => unknown;
|
||||
openSignalRoute(url: string): Promise<void>;
|
||||
};
|
||||
|
||||
export function getCI(deviceName: string): CIType {
|
||||
|
@ -133,6 +136,20 @@ export function getCI(deviceName: string): CIType {
|
|||
return window.ConversationController.getConversationId(address);
|
||||
}
|
||||
|
||||
async function openSignalRoute(url: string) {
|
||||
strictAssert(
|
||||
isSignalRoute(url),
|
||||
`openSignalRoute: not a valid signal route ${url}`
|
||||
);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.target = '_blank';
|
||||
a.hidden = true;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
|
||||
return {
|
||||
deviceName,
|
||||
getConversationId,
|
||||
|
@ -141,5 +158,6 @@ export function getCI(deviceName: string): CIType {
|
|||
setProvisioningURL,
|
||||
solveChallenge,
|
||||
waitForEvent,
|
||||
openSignalRoute,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue