169 lines
9.1 KiB
TypeScript
169 lines
9.1 KiB
TypeScript
/* Metro module 12544; source: modules/feedback/native/RequestReviewStore.tsx; dependencies: [6, 7, 15, 17, 18, 4107, 1220, 1934, 661, 12545, 12546, 4008, 4007, 6996, 676, 587, 683, 566, 694, 2] */
|
|
function _fun95859(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#95859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:6, offset: 0x02150ad3, size: 484 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = function() {
|
|
cancelExistingTimeout();
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
const experimentStore = importDefault(4107) /* metro dependency 4107: ExperimentStore */;
|
|
const apexExperimentStore = importDefault(1220) /* metro dependency 1220: ApexExperimentStore */;
|
|
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
|
|
const env0_11 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
|
|
const env0_14 = {'revision': 0, 'firstUse': 0};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
let value = _fun95868(Store);
|
|
value.displayName = 'RequestReviewStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{CONNECTION_OPEN: CONNECTION_OPEN_95871, CONNECTION_RESUMED: function() {
|
|
delayShowReviewRequestModal();
|
|
}, CONNECTION_CLOSED: closure, CONNECTION_INTERRUPTED: closure, TTI_RECORDED: function(a0) {
|
|
env0_12 = a0.tti;
|
|
delayShowReviewRequestModal();
|
|
}, APP_STATE_UPDATE: function({state}) {
|
|
if (state === require(dependencyMap[14]).AppStates.ACTIVE) {
|
|
delayShowReviewRequestModal();
|
|
} else {
|
|
cancelExistingTimeout();
|
|
}
|
|
}});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/feedback/native/RequestReviewStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_95860() { // fn#95860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:203, offset: 0x02150cb7, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_95860_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function delayShowReviewRequestModal() { // fn#95863, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:461, offset: 0x02150d19, size: 142 bytes, params: 1, frame: 16
|
|
cancelExistingTimeout();
|
|
const RequestReviewNoTTIExperiment = (require(12545) /* metro dependency 12545: RequestReviewNoTTIExperiment */).RequestReviewNoTTIExperiment;
|
|
const getConfig = RequestReviewNoTTIExperiment.getConfig;
|
|
if (env0_15 && (Reflect.apply(getConfig, RequestReviewNoTTIExperiment,
|
|
[{location: 'RequestReviewStore'}]).skipTTICheck || env0_12 !== undefined && env0_12 < 2300)) {
|
|
env0_16 = global.setTimeout(showReviewRequestModal, 60000);
|
|
}
|
|
}
|
|
|
|
function showReviewRequestModal() { // fn#95864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:730, offset: 0x02150da7, size: 371 bytes, params: 1, frame: 18
|
|
var moduleValue2;
|
|
var defaultImport;
|
|
var defaultImport2;
|
|
const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
|
|
const object2 = {};
|
|
let r2 = rootNavigationRef != null && rootNavigationRef.isReady();
|
|
if (r2) {
|
|
moduleValue2 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
r2 = moduleValue2.coerceGuildsRoute(rootNavigationRef.getCurrentRoute()) != null;
|
|
}
|
|
object2.isViewingChat = r2;
|
|
object2.isKeyboardOpen = (require(6996) /* metro dependency 6996: useKeyboardIsOpen */).getKeyboardIsOpen();
|
|
const getVoiceChannelId = SelectedChannelStore.getVoiceChannelId;
|
|
object2.isInVoice = Reflect.apply(getVoiceChannelId, SelectedChannelStore, []) != null;
|
|
if (object2.isViewingChat) {
|
|
if (object2.isKeyboardOpen) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport2.track(AnalyticEvents.REVIEW_REQUEST_DEFERRED, {is_keyboard_open: object2.isKeyboardOpen,
|
|
is_in_voice: object2.isInVoice, is_viewing_chat: object2.isViewingChat});
|
|
delayShowReviewRequestModal();
|
|
} else if (object2.isInVoice) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport2.track(AnalyticEvents.REVIEW_REQUEST_DEFERRED, {is_keyboard_open: object2.isKeyboardOpen,
|
|
is_in_voice: object2.isInVoice, is_viewing_chat: object2.isViewingChat});
|
|
delayShowReviewRequestModal();
|
|
} else {
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.REVIEW_REQUEST_SHOW_ATTEMPTED);
|
|
env0_14.revision = 1;
|
|
writePersistedState();
|
|
(importDefault(12546) /* metro dependency 12546: requestReviewModal */)();
|
|
}
|
|
} else {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport2.track(AnalyticEvents.REVIEW_REQUEST_DEFERRED, {is_keyboard_open: object2.isKeyboardOpen,
|
|
is_in_voice: object2.isInVoice, is_viewing_chat: object2.isViewingChat});
|
|
delayShowReviewRequestModal();
|
|
}
|
|
}
|
|
|
|
function cancelExistingTimeout() { // fn#95866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:1531, offset: 0x02150f29, size: 44 bytes, params: 1, frame: 13
|
|
if (env0_16 !== -1) {
|
|
global.clearTimeout(env0_16);
|
|
}
|
|
}
|
|
|
|
function writePersistedState() { // fn#95867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:1595, offset: 0x02150f55, size: 52 bytes, params: 1, frame: 14
|
|
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
|
|
Storage.set(env0_13, env0_14);
|
|
}
|
|
|
|
function _fun95868(a0) { // fn#95868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:1658, offset: 0x02150f89, size: 72 bytes, params: 2, frame: 15
|
|
const closure = RequestReviewStore;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: 'initialize', value: value_95870}]);
|
|
}
|
|
|
|
function CONNECTION_OPEN_95871({user, guilds}) { // fn#95871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:2205, offset: 0x02151034, size: 331 bytes, params: 2, frame: 16
|
|
var defaultImport;
|
|
let firstUse = env0_14.firstUse;
|
|
if (firstUse === 0) {
|
|
env0_14.firstUse = global.Date.now();
|
|
writePersistedState();
|
|
}
|
|
const object2 = {};
|
|
firstUse = env0_14.firstUse;
|
|
const Date = global.Date;
|
|
object2.isInstallOldEnough = firstUse < Date.now() - 864000000;
|
|
object2.isInLargeEnoughGuild = guilds.some(function(a0) {
|
|
return a0.member_count >= 5;
|
|
});
|
|
object2.isAccountVerified = user.verified === true;
|
|
object2.isNewRevision = env0_14.revision < 1;
|
|
if (object2.isNewRevision) {
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.REVIEW_REQUEST_ELIGIBILITY_CHECKED, {is_hfu: true,
|
|
is_install_old_enough: object2.isInstallOldEnough, is_in_large_enough_guild: object2.isInLargeEnoughGuild,
|
|
is_account_verified: object2.isAccountVerified});
|
|
}
|
|
const r1 = object2.isInstallOldEnough && object2.isAccountVerified && object2.isInLargeEnoughGuild && object2.isNewRevision;
|
|
delayShowReviewRequestModal();
|
|
}
|
|
|
|
function value_95870() { // fn#95870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:1978, offset: 0x02150fd1, size: 99 bytes, params: 1, frame: 16
|
|
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
|
|
env1_14 = Storage.get(env1_13) ?? ({'firstUse': 0, 'revision': 0});
|
|
this.waitFor(ApexExperimentStore, ExperimentStore, SelectedChannelStore);
|
|
}
|
|
|