285 lines
11 KiB
TypeScript
285 lines
11 KiB
TypeScript
/* Metro module 7114; source: modules/quests/utils/QuestUtils.tsx; dependencies: [57, 4295, 1867, 3784, 4297, 7115, 6528, 7116, 7117, 7118, 7119, 7120, 2] */
|
|
function _fun56858(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:6, offset: 0x013d3ddf, size: 372 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_56861 = 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 = isSponsoredPlayQuest;
|
|
const closure2 = function(a0, a1) {
|
|
var Set = global.Set;
|
|
return new Set(a0.config.features).has(a1);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(57) /* metro dependency 57 */;
|
|
const gameConsoleStore = importDefault(4295) /* metro dependency 4295: GameConsoleStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
|
|
const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */;
|
|
const questUtmStore = importDefault(7115) /* metro dependency 7115: QuestUtmStore */;
|
|
const questConstantsModule = require(6528) /* metro dependency 6528: QuestConstants */;
|
|
const env0_8 = questConstantsModule.DISCORD_APPLICATION_ID;
|
|
const env0_9 = questConstantsModule.QuestVariants;
|
|
const env0_10 = questConstantsModule.RewardFilterTypes;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestUtils.tsx');
|
|
exports.isSponsoredPlayQuest = closure;
|
|
exports.isPlayAnyActivityQuest = function(a0) {
|
|
return require(dependencyMap[7]).getPlayActivityApplicationId(a0) === DISCORD_APPLICATION_ID;
|
|
};
|
|
exports.hasVariant = closure2;
|
|
exports.canLaunchActivity = canLaunchActivity;
|
|
exports.filterQuestsForSocialEntrypoints = filterQuestsForSocialEntrypoints;
|
|
exports.isShareableQuest = function({sharePolicy}) {
|
|
return sharePolicy !== require(dependencyMap[8]).QuestSharePolicy.NOT_SHAREABLE;
|
|
};
|
|
exports.isStreamingAndCanWatch = isStreamingAndCanWatch;
|
|
exports.getQuestType = function(a0) {
|
|
var hasWatchVideoTasks = require(dependencyMap[7]).hasWatchVideoTasks({config: a0});
|
|
var property = require(dependencyMap[10]).QuestType;
|
|
return hasWatchVideoTasks ? property.VIDEO : property.GAMEPLAY;
|
|
};
|
|
exports.isQuestFeaturedByHero = function({questIds}, a1) {
|
|
var r1;
|
|
r1 = questIds?.includes(a1);
|
|
return r1 != null && r1;
|
|
};
|
|
exports.shouldShowBountiesGivenFilters = function(a0) {
|
|
return !a0.some(_fun56872) && (a0.length === 0 || a0.some(_fun56873));
|
|
};
|
|
exports.setQuestHomeUtmContext = setQuestHomeUtmContext;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_56859(a0, a1) { // fn#56859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:238, offset: 0x013d3f53, 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 _fun56860;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_56861(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_56861(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_56861(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun56860;
|
|
}
|
|
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 isSponsoredPlayQuest(a0) { // fn#56862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:1148, offset: 0x013d40c5, size: 70 bytes, params: 2, frame: 13
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
let value = require(7116) /* metro dependency 7116: QuestTaskUtils */;
|
|
value = value.getDesktopApplicationIds(a0);
|
|
return value != null && value.length > 1;
|
|
}
|
|
|
|
function canLaunchActivity(a0) { // fn#56865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:1613, offset: 0x013d4176, size: 72 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var value;
|
|
const hasPlayActivityTask2 = (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasPlayActivityTask(a0);
|
|
if (hasPlayActivityTask2) {
|
|
r0 = hasPlayActivityTask2;
|
|
} else {
|
|
value = require(7116) /* metro dependency 7116: QuestTaskUtils */;
|
|
value = value.hasAchievementActivityTask(a0);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function filterQuestsForSocialEntrypoints(a0, a1) { // fn#56866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:1759, offset: 0x013d41be, size: 299 bytes, params: 3, frame: 30
|
|
var r4;
|
|
var r19;
|
|
var value5;
|
|
var value6;
|
|
var property;
|
|
var property2;
|
|
var hasVariantBinding;
|
|
var NON_GAMING_PLAY_QUEST;
|
|
var moduleValue;
|
|
var getQuestTaskTypes;
|
|
var value7;
|
|
var value8;
|
|
var value9;
|
|
var has;
|
|
var value10;
|
|
var set;
|
|
var value11;
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
const value3 = _createForOfIteratorHelperLoose_56859(a0);
|
|
const value4 = value3();
|
|
let done = value4.done;
|
|
if (!done) {
|
|
r4 = value4;
|
|
while (true) {
|
|
value5 = r4.value;
|
|
value6 = env0_2(value5, 2);
|
|
property = value6[0];
|
|
property2 = value6[1];
|
|
if (!isSponsoredPlayQuest(property2)) {
|
|
hasVariantBinding = hasVariant;
|
|
NON_GAMING_PLAY_QUEST = QuestVariants.NON_GAMING_PLAY_QUEST;
|
|
if (hasVariantBinding(property2, NON_GAMING_PLAY_QUEST)) {
|
|
break;
|
|
}
|
|
_createForOfIteratorHelperLoose_56859Binding = _createForOfIteratorHelperLoose_56859;
|
|
moduleValue = require(7116) /* metro dependency 7116: QuestTaskUtils */;
|
|
getQuestTaskTypes = moduleValue.getQuestTaskTypes;
|
|
value7 = _createForOfIteratorHelperLoose_56859Binding(Reflect.apply(getQuestTaskTypes, moduleValue,
|
|
[property2]));
|
|
value8 = value7();
|
|
done = value8.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r19 = value8;
|
|
loopExit4: while (true) {
|
|
value9 = r19.value;
|
|
has = a1.has;
|
|
if (Reflect.apply(has, a1, [value9])) {
|
|
set = map.set;
|
|
Reflect.apply(set, map, [property, property2]);
|
|
break loopExit4;
|
|
}
|
|
value10 = value7();
|
|
done = value10.done;
|
|
if (done) {
|
|
break loopExit4;
|
|
}
|
|
r19 = value10;
|
|
continue;
|
|
}
|
|
}
|
|
value11 = value3();
|
|
done = value11.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r4 = value11;
|
|
continue;
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
function isStreamingAndCanWatch(a0, a1) { // fn#56868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2270, offset: 0x013d431d, size: 87 bytes, params: 3, frame: 20
|
|
return a0 != null && a1 != null && (require(7118) /* metro dependency 7118: StreamPermissionUtils */).canWatchStream(a1,
|
|
VoiceStateStore, GuildStore, PermissionStore, GameConsoleStore)[0];
|
|
}
|
|
|
|
function shouldShowBountiesGivenFilters(a0) { // fn#56871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2681, offset: 0x013d43fc, size: 62 bytes, params: 2, frame: 13
|
|
return !a0.some(function(a0) {
|
|
return a0.group === 'task';
|
|
}) && (a0.length === 0 || a0.some(_fun56873));
|
|
}
|
|
|
|
function setQuestHomeUtmContext({questId, fromContent, utmSource, utmMedium}) { // fn#56874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2868, offset: 0x013d4479, size: 112 bytes, params: 2, frame: 16
|
|
const state = QuestUtmStore.getState();
|
|
const setUtmCurrentContext = state.setUtmCurrentContext;
|
|
const object2 = {utmSourceCurrent: utmSource, utmMediumCurrent: utmMedium, utmCampaignCurrent: questId};
|
|
object2.utmContentCurrent = (require(7120) /* metro dependency 7120: AnalyticsTypes */).getQuestContentName(fromContent);
|
|
Reflect.apply(setUtmCurrentContext, state, [object2]);
|
|
}
|
|
|
|
function _fun56873(a0) { // fn#56873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2785, offset: 0x013d444d, size: 44 bytes, params: 2, frame: 3
|
|
var r0;
|
|
var filter;
|
|
let value = a0.group === 'reward';
|
|
if (value) {
|
|
filter = a0.filter;
|
|
value = environment.__proto__;
|
|
value = filter === RewardFilterTypes.VIRTUAL_CURRENCY;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|