Use cruddy mobile detection to determine whether to auto reconnect.
This commit is contained in:
parent
da242ed93a
commit
a7c0c400cd
4 changed files with 16 additions and 3 deletions
|
@ -56,7 +56,7 @@ const MamiConnectionManager = function(client, settings, urls, eventTarget) {
|
||||||
resetTimeout();
|
resetTimeout();
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
if(settings.get('onlyConnectWhenVisible'))
|
if(settings.get('onlyConnectWhenVisible2'))
|
||||||
await MamiWaitVisible();
|
await MamiWaitVisible();
|
||||||
|
|
||||||
eventTarget.dispatch('attempt', {
|
eventTarget.dispatch('attempt', {
|
||||||
|
|
|
@ -7,6 +7,7 @@ window.Umi = { UI: {} };
|
||||||
#include context.js
|
#include context.js
|
||||||
#include emotes.js
|
#include emotes.js
|
||||||
#include events.js
|
#include events.js
|
||||||
|
#include mobile.js
|
||||||
#include mszauth.js
|
#include mszauth.js
|
||||||
#include txtrigs.js
|
#include txtrigs.js
|
||||||
#include utility.js
|
#include utility.js
|
||||||
|
@ -109,7 +110,7 @@ window.Umi = { UI: {} };
|
||||||
settings.define('windowsLiveMessenger').default(false).create();
|
settings.define('windowsLiveMessenger').default(false).create();
|
||||||
settings.define('seinfeld').default(false).create();
|
settings.define('seinfeld').default(false).create();
|
||||||
settings.define('flashTitle').default(true).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('playJokeSounds').default(true).create();
|
||||||
settings.define('weeaboo').default(false).create();
|
settings.define('weeaboo').default(false).create();
|
||||||
settings.define('motivationalImages').default(false).create();
|
settings.define('motivationalImages').default(false).create();
|
||||||
|
|
12
src/mami.js/mobile.js
Normal file
12
src/mami.js/mobile.js
Normal 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;
|
||||||
|
};
|
|
@ -204,7 +204,7 @@ Umi.UI.Settings = (function() {
|
||||||
title: 'Misc',
|
title: 'Misc',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: 'onlyConnectWhenVisible',
|
name: 'onlyConnectWhenVisible2',
|
||||||
title: 'Only connect when the tab is in the foreground',
|
title: 'Only connect when the tab is in the foreground',
|
||||||
type: 'checkbox',
|
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.'],
|
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.'],
|
||||||
|
|
Loading…
Reference in a new issue