96 lines
5.0 KiB
TypeScript
96 lines
5.0 KiB
TypeScript
/* Metro module 12633; source: modules/midjourney_onboarding/MidjourneyOnboardingUtils.tsx; dependencies: [1867, 3969, 12634, 566, 2] */
|
|
function _fun96907(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:6, offset: 0x0216b7f2, size: 207 bytes, params: 8, frame: 20
|
|
let env0_0 = require;
|
|
const closure = isMidjourneyOnboardingFlow;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */;
|
|
const midjourneyOnboardingConstantsModule = require(12634) /* metro dependency 12634: MidjourneyOnboardingConstants */;
|
|
const env0_4 = midjourneyOnboardingConstantsModule.MIDJOURNEY_BOT_ID;
|
|
const env0_5 = midjourneyOnboardingConstantsModule.MIDJOURNEY_GUILD_ID;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/midjourney_onboarding/MidjourneyOnboardingUtils.tsx');
|
|
exports.isMidjourneyOnboardingFlow = closure;
|
|
exports.useIsMidjourneyOnboardingFlow = function() {
|
|
return require(dependencyMap[3]).useStateFromStores([GuildStore], _fun96910, []);
|
|
};
|
|
exports.isEligibleForMidjourneyRedirect = isEligibleForMidjourneyRedirect;
|
|
exports.hasRedirectedToGuild = function(a0) {
|
|
var env0_0 = a0;
|
|
var Promise = global.Promise;
|
|
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
var value2 = new Promise(_fun96913);
|
|
return value2 instanceof Object ? value2 : value;
|
|
};
|
|
}
|
|
|
|
function isMidjourneyOnboardingFlow() { // fn#96908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:172, offset: 0x0216b8c1, size: 148 bytes, params: 1, frame: 13
|
|
var r1;
|
|
var value4;
|
|
let value = a0;
|
|
const value2 = undefined;
|
|
const r2 = (value !== value2 ? value : {}).guildStore ?? GuildStore;
|
|
value = r2.getGuild(MIDJOURNEY_GUILD_ID);
|
|
let joinedAt = value == null ? value2 : value.joinedAt;
|
|
const Date = global.Date;
|
|
const value3 = joinedAt instanceof Date;
|
|
if (value3) {
|
|
value4 = global.Date.now();
|
|
joinedAt = value.joinedAt;
|
|
value = value4 - joinedAt.getTime();
|
|
value = value <= 3600000;
|
|
r1 = value;
|
|
} else {
|
|
r1 = value3;
|
|
}
|
|
value = r2.getGuildCount();
|
|
value = value === 1;
|
|
return value && r1;
|
|
}
|
|
|
|
function useIsMidjourneyOnboardingFlow() { // fn#96909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:558, offset: 0x0216b955, size: 64 bytes, params: 1, frame: 15
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
|
|
return isMidjourneyOnboardingFlow({guildStore: GuildStore});
|
|
}, []);
|
|
}
|
|
|
|
function isEligibleForMidjourneyRedirect(a0) { // fn#96911, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:725, offset: 0x0216b9b0, size: 83 bytes, params: 2, frame: 11
|
|
return a0.isDM() && a0.rawRecipients.length === 1 && a0.rawRecipients[0].id === MIDJOURNEY_BOT_ID && isMidjourneyOnboardingFlow();
|
|
}
|
|
|
|
function hasRedirectedToGuild(a0) { // fn#96912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:894, offset: 0x0216ba03, size: 46 bytes, params: 2, frame: 11
|
|
const env0_0 = a0;
|
|
const Promise = global.Promise;
|
|
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
const promise = new Promise(_fun96913);
|
|
return promise instanceof Object ? promise : value;
|
|
}
|
|
|
|
function _fun96913(a0, a1) { // fn#96913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:947, offset: 0x0216ba31, size: 126 bytes, params: 3, frame: 15
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
if (SelectedGuildStore.getGuildId() !== env0_0) {
|
|
var env0_2 = global.setTimeout(function() {
|
|
cleanup_96916();
|
|
require();
|
|
}, 3000);
|
|
SelectedGuildStore.addChangeListener(handleSelectedGuildUpdate);
|
|
} else {
|
|
a0();
|
|
}
|
|
}
|
|
|
|
function handleSelectedGuildUpdate() { // fn#96915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:1048, offset: 0x0216bac6, size: 53 bytes, params: 1, frame: 10
|
|
const value = environment.__proto__.__proto__;
|
|
if (SelectedGuildStore.getGuildId() === env1_0) {
|
|
cleanup_96916();
|
|
env0_0();
|
|
}
|
|
}
|
|
|
|
function cleanup_96916() { // fn#96916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12823:1098, offset: 0x0216bafb, size: 46 bytes, params: 1, frame: 12
|
|
SelectedGuildStore.removeChangeListener(handleSelectedGuildUpdate);
|
|
global.clearTimeout(env0_2);
|
|
}
|
|
|