59 lines
2.9 KiB
TypeScript
59 lines
2.9 KiB
TypeScript
/* Metro module 13258; source: modules/auth_sessions/AuthSessionsUtils.tsx; dependencies: [31, 1226, 13259, 566, 1244, 3738, 2] */
|
|
function _fun101091(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101091, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13448:6, offset: 0x02207ea6, size: 166 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const authSessionsStore = importDefault(13259) /* metro dependency 13259: AuthSessionsStore */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/auth_sessions/AuthSessionsUtils.tsx');
|
|
exports.useAuthSessions = useAuthSessions;
|
|
exports.formatDate = formatDate;
|
|
}
|
|
|
|
function useAuthSessions() { // fn#101092, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13448:223, offset: 0x02207f4c, size: 94 bytes, params: 1, frame: 15
|
|
return env0_3.useMemo(_fun101094,
|
|
[(require(566) /* metro dependency 566: flux */).useStateFromStoresObject([AuthSessionsStore], function() {
|
|
return AuthSessionsStore.getSessions();
|
|
})]);
|
|
}
|
|
|
|
function formatDate(a0) { // fn#101097, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13448:611, offset: 0x02208085, size: 167 bytes, params: 2, frame: 15
|
|
var r0;
|
|
var intl;
|
|
const Date = global.Date;
|
|
let value = Date.now();
|
|
value -= a0.valueOf();
|
|
if (value / 1000 / 60 / 60 < 1) {
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
r0 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.TXCmfL);
|
|
} else {
|
|
value = (importDefault(3738) /* metro dependency 3738 */)(a0);
|
|
value = value.fromNow();
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun101094() { // fn#101094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13448:334, offset: 0x02207fbd, size: 136 bytes, params: 1, frame: 17
|
|
var environment;
|
|
var r2;
|
|
const binding = env0_0;
|
|
const items2 = [];
|
|
arraySpread(items2, binding, 0, undefined);
|
|
let value = environment.__proto__;
|
|
value = AuthenticationStore.getAuthSessionIdHash();
|
|
const value2 = null;
|
|
if (value2 != value) {
|
|
value = items2.findIndex(_fun101095);
|
|
r2 = value >= 0 ? items2.splice(value, 1)[0] : value2;
|
|
} else {
|
|
r2 = value2;
|
|
}
|
|
items2.sort(function(a0, a1) {
|
|
return a1.approx_last_used_time.valueOf() - a0.approx_last_used_time.valueOf();
|
|
});
|
|
return {currentSession: r2, otherSessions: items2};
|
|
}
|
|
|