POC: Mobile notification via periodicSync

This commit is contained in:
10G Meow 2023-11-26 13:51:15 +02:00
parent b14749c28f
commit 2aa97cf134
3 changed files with 78 additions and 6 deletions

View file

@ -486,7 +486,7 @@ class Util {
/**
* Return what "mode" to use for the given room.
*
*
* The default value is given by the room itself (as state events, see roomTypeMixin).
* This method just returns if the user has overridden this in room settings (this
* fact will be persisted as a user specific tag on the room). Note: currently override
@ -515,7 +515,7 @@ class Util {
/**
* Return the room type for the current room
* @param {*} roomOrNull
* @param {*} roomOrNull
*/
roomDisplayTypeToQueryParam(roomOrNull, roomDisplayType) {
const roomType = this.roomDisplayTypeOverride(roomOrNull) || roomDisplayType;
@ -898,7 +898,7 @@ class Util {
}
downloadableTypes() {
return ['m.video','m.audio','m.image','m.file'];
return ['m.video','m.audio','m.image','m.file'];
}
download(matrixClient, event) {
@ -921,6 +921,17 @@ class Util {
console.log("Failed to fetch attachment: ", err);
});
}
isMobileOrTabletBrowser() {
// Regular expression to match common mobile and tablet browser user agent strings
const mobileTabletPattern = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Tablet|Mobile|CriOS/i;
// Get the user agent string
const userAgent = navigator.userAgent;
// Check if the user agent matches the pattern for mobile or tablet browsers
return mobileTabletPattern.test(userAgent);
}
}
export default new Util();