Use cruddy mobile detection to determine whether to auto reconnect.

This commit is contained in:
flash 2024-05-10 01:16:06 +00:00
parent da242ed93a
commit a7c0c400cd
4 changed files with 16 additions and 3 deletions

View file

@ -56,7 +56,7 @@ const MamiConnectionManager = function(client, settings, urls, eventTarget) {
resetTimeout();
(async () => {
if(settings.get('onlyConnectWhenVisible'))
if(settings.get('onlyConnectWhenVisible2'))
await MamiWaitVisible();
eventTarget.dispatch('attempt', {

View file

@ -7,6 +7,7 @@ window.Umi = { UI: {} };
#include context.js
#include emotes.js
#include events.js
#include mobile.js
#include mszauth.js
#include txtrigs.js
#include utility.js
@ -109,7 +110,7 @@ window.Umi = { UI: {} };
settings.define('windowsLiveMessenger').default(false).create();
settings.define('seinfeld').default(false).create();
settings.define('flashTitle').default(true).create();
settings.define('onlyConnectWhenVisible').default(true).create();
settings.define('onlyConnectWhenVisible2').default(MamiIsMobileDevice()).create();
settings.define('playJokeSounds').default(true).create();
settings.define('weeaboo').default(false).create();
settings.define('motivationalImages').default(false).create();

12
src/mami.js/mobile.js Normal file
View file

@ -0,0 +1,12 @@
const MamiIsMobileDevice = () => {
if('userAgentData' in navigator)
return navigator.userAgentData.mobile;
if('matchMedia' in window)
return !window.matchMedia("(any-pointer:fine)").matches;
if('maxTouchPoints' in navigator)
return navigator.maxTouchPoints > 1;
return false;
};

View file

@ -204,7 +204,7 @@ Umi.UI.Settings = (function() {
title: 'Misc',
items: [
{
name: 'onlyConnectWhenVisible',
name: 'onlyConnectWhenVisible2',
title: 'Only connect when the tab is in the foreground',
type: 'checkbox',
confirm: ['Please only disable this setting if you are using a desktop or laptop computer, this should always remain on on a phone, tablet or other device of that sort.', 'Are you sure you want to change this setting? Ignoring this warning may carry consequences.'],