mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fix: To differentiate between which chrome alarm is triggered (#16360)
This commit is contained in:
parent
c098c628cc
commit
39037684d4
@ -191,11 +191,9 @@ export default class AppStateController extends EventEmitter {
|
||||
const { timeoutMinutes } = this.store.getState();
|
||||
|
||||
if (this.timer) {
|
||||
if (isManifestV3) {
|
||||
chrome.alarms.clear(AUTO_LOCK_TIMEOUT_ALARM);
|
||||
} else {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
clearTimeout(this.timer);
|
||||
} else if (isManifestV3) {
|
||||
chrome.alarms.clear(AUTO_LOCK_TIMEOUT_ALARM);
|
||||
}
|
||||
|
||||
if (!timeoutMinutes) {
|
||||
@ -207,16 +205,11 @@ export default class AppStateController extends EventEmitter {
|
||||
delayInMinutes: timeoutMinutes,
|
||||
periodInMinutes: timeoutMinutes,
|
||||
});
|
||||
chrome.alarms.onAlarm.addListener(() => {
|
||||
chrome.alarms.getAll((alarms) => {
|
||||
const hasAlarm = alarms.find(
|
||||
(alarm) => alarm.name === AUTO_LOCK_TIMEOUT_ALARM,
|
||||
);
|
||||
if (hasAlarm) {
|
||||
this.onInactiveTimeout();
|
||||
chrome.alarms.clear(AUTO_LOCK_TIMEOUT_ALARM);
|
||||
}
|
||||
});
|
||||
chrome.alarms.onAlarm.addListener((alarmInfo) => {
|
||||
if (alarmInfo.name === AUTO_LOCK_TIMEOUT_ALARM) {
|
||||
this.onInactiveTimeout();
|
||||
chrome.alarms.clear(AUTO_LOCK_TIMEOUT_ALARM);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.timer = setTimeout(
|
||||
|
@ -162,17 +162,10 @@ export default class MetaMetricsController {
|
||||
});
|
||||
}
|
||||
});
|
||||
chrome.alarms.onAlarm.addListener(() => {
|
||||
chrome.alarms.getAll((alarms) => {
|
||||
const hasAlarm = checkAlarmExists(
|
||||
alarms,
|
||||
METAMETRICS_FINALIZE_EVENT_FRAGMENT_ALARM,
|
||||
);
|
||||
|
||||
if (hasAlarm) {
|
||||
this.finalizeAbandonedFragments();
|
||||
}
|
||||
});
|
||||
chrome.alarms.onAlarm.addListener((alarmInfo) => {
|
||||
if (alarmInfo.name === METAMETRICS_FINALIZE_EVENT_FRAGMENT_ALARM) {
|
||||
this.finalizeAbandonedFragments();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setInterval(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user