Don't inhibit current room notifications if user has Modal open (#7274)
This commit is contained in:
parent
494af883f3
commit
37bf85489d
2 changed files with 11 additions and 6 deletions
|
@ -19,6 +19,10 @@ limitations under the License.
|
||||||
|
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
import { encodeUnpaddedBase64 } from "matrix-js-sdk/src/crypto/olmlib";
|
import { encodeUnpaddedBase64 } from "matrix-js-sdk/src/crypto/olmlib";
|
||||||
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
|
|
||||||
import dis from './dispatcher/dispatcher';
|
import dis from './dispatcher/dispatcher';
|
||||||
import BaseEventIndexManager from './indexing/BaseEventIndexManager';
|
import BaseEventIndexManager from './indexing/BaseEventIndexManager';
|
||||||
import { ActionPayload } from "./dispatcher/payloads";
|
import { ActionPayload } from "./dispatcher/payloads";
|
||||||
|
@ -28,8 +32,6 @@ import { hideToast as hideUpdateToast } from "./toasts/UpdateToast";
|
||||||
import { MatrixClientPeg } from "./MatrixClientPeg";
|
import { MatrixClientPeg } from "./MatrixClientPeg";
|
||||||
import { idbLoad, idbSave, idbDelete } from "./utils/StorageManager";
|
import { idbLoad, idbSave, idbDelete } from "./utils/StorageManager";
|
||||||
|
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
|
||||||
|
|
||||||
export const SSO_HOMESERVER_URL_KEY = "mx_sso_hs_url";
|
export const SSO_HOMESERVER_URL_KEY = "mx_sso_hs_url";
|
||||||
export const SSO_ID_SERVER_URL_KEY = "mx_sso_is_url";
|
export const SSO_ID_SERVER_URL_KEY = "mx_sso_is_url";
|
||||||
export const SSO_IDP_ID_KEY = "mx_sso_idp_id";
|
export const SSO_IDP_ID_KEY = "mx_sso_idp_id";
|
||||||
|
@ -168,9 +170,9 @@ export default abstract class BasePlatform {
|
||||||
*/
|
*/
|
||||||
abstract requestNotificationPermission(): Promise<string>;
|
abstract requestNotificationPermission(): Promise<string>;
|
||||||
|
|
||||||
abstract displayNotification(title: string, msg: string, avatarUrl: string, room: Object);
|
abstract displayNotification(title: string, msg: string, avatarUrl: string, room: Room);
|
||||||
|
|
||||||
loudNotification(ev: Event, room: Object) {
|
loudNotification(ev: MatrixEvent, room: Room) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearNotification(notif: Notification) {
|
clearNotification(notif: Notification) {
|
||||||
|
|
|
@ -379,11 +379,14 @@ export const Notifier = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_evaluateEvent: function(ev) {
|
_evaluateEvent: function(ev: MatrixEvent) {
|
||||||
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
|
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
|
||||||
const actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
|
const actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
|
||||||
if (actions && actions.notify) {
|
if (actions && actions.notify) {
|
||||||
if (RoomViewStore.getRoomId() === room.roomId && UserActivity.sharedInstance().userActiveRecently()) {
|
if (RoomViewStore.getRoomId() === room.roomId &&
|
||||||
|
UserActivity.sharedInstance().userActiveRecently() &&
|
||||||
|
!Modal.hasDialogs()
|
||||||
|
) {
|
||||||
// don't bother notifying as user was recently active in this room
|
// don't bother notifying as user was recently active in this room
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue