283 lines
8 KiB
TypeScript
283 lines
8 KiB
TypeScript
// Module ID: 5168
|
|
// Function ID: 5169
|
|
// Name: checkIdleAFK
|
|
// Dependencies: [1218, 676, 4405, 500, 4034, 687, 709, 3972, 5169, 636, 589, 2]
|
|
|
|
// Module 5168 (checkIdleAFK)
|
|
import fetchFingerprint from "fetchFingerprint";
|
|
import ME from "ME";
|
|
import { SpeakingFlags } from "DesktopSources";
|
|
|
|
let c5;
|
|
let closure_6;
|
|
const require = arg1;
|
|
function checkIdleAFK() {
|
|
if (Date.now() - closure_8 <= closure_5) {
|
|
let tmp2 = c11;
|
|
if (!c11) {
|
|
tmp2 = c12;
|
|
}
|
|
if (!tmp2) {
|
|
let obj = require(500) /* set */;
|
|
tmp2 = obj.isAndroid() && c13;
|
|
const tmp5 = obj.isAndroid() && c13;
|
|
}
|
|
if (!tmp2) {
|
|
if (c9) {
|
|
importDefault(709).dispatch({ type: "IDLE", idle: false });
|
|
const obj2 = importDefault(709);
|
|
}
|
|
}
|
|
const AfkTimeout = require(4034) /* explicitContentFromProto */.AfkTimeout;
|
|
const setting = AfkTimeout.getSetting();
|
|
if (0 !== setting) {
|
|
if (null == closure_3) {
|
|
const _Date = Date;
|
|
const _Math = Math;
|
|
const diff = Date.now() - closure_8;
|
|
if (diff <= Math.min(setting * importDefault(687).Millis.SECOND, tmp)) {
|
|
let tmp17 = c11;
|
|
if (!c11) {
|
|
tmp17 = c12;
|
|
}
|
|
if (!tmp17) {
|
|
const tmp14Result = tmp14(500);
|
|
tmp17 = tmp14(500).isAndroid() && c13;
|
|
const tmp18 = tmp14(500).isAndroid() && c13;
|
|
}
|
|
if (!tmp17) {
|
|
if (c10) {
|
|
tmp28(709).dispatch({ type: "AFK", afk: false });
|
|
const tmp28Result = tmp28(709);
|
|
}
|
|
}
|
|
}
|
|
tmp28 = importDefault;
|
|
}
|
|
}
|
|
if (!c10) {
|
|
importDefault(709).dispatch({ type: "AFK", afk: true });
|
|
const obj7 = importDefault(709);
|
|
}
|
|
tmp14 = require;
|
|
}
|
|
if (!c9) {
|
|
obj = { type: "IDLE", idle: true, idleSince: null };
|
|
obj[2] = closure_8;
|
|
importDefault(709).dispatch(obj);
|
|
const obj3 = importDefault(709);
|
|
}
|
|
}
|
|
({ IDLE_DURATION: c5, AppStates: closure_6 } = ME);
|
|
let closure_8 = Date.now();
|
|
let c9 = false;
|
|
let c10 = false;
|
|
let c11 = false;
|
|
let c12 = false;
|
|
let c13 = false;
|
|
if (require("set").isPlatformEmbedded) {
|
|
const importDefaultResult = require("set");
|
|
let powerMonitor;
|
|
if (importDefaultResult != null) {
|
|
powerMonitor = importDefaultResult.powerMonitor;
|
|
}
|
|
if (null != powerMonitor) {
|
|
function checkNativeIdle() {
|
|
const tmp3 = importDefault(3972);
|
|
let getSystemIdleTimeMs;
|
|
if (tmp3 != null) {
|
|
const powerMonitor = tmp3.powerMonitor;
|
|
if (powerMonitor != null) {
|
|
getSystemIdleTimeMs = powerMonitor.getSystemIdleTimeMs;
|
|
}
|
|
}
|
|
if (null != getSystemIdleTimeMs) {
|
|
const powerMonitor2 = tmp(3972).powerMonitor;
|
|
const systemIdleTimeMs = powerMonitor2.getSystemIdleTimeMs();
|
|
if (systemIdleTimeMs instanceof Promise) {
|
|
systemIdleTimeMs.then(function handleIdleTime(arg0) {
|
|
const diff = Date.now() - arg0;
|
|
let tmp2 = null == c3;
|
|
if (!tmp2) {
|
|
tmp2 = diff > c3;
|
|
}
|
|
if (tmp2) {
|
|
const _Math = Math;
|
|
closure_8 = Math.max(diff, closure_8);
|
|
c3 = null;
|
|
}
|
|
callback2();
|
|
const timerId = setTimeout(closure_15, 10 * callback(table[5]).Millis.SECOND);
|
|
});
|
|
} else {
|
|
const _Date = Date;
|
|
let diff = Date.now() - systemIdleTimeMs;
|
|
let tmp7 = null == c3;
|
|
if (!tmp7) {
|
|
tmp7 = diff > c3;
|
|
}
|
|
if (tmp7) {
|
|
let _Math = Math;
|
|
closure_8 = Math.max(diff, closure_8);
|
|
c3 = null;
|
|
}
|
|
checkIdleAFK();
|
|
const _setTimeout = setTimeout;
|
|
let timerId = setTimeout(checkNativeIdle, 10 * tmp(687).Millis.SECOND);
|
|
}
|
|
}
|
|
}
|
|
checkNativeIdle();
|
|
powerMonitor = require("set").powerMonitor;
|
|
powerMonitor.on("resume", () => {
|
|
let c11 = false;
|
|
checkIdleAFK();
|
|
});
|
|
let powerMonitor2 = require("set").powerMonitor;
|
|
powerMonitor2.on("suspend", () => {
|
|
let c11 = true;
|
|
let closure_3 = Date.now();
|
|
checkIdleAFK();
|
|
importDefault(5169).disconnect();
|
|
});
|
|
const powerMonitor3 = require("set").powerMonitor;
|
|
class IdleStore extends r10079 {
|
|
}
|
|
powerMonitor3.on("lock-screen", () => {
|
|
let c12 = true;
|
|
let closure_3 = Date.now();
|
|
checkIdleAFK();
|
|
});
|
|
obj.on("unlock-screen", () => {
|
|
let c12 = false;
|
|
checkIdleAFK();
|
|
});
|
|
}
|
|
function handleGenericAction(timestamp) {
|
|
timestamp = timestamp.timestamp;
|
|
let tmp = "OVERLAY_SET_NOT_IDLE" === timestamp.type;
|
|
if (tmp) {
|
|
tmp = null != timestamp;
|
|
}
|
|
let bypassIdleUpdate = tmp;
|
|
if (tmp) {
|
|
bypassIdleUpdate = timestamp <= timestamp;
|
|
}
|
|
if (!bypassIdleUpdate) {
|
|
bypassIdleUpdate = timestamp.bypassIdleUpdate;
|
|
}
|
|
if (!bypassIdleUpdate) {
|
|
let c3 = null;
|
|
if (!tmp) {
|
|
const _Date = Date;
|
|
timestamp = Date.now();
|
|
}
|
|
checkIdleAFK();
|
|
}
|
|
return false;
|
|
}
|
|
require("debounce")(() => {
|
|
const obj = {};
|
|
let timestamp = obj.timestamp;
|
|
let tmp = "OVERLAY_SET_NOT_IDLE" === obj.type;
|
|
if (tmp) {
|
|
tmp = null != timestamp;
|
|
}
|
|
let bypassIdleUpdate = tmp;
|
|
if (tmp) {
|
|
bypassIdleUpdate = timestamp <= timestamp;
|
|
}
|
|
if (!bypassIdleUpdate) {
|
|
bypassIdleUpdate = obj.bypassIdleUpdate;
|
|
}
|
|
if (!bypassIdleUpdate) {
|
|
let c3 = null;
|
|
if (!tmp) {
|
|
const _Date = Date;
|
|
timestamp = Date.now();
|
|
}
|
|
checkIdleAFK();
|
|
}
|
|
}, 500);
|
|
const Store = require("initialize").Store;
|
|
class IdleStore extends r10079 {
|
|
}
|
|
const prototype = IdleStore.prototype;
|
|
prototype["initialize"] = function initialize() {
|
|
this.waitFor(fetchFingerprint);
|
|
};
|
|
prototype["isIdle"] = function isIdle() {
|
|
return c9;
|
|
};
|
|
prototype["isAFK"] = function isAFK() {
|
|
return c10;
|
|
};
|
|
prototype["getIdleSince"] = function getIdleSince() {
|
|
let tmp = null;
|
|
if (c9) {
|
|
tmp = closure_8;
|
|
}
|
|
return tmp;
|
|
};
|
|
prototype["getSystemSuspended"] = function getSystemSuspended() {
|
|
return c11;
|
|
};
|
|
prototype["getSystemLocked"] = function getSystemLocked() {
|
|
return c12;
|
|
};
|
|
IdleStore.displayName = "IdleStore";
|
|
obj = { IDLE: null, AFK: null, SPEAKING: null, APP_STATE_UPDATE: null, OVERLAY_SET_NOT_IDLE: null, CHANNEL_SELECT: null, VOICE_CHANNEL_SELECT: null, WINDOW_FOCUS: null, OVERLAY_INITIALIZE: null, OVERLAY_SET_INPUT_LOCKED: null };
|
|
obj[0] = function handleIdle(idle) {
|
|
idle = idle.idle;
|
|
};
|
|
obj[1] = function handleAFK(afk) {
|
|
afk = afk.afk;
|
|
};
|
|
obj[2] = function handleSpeaking(speakingFlags) {
|
|
let tmp2 = speakingFlags.speakingFlags !== SpeakingFlags.NONE;
|
|
if (tmp2) {
|
|
tmp2 = tmp === id.getId();
|
|
}
|
|
if (tmp2) {
|
|
const obj = {};
|
|
let timestamp = obj.timestamp;
|
|
let tmp4 = "OVERLAY_SET_NOT_IDLE" === obj.type;
|
|
if (tmp4) {
|
|
tmp4 = null != timestamp;
|
|
}
|
|
let bypassIdleUpdate = tmp4;
|
|
if (tmp4) {
|
|
bypassIdleUpdate = timestamp <= timestamp;
|
|
}
|
|
if (!bypassIdleUpdate) {
|
|
bypassIdleUpdate = obj.bypassIdleUpdate;
|
|
}
|
|
if (!bypassIdleUpdate) {
|
|
let c3 = null;
|
|
if (!tmp4) {
|
|
const _Date = Date;
|
|
timestamp = Date.now();
|
|
}
|
|
checkIdleAFK();
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
obj[3] = function handleAppStateUpdate(state) {
|
|
let closure_13 = state.state === constants.BACKGROUND;
|
|
let c3 = null;
|
|
let closure_8 = Date.now();
|
|
checkIdleAFK();
|
|
return false;
|
|
};
|
|
obj[4] = handleGenericAction;
|
|
obj[5] = handleGenericAction;
|
|
obj[6] = handleGenericAction;
|
|
obj[7] = handleGenericAction;
|
|
obj[8] = handleGenericAction;
|
|
obj[9] = handleGenericAction;
|
|
const idleStore = new IdleStore(require("dispatcher"), obj);
|
|
const result = require("DesktopSources").fileFinishedImporting("stores/IdleStore.tsx");
|
|
exports.default = idleStore;
|
|
}
|
|
let timerId = setInterval(checkIdleAFK, 30 * require("set").Millis.SECOND);
|