diff --git a/src/DeviceListener.js b/src/DeviceListener.js index c4beb6c01e..84c6b1d230 100644 --- a/src/DeviceListener.js +++ b/src/DeviceListener.js @@ -267,6 +267,7 @@ export default class DeviceListener { key: OTHER_DEVICES_TOAST_KEY, title: _t("Review where you’re logged in"), icon: "verification_warning", + priority: ToastStore.PRIORITY_LOW, props: { deviceIds: oldUnverifiedDeviceIds, }, diff --git a/src/stores/ToastStore.js b/src/stores/ToastStore.js index f17d13bf9e..ad185e42db 100644 --- a/src/stores/ToastStore.js +++ b/src/stores/ToastStore.js @@ -20,8 +20,9 @@ import EventEmitter from 'events'; * Holds the active toasts */ export default class ToastStore extends EventEmitter { - static PRIORITY_REALTIME = 1; - static PRIORITY_DEFAULT = 0; + static PRIORITY_REALTIME = 0; + static PRIORITY_DEFAULT = 1; + static PRIORITY_LOW = 2; static sharedInstance() { if (!global.mx_ToastStore) global.mx_ToastStore = new ToastStore(); @@ -43,12 +44,9 @@ export default class ToastStore extends EventEmitter { const oldIndex = this._toasts.findIndex(t => t.key === newToast.key); if (oldIndex === -1) { - // we only have two priorities so just push realtime ones onto the front - if (newToast.priority) { - this._toasts.unshift(newToast); - } else { - this._toasts.push(newToast); - } + let newIndex = this._toasts.length; + while (newIndex > 0 && this._toasts[newIndex - 1].priority > newToast.priority) --newIndex; + this._toasts.splice(newIndex, 0, newToast); } else { this._toasts[oldIndex] = newToast; }