Show app name in receiver selector if known based on app ID

This commit is contained in:
hensm
2020-01-13 23:09:54 +00:00
parent 2154fe4beb
commit a23ae9efa8
11 changed files with 89 additions and 13 deletions

View File

@@ -22,6 +22,7 @@ export interface Shim {
contentPort: Port;
contentTabId?: number;
contentFrameId?: number;
requestedAppId?: string;
}
@@ -33,6 +34,18 @@ export default new class ShimManager {
await this.initStatusListeners();
}
public getShim (tabId: number, frameId?: number) {
for (const activeShim of this.activeShims) {
if (activeShim.contentTabId === tabId) {
if (frameId && activeShim.contentFrameId !== frameId) {
continue;
}
return activeShim;
}
}
}
public async createShim (port: Port) {
const shim = await (port instanceof MessagePort
? this.createShimFromBackground(port)
@@ -129,6 +142,8 @@ export default new class ShimManager {
switch (message.subject) {
case "main:/shimInitialized": {
shim.requestedAppId = message.data.appId;
for (const receiver of StatusManager.getReceivers()) {
shim.contentPort.postMessage({
subject: "shim:/serviceUp"
@@ -148,7 +163,8 @@ export default new class ShimManager {
const selection = await ReceiverSelectorManager
.getSelection(
ReceiverSelectorMediaType.App
, availableMediaTypes);
, availableMediaTypes
, shim.requestedAppId);
// Handle cancellation
if (!selection) {