855 lines
41 KiB
TypeScript
855 lines
41 KiB
TypeScript
/* Metro module 7116; source: modules/quests/utils/QuestTaskUtils.tsx; dependencies: [7093, 6535, 22, 672, 7091, 1360, 2] */
|
|
import Durations from '../../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import QuestStore from '../QuestStore.tsx'; /* Metro dependency 7093 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as GlobalUtilsModule from '../../../utils/GlobalUtils.tsx'; /* Metro dependency 1360 */
|
|
import * as FirstPartyQuestTaskTypesModule from '../../../external/discord_common/js/shared/shared-constants/FirstPartyQuestTaskTypes.tsx'; /* Metro dependency 6535 */
|
|
|
|
function _fun56879(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:6, offset: 0x013d45e3, size: 987 bytes, params: 8, frame: 34
|
|
let env0_0 = require;
|
|
const _arrayLikeToArray_56882 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const closure = function(a0) {
|
|
var property = a0.quest.config.taskConfigV2.tasks;
|
|
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP];
|
|
return property != null;
|
|
};
|
|
const closure2 = function(a0) {
|
|
var property = a0.config.taskConfigV2.tasks;
|
|
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ACTIVITY];
|
|
return property != null;
|
|
};
|
|
const shouldUsePlayOnDesktopTask2 = shouldUsePlayOnDesktopTask;
|
|
const isInGameQuest2 = isInGameQuest;
|
|
const closure5 = function(a0) {
|
|
return a0.userStatus != null && (hasUnsavedProgress(a0.userStatus,
|
|
require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_XBOX) || hasUnsavedProgress(a0.userStatus,
|
|
require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION));
|
|
};
|
|
const _isPlayOnDesktopTaskType = function(a0) {
|
|
return a0?.type === require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP;
|
|
};
|
|
const getDefaultWatchVideoTask2 = getDefaultWatchVideoTask;
|
|
const getDefaultInGameTask2 = getDefaultInGameTask;
|
|
const closure8 = function(a0) {
|
|
return parseMinutesAndSecondsFromSeconds(a0.targetSeconds - a0.progressSeconds);
|
|
};
|
|
const closure9 = function(a0) {
|
|
var object = {};
|
|
var Math = global.Math;
|
|
var Math2 = global.Math;
|
|
object.minutes = Math.max(0, Math2.floor(a0 / 60));
|
|
Math = global.Math;
|
|
var Math3 = global.Math;
|
|
object.seconds = Math.max(0, Math3.floor(a0 % 60));
|
|
return object;
|
|
};
|
|
const closure10 = function(a0, a1) {
|
|
var value = (0, global.String)(a0);
|
|
value = value.padStart(2, '0');
|
|
return '' + value + ':' + (0, global.String)(a1).padStart(2, '0');
|
|
};
|
|
let Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const closure11 = function(a0) {
|
|
var env0_0 = a0;
|
|
return _fun56897;
|
|
};
|
|
const FirstPartyQuestTaskTypes = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
let PLAY_ON_XBOX = FirstPartyQuestTaskTypes.PLAY_ON_XBOX;
|
|
let PLAY_ON_PLAYSTATION = FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION;
|
|
let value = closure11([PLAY_ON_XBOX, PLAY_ON_PLAYSTATION]);
|
|
let WATCH_VIDEO = FirstPartyQuestTaskTypes.WATCH_VIDEO;
|
|
let value2 = closure11([WATCH_VIDEO]);
|
|
let WATCH_VIDEO_ON_MOBILE = FirstPartyQuestTaskTypes.WATCH_VIDEO_ON_MOBILE;
|
|
let value3 = closure11([WATCH_VIDEO_ON_MOBILE]);
|
|
WATCH_VIDEO = FirstPartyQuestTaskTypes.WATCH_VIDEO;
|
|
WATCH_VIDEO_ON_MOBILE = FirstPartyQuestTaskTypes.WATCH_VIDEO_ON_MOBILE;
|
|
let value4 = closure11([WATCH_VIDEO, WATCH_VIDEO_ON_MOBILE]);
|
|
let PLAY_ON_DESKTOP = FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP;
|
|
const STREAM_ON_DESKTOP = FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
|
|
PLAY_ON_PLAYSTATION = FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION;
|
|
PLAY_ON_XBOX = FirstPartyQuestTaskTypes.PLAY_ON_XBOX;
|
|
const ACHIEVEMENT_IN_GAME = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME;
|
|
let value5 = closure11([PLAY_ON_DESKTOP, STREAM_ON_DESKTOP, PLAY_ON_PLAYSTATION, PLAY_ON_XBOX, ACHIEVEMENT_IN_GAME]);
|
|
const ACHIEVEMENT_IN_ACTIVITY = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_ACTIVITY;
|
|
const PLAY_ACTIVITY = FirstPartyQuestTaskTypes.PLAY_ACTIVITY;
|
|
const value6 = closure11([ACHIEVEMENT_IN_ACTIVITY, PLAY_ACTIVITY]);
|
|
const _parseFirstPartyTaskType = function(a0) {
|
|
var value = a0;
|
|
var ALL = require(dependencyMap[1]).FirstPartyQuestTaskTypesSets.ALL;
|
|
return ALL.has(value) ? value : null;
|
|
};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/quests/utils/QuestTaskUtils.tsx');
|
|
exports.getAllApplicationIds = getAllApplicationIds;
|
|
exports.getDesktopApplicationIds = function(a0) {
|
|
var getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
|
|
var PLAY_ON_DESKTOP = require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP;
|
|
return getApplicationIdsByTaskTypesBinding(a0, [PLAY_ON_DESKTOP]);
|
|
};
|
|
exports.getConsoleApplicationId = getConsoleApplicationId;
|
|
exports.getPlayActivityApplicationId = getPlayActivityApplicationId;
|
|
exports.getInGameApplicationId = getInGameApplicationId;
|
|
exports.getActivityApplicationId = getActivityApplicationId;
|
|
exports.getStreamingApplicationId = getStreamingApplicationId;
|
|
exports.hasPlayOnDesktopTask = closure;
|
|
exports.hasStreamOnDesktopTask = function(a0) {
|
|
var property = a0.quest.config.taskConfigV2.tasks;
|
|
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP];
|
|
return property != null;
|
|
};
|
|
exports.hasAchievementActivityTask = function(a0) {
|
|
var property = a0.config.taskConfigV2.tasks;
|
|
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_ACTIVITY];
|
|
return property != null;
|
|
};
|
|
exports.hasAchievementInGameTask = function(a0) {
|
|
var property = a0.config.taskConfigV2.tasks;
|
|
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME];
|
|
return property != null;
|
|
};
|
|
exports.hasPlayActivityTask = closure2;
|
|
exports.shouldUsePlayOnDesktopTask = shouldUsePlayOnDesktopTask2;
|
|
exports.hasSomeFirstPartyTasks = closure11;
|
|
exports.isInGameQuest = isInGameQuest2;
|
|
exports.hasSomeConsoleTasks = value;
|
|
exports.hasWatchVideoOnDesktopTasks = value2;
|
|
exports.hasWatchVideoOnMobileTasks = value3;
|
|
exports.hasWatchVideoTasks = value4;
|
|
exports.hasStandaloneGameplayTasks = value5;
|
|
exports.hasActivityTasks = value6;
|
|
exports.isVideoQuestForMobilePlatformOnly = isVideoQuestForMobilePlatformOnly;
|
|
exports.isConsoleQuest = isConsoleQuest;
|
|
exports.isQuestProgressingOnConsole = closure5;
|
|
exports.getQuestTaskTypes = function(a0) {
|
|
var Set = global.Set;
|
|
var Object = global.Object;
|
|
var value = Object.keys(a0.config.taskConfigV2.tasks);
|
|
var value2 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
value = new Set(value);
|
|
return value instanceof Object ? value : value2;
|
|
};
|
|
exports.getDefaultWatchVideoTask = getDefaultWatchVideoTask2;
|
|
exports.getQuestTaskDetails = function(a0, a1) {
|
|
var r1;
|
|
var value2 = _getQuestTaskDetails(a0, a1);
|
|
if (value2 != null) {
|
|
return value2;
|
|
}
|
|
var _getTaskDetailsForTypeBinding = _getTaskDetailsForType;
|
|
var object = {quest: a0};
|
|
var value3 = _getTaskDetailsForTypeBinding(object);
|
|
if (value3 != null) {
|
|
r1 = value3;
|
|
} else {
|
|
object = {'progressSeconds': 0, 'targetSeconds': 1, 'targetMinutes': 1, 'percentComplete': 0};
|
|
object.taskType = require(dependencyMap[1]).FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
|
|
r1 = object;
|
|
}
|
|
return r1;
|
|
};
|
|
exports.getDefaultInGameTask = getDefaultInGameTask2;
|
|
exports.getThirdPartyTaskDetails = getThirdPartyTaskDetails;
|
|
exports.getRemainingTaskTime = closure8;
|
|
exports.parseMinutesAndSecondsFromSeconds = closure9;
|
|
exports.formatWatchTaskRemainingTime = function(a0) {
|
|
var value2 = getRemainingTaskTime(a0);
|
|
return formatWatchTaskTime(value2.minutes, value2.seconds);
|
|
};
|
|
exports.formatWatchTaskTime = closure10;
|
|
function _createForOfIteratorHelperLoose_56880(a0, a1) { // fn#56880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:110, offset: 0x013d49be, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun56881;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_56882(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_56882(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_56882(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun56881;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
function _fun56881() { // fn#56881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:681, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
function getApplicationIdsByTaskTypes(a0, a1) { // fn#56883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1020, offset: 0x013d4b30, size: 303 bytes, params: 3, frame: 25
|
|
var r6;
|
|
var r14;
|
|
var r0;
|
|
var set;
|
|
var _createForOfIteratorHelperLoose_56880Binding;
|
|
var value3;
|
|
var value4;
|
|
var value5;
|
|
var done;
|
|
var value6;
|
|
var config;
|
|
var taskConfigV2;
|
|
var tasks;
|
|
var property;
|
|
var Array;
|
|
var isArray;
|
|
var applications;
|
|
var value7;
|
|
var value8;
|
|
var value9;
|
|
var add;
|
|
var id;
|
|
var value10;
|
|
var value11;
|
|
var from;
|
|
if (a0 != null) {
|
|
set = new global.Set();
|
|
_createForOfIteratorHelperLoose_56880Binding = _createForOfIteratorHelperLoose_56880;
|
|
value3 = undefined;
|
|
value4 = _createForOfIteratorHelperLoose_56880Binding(a1);
|
|
value5 = value4();
|
|
done = value5.done;
|
|
if (!done) {
|
|
r6 = value5;
|
|
reducibleLoop3: while (true) {
|
|
value6 = r6.value;
|
|
config = a0.config;
|
|
taskConfigV2 = config.taskConfigV2;
|
|
tasks = taskConfigV2.tasks;
|
|
property = tasks[value6];
|
|
reducibleJoin8: while (true) {
|
|
if (property == null) {
|
|
break reducibleJoin8;
|
|
}
|
|
if (!('applications' in property)) {
|
|
break reducibleJoin8;
|
|
}
|
|
Array = global.Array;
|
|
isArray = Array.isArray;
|
|
applications = property.applications;
|
|
if (!Reflect.apply(isArray, Array, [applications])) {
|
|
break reducibleJoin8;
|
|
}
|
|
_createForOfIteratorHelperLoose_56880Binding = _createForOfIteratorHelperLoose_56880;
|
|
applications = property.applications;
|
|
value7 = _createForOfIteratorHelperLoose_56880Binding(applications);
|
|
value8 = value7();
|
|
done = value8.done;
|
|
if (done) {
|
|
break reducibleJoin8;
|
|
}
|
|
r14 = value8;
|
|
reducibleLoop7: while (true) {
|
|
value9 = r14.value;
|
|
add = set.add;
|
|
id = value9.id;
|
|
Reflect.apply(add, set, [id]);
|
|
value10 = value7();
|
|
done = value10.done;
|
|
if (done) {
|
|
break reducibleJoin8;
|
|
}
|
|
r14 = value10;
|
|
continue reducibleLoop7;
|
|
}
|
|
}
|
|
value11 = value4();
|
|
done = value11.done;
|
|
if (done) {
|
|
break reducibleLoop3;
|
|
}
|
|
r6 = value11;
|
|
continue reducibleLoop3;
|
|
}
|
|
}
|
|
reducibleJoin11: while (true) {
|
|
if (set.size > 0) {
|
|
Array = global.Array;
|
|
from = Array.from;
|
|
set = Reflect.apply(from, Array, [set]);
|
|
r0 = set;
|
|
break reducibleJoin11;
|
|
}
|
|
r0 = value3;
|
|
break reducibleJoin11;
|
|
}
|
|
return r0;
|
|
}
|
|
}
|
|
|
|
function shouldUsePlayOnDesktopTask(a0) { // fn#56886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1710, offset: 0x013d4cf1, size: 35 bytes, params: 2, frame: 12
|
|
return a0 != null && hasPlayOnDesktopTask({quest: a0});
|
|
}
|
|
|
|
function isInGameQuest(a0) { // fn#56887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1880, offset: 0x013d4d14, size: 82 bytes, params: 2, frame: 14
|
|
const env0_0 = a0;
|
|
const Array = global.Array;
|
|
const from = Array.from;
|
|
const FirstPartyQuestTaskTypesSets = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypesSets;
|
|
const IN_GAME = FirstPartyQuestTaskTypesSets.IN_GAME;
|
|
return Reflect.apply(from, Array, [IN_GAME]).some(_fun56888);
|
|
function _fun56888(a0) { // fn#56888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1977, offset: 0x013d4d66, size: 40 bytes, params: 2, frame: 2
|
|
return env0_0.config.taskConfigV2.tasks[a0] != null;
|
|
}
|
|
|
|
}
|
|
|
|
function getDefaultWatchVideoTask(a0) { // fn#56891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5269, offset: 0x013d4e48, size: 130 bytes, params: 2, frame: 15
|
|
let tasks = a0.taskConfigV2.tasks;
|
|
const FirstPartyQuestTaskTypes = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
const WATCH_VIDEO = FirstPartyQuestTaskTypes.WATCH_VIDEO;
|
|
const property = tasks[WATCH_VIDEO];
|
|
tasks = a0.taskConfigV2.tasks;
|
|
const WATCH_VIDEO_ON_MOBILE = FirstPartyQuestTaskTypes.WATCH_VIDEO_ON_MOBILE;
|
|
const property2 = tasks[WATCH_VIDEO_ON_MOBILE];
|
|
const value = null;
|
|
return value == property ? value != (value == property2 ? property : property2) ? value == property2 ? property : property2 : value : value != property2 ? property2 : value != (value == property2 ? property : property2) ? value == property2 ? property : property2 : value;
|
|
}
|
|
|
|
function getDefaultInGameTask({taskConfigV2}) { // fn#56892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:7177, offset: 0x013d4eca, size: 104 bytes, params: 2, frame: 14
|
|
const tasks = taskConfigV2.tasks;
|
|
const FirstPartyQuestTaskTypes = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
const ACHIEVEMENT_IN_ACTIVITY = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_ACTIVITY;
|
|
const property = tasks[ACHIEVEMENT_IN_ACTIVITY];
|
|
const ACHIEVEMENT_IN_GAME = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME;
|
|
return property ?? tasks[ACHIEVEMENT_IN_GAME] ?? null;
|
|
}
|
|
|
|
function hasSomeFirstPartyTasks(a0) { // fn#56896, offset: 0x013d5016, size: 16 bytes, params: 2, frame: 2
|
|
const env0_0 = a0;
|
|
return function(a0) {
|
|
return a0.some(_fun56898);
|
|
};
|
|
function _fun56897(a0) { // fn#56897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1827, offset: 0x013d5026, size: 34 bytes, params: 2, frame: 11
|
|
return a0.some(_fun56898);
|
|
function _fun56898(a0) { // fn#56898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1838, offset: 0x013d4d66, size: 40 bytes, params: 2, frame: 2
|
|
return env0_0.config.taskConfigV2.tasks[a0] != null;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _computePercentComplete(a0, a1) { // fn#56900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:3436, offset: 0x013d50d9, size: 83 bytes, params: 3, frame: 16
|
|
var r0;
|
|
let value = 0;
|
|
if (a0 > value) {
|
|
value = require(22) /* metro dependency 22 */;
|
|
value = value.floor(global.Math.min(a1 / a0, 1), 4);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getTimeSinceLastBeatSeconds(a0, a1) { // fn#56901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:3511, offset: 0x013d512c, size: 256 bytes, params: 3, frame: 17
|
|
var Date;
|
|
var value3;
|
|
var date;
|
|
var value6;
|
|
var moduleValue;
|
|
const userStatus = a0.userStatus;
|
|
const lastBeatAt = userStatus == null || userStatus.progress == null || (userStatus.progress[a1.type] == null || userStatus.progress[a1.type].heartbeat == null) ? undefined : userStatus.progress[a1.type].heartbeat.lastBeatAt;
|
|
if (lastBeatAt != null) {
|
|
if (isQuestProgressingOnConsole(a0) || QuestStore.isProgressingOnDesktop(a0.id)) {
|
|
Date = global.Date;
|
|
value3 = Date.now();
|
|
Date = global.Date;
|
|
date = new Date(lastBeatAt);
|
|
value6 = value3 - date.valueOf();
|
|
moduleValue = require(22) /* metro dependency 22 */;
|
|
return moduleValue.floor(value6 / (importDefault(672) /* metro dependency 672: Durations */).Millis.SECOND, 2);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function getProgressSeconds(a0, a1) { // fn#56902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:3837, offset: 0x013d522c, size: 296 bytes, params: 3, frame: 20
|
|
const target = a1.target;
|
|
let userStatus = a0.userStatus;
|
|
let value = undefined;
|
|
if ((userStatus == null ? value : userStatus.completedAt) != null) {
|
|
return target;
|
|
}
|
|
userStatus = a0.userStatus;
|
|
let r3 = userStatus == null || userStatus.progress == null ? value : userStatus.progress[a1.type];
|
|
let r1 = r3 == null ? value : r3.value;
|
|
r1 = r1 ?? (a0.userStatus == null ? value : a0.userStatus.streamProgressSeconds);
|
|
const value3 = 0;
|
|
r3 = r1 ?? value3;
|
|
const r7 = env0_7(a0) ? QuestStore.getOptimisticProgress(a0.id,
|
|
a1.type) == null || QuestStore.getOptimisticProgress(a0.id,
|
|
a1.type) < r3 ? r3 : QuestStore.getOptimisticProgress(a0.id, a1.type) : r3 + getTimeSinceLastBeatSeconds(a0, a1);
|
|
let Math = global.Math;
|
|
const value7 = Math.min(0.99 * target, r7);
|
|
Math = global.Math;
|
|
const max = Math.max;
|
|
value = require(22) /* metro dependency 22 */;
|
|
return Reflect.apply(max, Math, [value.floor(value7, 2), value3]);
|
|
}
|
|
|
|
function _getTaskDetailsForType({quest, taskType, includeTaskTypes}) { // fn#56903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:4330, offset: 0x013d5354, size: 580 bytes, params: 2, frame: 25
|
|
var r4;
|
|
var Object;
|
|
var property;
|
|
var captureQuestsException;
|
|
var Error;
|
|
var id;
|
|
var value12;
|
|
var error;
|
|
var Array;
|
|
var from;
|
|
let value = undefined;
|
|
let r8 = includeTaskTypes !== value ? includeTaskTypes : (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypesSets.ALL;
|
|
const taskConfigV2 = quest.config.taskConfigV2;
|
|
if (taskType != null) {
|
|
r4 = taskType;
|
|
} else {
|
|
Object = global.Object;
|
|
property = Object.values(taskConfigV2.tasks).filter(_fun56904)[0];
|
|
r4 = property == null ? value : property.type;
|
|
}
|
|
const r11 = taskConfigV2.tasks[r4] ?? taskConfigV2.tasks[(require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP];
|
|
if (r11 == null) {
|
|
value = require(7091) /* metro dependency 7091: QuestDataUtils */;
|
|
captureQuestsException = value.captureQuestsException;
|
|
Error = global.Error;
|
|
id = quest.id;
|
|
value12 = 'Quest ' + id + ' has no task matching the include filters';
|
|
error = new Error();
|
|
id = quest.id;
|
|
Array = global.Array;
|
|
from = Array.from;
|
|
r8 = r8 ?? [];
|
|
Reflect.apply(captureQuestsException, value, [error, {tags: {source: '_getTaskDetailsForType'},
|
|
extra: {questId: id,
|
|
taskType: taskType, includeTaskTypes: Reflect.apply(from, Array, [r8])}}]);
|
|
return null;
|
|
}
|
|
const target = r11.target;
|
|
const progressSeconds = getProgressSeconds(quest, r11);
|
|
Object = global.Object;
|
|
const value8 = Object.values(taskConfigV2.tasks);
|
|
const value9 = value8.find(_isPlayOnDesktopTaskType);
|
|
const r2 = value9 == null || value9.applications == null ? value : value9.applications.map(function(a0) {
|
|
return a0.id;
|
|
});
|
|
const object = {progressSeconds: progressSeconds, targetSeconds: target};
|
|
const Math = global.Math;
|
|
const ceil = Math.ceil;
|
|
const Seconds = (Durations).Seconds;
|
|
const MINUTE = Seconds.MINUTE;
|
|
object.targetMinutes = Reflect.apply(ceil, Math, [target / MINUTE]);
|
|
object.percentComplete = _computePercentComplete(target, progressSeconds);
|
|
object.taskType = r4;
|
|
object.applications = r2;
|
|
return object;
|
|
function _fun56904({type}) { // fn#56904, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:4502, offset: 0x013d5598, size: 27 bytes, params: 2, frame: 11
|
|
return env0_0.has(type);
|
|
}
|
|
|
|
}
|
|
|
|
function _getQuestTaskDetails(a0, a1) { // fn#56907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5542, offset: 0x013d55ef, size: 405 bytes, params: 3, frame: 18
|
|
var r0;
|
|
var r1;
|
|
var _getTaskDetailsForTypeBinding;
|
|
var object;
|
|
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
|
|
var FirstPartyQuestTaskTypesSets;
|
|
let value = a1;
|
|
if (isInGameQuest(a0)) {
|
|
r0 = {'progressSeconds': 0, 'targetSeconds': 1, 'targetMinutes': 1, 'percentComplete': 0,
|
|
taskType: FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP};
|
|
} else if (env0_4(a0)) {
|
|
if (value != null) {
|
|
r1 = value;
|
|
} else {
|
|
value = isQuestProgressingOnConsole(a0);
|
|
FirstPartyQuestTaskTypesSets = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypesSets;
|
|
r1 = value ? FirstPartyQuestTaskTypesSets.CONSOLE : FirstPartyQuestTaskTypesSets.ALL;
|
|
}
|
|
value = _fun56908({quest: a0, includeTaskTypes: r1});
|
|
r0 = value;
|
|
} else if (env0_7(a0)) {
|
|
_getTaskDetailsForTypeBinding = _getTaskDetailsForType;
|
|
value = getDefaultWatchVideoTask(a0.config);
|
|
value = _getTaskDetailsForTypeBinding({quest: a0, taskType: value?.type});
|
|
r0 = value;
|
|
} else if (shouldUsePlayOnDesktopTask(a0)) {
|
|
r0 = _getTaskDetailsForType({quest: a0, taskType: FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP});
|
|
} else {
|
|
value = hasPlayActivityTask(a0);
|
|
_getTaskDetailsForTypeBinding = _getTaskDetailsForType;
|
|
object = {quest: a0};
|
|
if (value) {
|
|
object.taskType = FirstPartyQuestTaskTypes.PLAY_ACTIVITY;
|
|
r0 = _getTaskDetailsForTypeBinding(object);
|
|
} else {
|
|
object.taskType = FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
|
|
r0 = _getTaskDetailsForTypeBinding(object);
|
|
}
|
|
}
|
|
return r0;
|
|
function _fun56908({quest, includeTaskTypes}) { // fn#56908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5711, offset: 0x013d5784, size: 314 bytes, params: 2, frame: 21
|
|
var environment;
|
|
var r3;
|
|
var progress;
|
|
var r1;
|
|
var r7;
|
|
var value2;
|
|
var FirstPartyQuestTaskTypesSets;
|
|
var ALL;
|
|
var value8;
|
|
var _parseFirstPartyTaskTypeBinding;
|
|
var eventName;
|
|
var value9;
|
|
var has;
|
|
var value10;
|
|
var value11;
|
|
reducibleJoin2: while (true) {
|
|
if (includeTaskTypes !== undefined) {
|
|
r3 = includeTaskTypes;
|
|
break reducibleJoin2;
|
|
}
|
|
value2 = environment.__proto__;
|
|
FirstPartyQuestTaskTypesSets = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypesSets;
|
|
ALL = FirstPartyQuestTaskTypesSets.ALL;
|
|
r3 = ALL;
|
|
break reducibleJoin2;
|
|
}
|
|
const _createForOfIteratorHelperLoose_56880Binding = _createForOfIteratorHelperLoose_56880;
|
|
const Object = global.Object;
|
|
const values = Object.values;
|
|
const userStatus = quest.userStatus;
|
|
reducibleJoin4: while (true) {
|
|
if (userStatus == null) {
|
|
progress = undefined;
|
|
break reducibleJoin4;
|
|
}
|
|
progress = userStatus.progress;
|
|
break reducibleJoin4;
|
|
}
|
|
reducibleJoin6: while (true) {
|
|
if (progress != null) {
|
|
r1 = progress;
|
|
break reducibleJoin6;
|
|
}
|
|
r1 = {};
|
|
break reducibleJoin6;
|
|
}
|
|
const value5 = Reflect.apply(values, Object, [r1]).sort(_fun56909);
|
|
const value6 = _createForOfIteratorHelperLoose_56880Binding(value5.filter((GlobalUtilsModule).isNotNullish));
|
|
const value7 = value6();
|
|
let done = value7.done;
|
|
if (!done) {
|
|
r7 = value7;
|
|
reducibleLoop7: while (true) {
|
|
value8 = r7.value;
|
|
_parseFirstPartyTaskTypeBinding = _parseFirstPartyTaskType;
|
|
eventName = value8.eventName;
|
|
value9 = _parseFirstPartyTaskTypeBinding(eventName);
|
|
if (value9 != null) {
|
|
reducibleJoin11: while (true) {
|
|
if (r3 == null) {
|
|
break reducibleJoin11;
|
|
}
|
|
has = r3.has;
|
|
if (Reflect.apply(has, r3, [value9])) {
|
|
value10 = _getTaskDetailsForType({quest: quest, taskType: value9, includeTaskTypes: r3});
|
|
if (value10 != null) {
|
|
return value10;
|
|
}
|
|
break reducibleJoin11;
|
|
}
|
|
break reducibleJoin11;
|
|
}
|
|
}
|
|
value11 = value6();
|
|
done = value11.done;
|
|
if (done) {
|
|
return _getTaskDetailsForType({quest: quest, includeTaskTypes: r3});
|
|
}
|
|
r7 = value11;
|
|
continue reducibleLoop7;
|
|
}
|
|
}
|
|
return _getTaskDetailsForType({quest: quest, includeTaskTypes: r3});
|
|
}
|
|
|
|
}
|
|
|
|
function getAllApplicationIds(a0) { // fn#56910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:7832, offset: 0x013d5a26, size: 66 bytes, params: 2, frame: 14
|
|
var getApplicationIdsByTaskTypesBinding;
|
|
var Object;
|
|
if (a0 != null) {
|
|
getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
|
|
Object = global.Object;
|
|
return getApplicationIdsByTaskTypesBinding(a0, Object.keys(a0.config.taskConfigV2.tasks));
|
|
}
|
|
}
|
|
|
|
function getConsoleApplicationId(a0) { // fn#56912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8141, offset: 0x013d5aa4, size: 100 bytes, params: 2, frame: 16
|
|
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
|
|
const value = undefined;
|
|
const {PLAY_ON_XBOX,
|
|
PLAY_ON_PLAYSTATION} = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [PLAY_ON_XBOX,
|
|
PLAY_ON_PLAYSTATION]);
|
|
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
|
|
}
|
|
|
|
function getPlayActivityApplicationId(a0) { // fn#56913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8378, offset: 0x013d5b08, size: 75 bytes, params: 2, frame: 13
|
|
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
|
|
const value = undefined;
|
|
const FirstPartyQuestTaskTypes = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
const PLAY_ACTIVITY = FirstPartyQuestTaskTypes.PLAY_ACTIVITY;
|
|
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [PLAY_ACTIVITY]);
|
|
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
|
|
}
|
|
|
|
function getInGameApplicationId(a0) { // fn#56914, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8561, offset: 0x013d5b53, size: 75 bytes, params: 2, frame: 13
|
|
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
|
|
const value = undefined;
|
|
const FirstPartyQuestTaskTypes = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
const ACHIEVEMENT_IN_GAME = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME;
|
|
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [ACHIEVEMENT_IN_GAME]);
|
|
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
|
|
}
|
|
|
|
function getActivityApplicationId(a0) { // fn#56915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8746, offset: 0x013d5b9e, size: 100 bytes, params: 2, frame: 16
|
|
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
|
|
const value = undefined;
|
|
const {PLAY_ACTIVITY,
|
|
ACHIEVEMENT_IN_ACTIVITY} = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [PLAY_ACTIVITY,
|
|
ACHIEVEMENT_IN_ACTIVITY]);
|
|
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
|
|
}
|
|
|
|
function getStreamingApplicationId(a0) { // fn#56916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8986, offset: 0x013d5c02, size: 75 bytes, params: 2, frame: 13
|
|
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
|
|
const value = undefined;
|
|
const FirstPartyQuestTaskTypes = (FirstPartyQuestTaskTypesModule).FirstPartyQuestTaskTypes;
|
|
const STREAM_ON_DESKTOP = FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
|
|
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [STREAM_ON_DESKTOP]);
|
|
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
|
|
}
|
|
|
|
function isVideoQuestForMobilePlatformOnly(a0) { // fn#56920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:10070, offset: 0x013d5d25, size: 34 bytes, params: 2, frame: 13
|
|
return env0_6(a0) && !env0_5(a0);
|
|
}
|
|
|
|
function isConsoleQuest(a0) { // fn#56921, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:10103, offset: 0x013d5d47, size: 19 bytes, params: 2, frame: 11
|
|
return env0_4(a0);
|
|
}
|
|
|
|
function getThirdPartyTaskDetails({config, userStatus}) { // fn#56924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:10709, offset: 0x013d5e06, size: 172 bytes, params: 2, frame: 16
|
|
const defaultInGameTask = getDefaultInGameTask(config);
|
|
if (defaultInGameTask == null) {
|
|
return null;
|
|
}
|
|
const r3 = (userStatus == null || userStatus.progress == null ? undefined : userStatus.progress[defaultInGameTask.type]?.value) ?? 0;
|
|
return {title: defaultInGameTask.messages.taskTitle, description: defaultInGameTask.messages.taskDescription,
|
|
target: defaultInGameTask.target, progress: r3,
|
|
percentComplete: _computePercentComplete(defaultInGameTask.target, r3)};
|
|
}
|
|
|
|
}
|
|
|
|
function hasUnsavedProgress(a0, a1) { // fn#56899, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:2882, offset: 0x013d5048, size: 145 bytes, params: 3, frame: 13
|
|
const expiresAt = a0 == null || a0.progress[a1] == null || a0.progress[a1].heartbeat == null ? undefined : a0.progress[a1].heartbeat.expiresAt;
|
|
if (expiresAt == null) {
|
|
return false;
|
|
}
|
|
const Date = global.Date;
|
|
const value2 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
const date = new Date(expiresAt);
|
|
const value4 = (date instanceof Object ? date : value2).valueOf();
|
|
return !global.isNaN(value4) && value4 > global.Date.now();
|
|
}
|
|
|
|
function _fun56909(a0, a1) { // fn#56909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5911, offset: 0x013d58be, size: 360 bytes, params: 3, frame: 16
|
|
var updatedAt;
|
|
var r0;
|
|
var Date;
|
|
var prototype;
|
|
var date;
|
|
var value2;
|
|
var value3;
|
|
var value5;
|
|
var value6;
|
|
let value = undefined;
|
|
const lastBeatAt = a0 == null || a0.heartbeat == null ? value : a0.heartbeat.lastBeatAt;
|
|
const lastBeatAt2 = a1 == null || a1.heartbeat == null ? value : a1.heartbeat.lastBeatAt;
|
|
if (lastBeatAt == null) {
|
|
if (lastBeatAt != null) {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
} else if (lastBeatAt2 != null) {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
} else {
|
|
updatedAt = a0 == null ? value : a0.updatedAt;
|
|
if (updatedAt == null) {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
} else {
|
|
updatedAt = a1 == null ? value : a1.updatedAt;
|
|
if (updatedAt != null) {
|
|
Date = global.Date;
|
|
updatedAt = a0.updatedAt;
|
|
prototype = Date.prototype;
|
|
value = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value = date instanceof Object ? date : value;
|
|
value = value.valueOf();
|
|
Date = global.Date;
|
|
updatedAt = a1.updatedAt;
|
|
prototype = Date.prototype;
|
|
value2 = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value3 = date instanceof Object ? date : value2;
|
|
value = value > value3.valueOf();
|
|
r0 = value ? -1 : 1;
|
|
} else {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
}
|
|
}
|
|
}
|
|
} else if (lastBeatAt2 != null) {
|
|
Date = global.Date;
|
|
prototype = Date.prototype;
|
|
value = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date(lastBeatAt);
|
|
value = date instanceof Object ? date : value;
|
|
value = value.valueOf();
|
|
Date = global.Date;
|
|
prototype = Date.prototype;
|
|
value5 = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date(lastBeatAt2);
|
|
value6 = date instanceof Object ? date : value5;
|
|
value = value > value6.valueOf();
|
|
r0 = value ? -1 : 1;
|
|
} else if (lastBeatAt != null) {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
} else if (lastBeatAt2 != null) {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
} else {
|
|
updatedAt = a0 == null ? value : a0.updatedAt;
|
|
if (updatedAt == null) {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
} else {
|
|
updatedAt = a1 == null ? value : a1.updatedAt;
|
|
if (updatedAt != null) {
|
|
Date = global.Date;
|
|
updatedAt = a0.updatedAt;
|
|
prototype = Date.prototype;
|
|
value = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value = date instanceof Object ? date : value;
|
|
value = value.valueOf();
|
|
Date = global.Date;
|
|
updatedAt = a1.updatedAt;
|
|
prototype = Date.prototype;
|
|
value2 = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value3 = date instanceof Object ? date : value2;
|
|
value = value > value3.valueOf();
|
|
r0 = value ? -1 : 1;
|
|
} else {
|
|
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
|
|
}
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
global.__d(_fun56879, 7116, [7093, 6535, 22, 672, 7091, 1360,
|
|
2]) /* metro module 7116, dependencies: [7093, 6535, 22, 672, 7091, 1360, 2] */;
|