Skip to content

Commit 0135fc8

Browse files
Hotfix/remove recurring angular call (#1154)
* removing the angular recurring call to disable some promotions as I suspect is creating a wee leak * missing removal of angular in the index.js browser section * only retry 5 times to get the angular instances
1 parent 74dd155 commit 0135fc8

File tree

6 files changed

+390
-343
lines changed

6 files changed

+390
-343
lines changed

app/browser/tools/activityHub.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,16 @@ class ActivityHub {
3939
}
4040

4141
start() {
42-
instance.whenReady().then(assignEventHandlers);
42+
instance.whenReady().then(assignEventHandlers).catch(() => {
43+
console.error('Failed to start Activity Hub by assigning Event Handlers');
44+
});
4345
}
4446

4547
setDefaultTitle(title) {
4648
instance.whenReady().then(inst => {
4749
inst.controller.pageTitleDefault = title;
50+
}).catch(() => {
51+
console.error('Failed to set Default Title');
4852
});
4953
}
5054

@@ -58,6 +62,8 @@ class ActivityHub {
5862
} else {
5963
inst.controller.appStateService.setMachineState(state);
6064
}
65+
}).catch(() => {
66+
console.error('Failed to set Machine State');
6167
});
6268
}
6369

@@ -68,6 +74,8 @@ class ActivityHub {
6874
setUserStatus(status) {
6975
instance.whenReady().then((inst) => {
7076
inst.injector.get('presenceService').setMyStatus(status, null, true);
77+
}).catch(() => {
78+
console.error('Failed to set User Status');
7179
});
7280
}
7381

app/browser/tools/customBackgrounds.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ let ipRenderer = null;
1717
function init(conf, ipcr) {
1818
config = conf;
1919
ipRenderer = ipcr;
20-
instance.whenReady().then(overrideMSMethod);
20+
instance.whenReady().then(overrideMSMethod).catch(() => {
21+
console.error('Failed to override MS Method');
22+
});
2123
}
2224

2325
/**

app/browser/tools/instance.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ class Instance {
22
/**
33
* @returns {Promise<{controller:object,injector:object}>}
44
*/
5-
async whenReady() {
5+
async whenReady(tries = 0) {
6+
if (tries >= 5) {
7+
throw new Error('Failed to get app objects after 5 tries');
8+
}
9+
610
const obj = getAppObjects();
711
if (obj) {
812
return obj;
913
} else {
1014
await sleep(4000);
11-
return await this.whenReady();
15+
return await this.whenReady(tries + 1);
1216
}
1317
}
1418
}

app/browser/tools/settings.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ class Settings {
3333
* @param {Electron.IpcRendererEvent} event
3434
*/
3535
async function retrieve(event) {
36-
const inst = await instance.whenReady();
36+
const inst = await instance.whenReady().catch(() => {
37+
console.error('Failed to retrieve Teams settings');
38+
return;
39+
});
3740
const settings = {
3841
theme: inst.controller.layoutService.getTheme(),
3942
chatDensity: inst.controller.layoutService.getChatDensity(),
@@ -55,7 +58,10 @@ function getDeviceLabelFromId(controller, id, kind) {
5558
* @param {...any} args
5659
*/
5760
async function restore(event, ...args) {
58-
const inst = await instance.whenReady();
61+
const inst = await instance.whenReady().catch(() => {
62+
console.error('Failed to restore Teams settings');
63+
return;
64+
});
5965
inst.controller.layoutService.setTheme(args[0].theme);
6066
inst.controller.layoutService.setChatDensity(args[0].chatDensity);
6167
args[0].devices.camera = getDeviceIdFromLabel(inst.controller,args[0].devices.camera,1);

app/browser/tools/theme.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class ThemeManager {
1515

1616
applyTheme = async (event, ...args) => {
1717
const theme = args[0] ? 'dark' : 'default';
18-
const inst = await instance.whenReady();
18+
const inst = await instance.whenReady().catch(() => {
19+
console.error('Failed to apply Theme');
20+
});
1921
inst.controller.layoutService.setTheme(theme);
2022
}
2123
}

0 commit comments

Comments
 (0)