187 lines
11 KiB
TypeScript
187 lines
11 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] */
|
|
import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import ApexExperimentStore from '../../experiments/apex/ApexExperimentStore.tsx'; /* Metro dependency 1220 */
|
|
import SelectedChannelStore from '../../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import ExperimentStore from '../../experiments/ExperimentStore.tsx'; /* Metro dependency 4107 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as StorageModule from '../../../external/discord_common/js/packages/storage/Storage.tsx'; /* Metro dependency 587 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as RootNavigationRefNativeModule from '../../main_tabs_v2/RootNavigationRef.native.tsx'; /* Metro dependency 4008 */
|
|
import * as RequestReviewNoTTIExperimentModule from './RequestReviewNoTTIExperiment.tsx'; /* Metro dependency 12545 */
|
|
|
|
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_14 = {'revision': 0, 'firstUse': 0};
|
|
const Store = (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();
|
|
}
|
|
}});
|
|
(FileImportTrackerModule).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 = (RequestReviewNoTTIExperimentModule).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 = (RootNavigationRefNativeModule).getRootNavigationRef();
|
|
const object = {};
|
|
let r2 = rootNavigationRef != null && rootNavigationRef.isReady();
|
|
if (r2) {
|
|
moduleValue2 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
r2 = moduleValue2.coerceGuildsRoute(rootNavigationRef.getCurrentRoute()) != null;
|
|
}
|
|
object.isViewingChat = r2;
|
|
object.isKeyboardOpen = (require(6996) /* metro dependency 6996: useKeyboardIsOpen */).getKeyboardIsOpen();
|
|
const selectedChannelStoreBinding = SelectedChannelStore;
|
|
const getVoiceChannelId = selectedChannelStoreBinding.getVoiceChannelId;
|
|
object.isInVoice = Reflect.apply(getVoiceChannelId, selectedChannelStoreBinding, []) != null;
|
|
if (object.isViewingChat) {
|
|
if (object.isKeyboardOpen) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport2.track(AnalyticEvents.REVIEW_REQUEST_DEFERRED, {is_keyboard_open: object.isKeyboardOpen,
|
|
is_in_voice: object.isInVoice, is_viewing_chat: object.isViewingChat});
|
|
delayShowReviewRequestModal();
|
|
} else if (object.isInVoice) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport2.track(AnalyticEvents.REVIEW_REQUEST_DEFERRED, {is_keyboard_open: object.isKeyboardOpen,
|
|
is_in_voice: object.isInVoice, is_viewing_chat: object.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: object.isKeyboardOpen,
|
|
is_in_voice: object.isInVoice, is_viewing_chat: object.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 = (StorageModule).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 RequestReviewStore2 = RequestReviewStore;
|
|
Inherits(RequestReviewStore2, a0);
|
|
return CreateClass(RequestReviewStore2, [{key: 'initialize', value: value_95870}]);
|
|
function RequestReviewStore() { // fn#95869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12734:1670, offset: 0x01100674, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_3(this, RequestReviewStore);
|
|
const value3 = env1_6(RequestReviewStore);
|
|
return env1_5(this, _isNativeReflectConstruct_95860() ? global.Reflect.construct(value3, arguments,
|
|
env1_6(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
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 = (StorageModule).Storage;
|
|
env1_14 = Storage.get(env1_13) ?? ({'firstUse': 0, 'revision': 0});
|
|
this.waitFor(ApexExperimentStore, ExperimentStore, SelectedChannelStore);
|
|
}
|
|
|
|
}
|
|
|
|
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 object = {};
|
|
firstUse = env0_14.firstUse;
|
|
const Date = global.Date;
|
|
object.isInstallOldEnough = firstUse < Date.now() - 864000000;
|
|
object.isInLargeEnoughGuild = guilds.some(function(a0) {
|
|
return a0.member_count >= 5;
|
|
});
|
|
object.isAccountVerified = user.verified === true;
|
|
object.isNewRevision = env0_14.revision < 1;
|
|
if (object.isNewRevision) {
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.REVIEW_REQUEST_ELIGIBILITY_CHECKED, {is_hfu: true,
|
|
is_install_old_enough: object.isInstallOldEnough, is_in_large_enough_guild: object.isInLargeEnoughGuild,
|
|
is_account_verified: object.isAccountVerified});
|
|
}
|
|
const r1 = object.isInstallOldEnough && object.isAccountVerified && object.isInLargeEnoughGuild && object.isNewRevision;
|
|
delayShowReviewRequestModal();
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun95859, 12544, [6, 7, 15, 17, 18, 4107, 1220, 1934, 661, 12545, 12546, 4008, 4007, 6996, 676, 587,
|
|
683, 566, 694,
|
|
2]) /* metro module 12544, dependencies: [6, 7, 15, 17, 18, 4107, 1220, 1934, 661, 12545, 12546, 4008, 4007, 6996, 676, 587, 683, 566, 694, 2] */;
|