112 lines
4.8 KiB
TypeScript
112 lines
4.8 KiB
TypeScript
/* Metro module 13382; source: modules/harvester/HarvesterUtils.tsx; dependencies: [57, 31, 1878, 12554, 13383, 566, 2] */
|
|
function _fun101906(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13572:6, offset: 0x0222310a, size: 202 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const dataHarvestStore = importDefault(12554) /* metro dependency 12554: DataHarvestStore */;
|
|
const env0_6 = (require(13383) /* metro dependency 13383: HarvesterConstants */).REQUEST_DATA_LIMIT_MS;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/harvester/HarvesterUtils.tsx');
|
|
exports.harvestDisabled = harvestDisabled;
|
|
exports.useRequestHarvestStatus = useRequestHarvestStatus;
|
|
}
|
|
|
|
function harvestDisabled(a0, a1) { // fn#101907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13572:256, offset: 0x022231d4, size: 128 bytes, params: 3, frame: 16
|
|
var r2;
|
|
var r1;
|
|
var r0;
|
|
var Date;
|
|
var created_at;
|
|
var date;
|
|
const verified = a1.verified;
|
|
let value = !verified;
|
|
if (verified) {
|
|
value = a1.isStaff();
|
|
if (value) {
|
|
r1 = !!value;
|
|
} else {
|
|
value = a0 != null;
|
|
if (value) {
|
|
Date = global.Date;
|
|
value = Date.now();
|
|
Date = global.Date;
|
|
created_at = a0.created_at;
|
|
date = new Date();
|
|
value = REQUEST_DATA_LIMIT_MS > value - date.getTime();
|
|
r2 = value;
|
|
} else {
|
|
r2 = value;
|
|
}
|
|
r1 = r2;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function useRequestHarvestStatus() { // fn#101908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13572:404, offset: 0x02223254, size: 407 bytes, params: 1, frame: 19
|
|
var r5;
|
|
var Date;
|
|
var created_at;
|
|
var value4;
|
|
var date;
|
|
const currentUser = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
|
|
return UserStore.getCurrentUser();
|
|
});
|
|
const harvestType = (require(566) /* metro dependency 566: flux */).useStateFromStores([DataHarvestStore],
|
|
function() {
|
|
return DataHarvestStore.harvestType;
|
|
});
|
|
let binding = env0_3;
|
|
const [property, env0_0] = env0_2(binding.useState(function() {
|
|
var Date = global.Date;
|
|
return Date.now();
|
|
}), 2);
|
|
if (harvestType == null) {
|
|
r5 = property;
|
|
} else {
|
|
Date = global.Date;
|
|
created_at = harvestType.created_at;
|
|
value4 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
r5 = (date instanceof Object ? date : value4).getTime() + REQUEST_DATA_LIMIT_MS;
|
|
}
|
|
binding = env0_3;
|
|
var env0_2 = binding.useRef(null);
|
|
binding.useEffect(_fun101912, [r5]);
|
|
return currentUser == null ? {'allowed': false,
|
|
'reason': 'not_verified'} : currentUser.verified ? currentUser.isStaff() ? {'allowed': false,
|
|
'reason': 'staff'} : harvestType == null ? {allowed: true} : r5 > property ? {'allowed': false,
|
|
'reason': 'rate_limited', nextAllowed: new global.Date()} : {allowed: true} : {'allowed': false,
|
|
'reason': 'not_verified'};
|
|
}
|
|
|
|
function _fun101912() { // fn#101912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13572:694, offset: 0x022233fa, size: 96 bytes, params: 1, frame: 16
|
|
var value3;
|
|
const binding = env0_1;
|
|
const Date = global.Date;
|
|
const value2 = binding - Date.now();
|
|
if (value2 > 0) {
|
|
value3 = global.setTimeout(_fun101913, value2);
|
|
global.clearTimeout(env0_2.current);
|
|
env0_2.current = value3;
|
|
}
|
|
return _fun101914;
|
|
}
|
|
|
|
function _fun101913() { // fn#101913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13572:744, offset: 0x0222345a, size: 33 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
const binding = env1_0;
|
|
const Date = global.Date;
|
|
return binding(Date.now());
|
|
}
|
|
|
|
function _fun101914() { // fn#101914, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13572:808, offset: 0x0222347b, size: 29 bytes, params: 1, frame: 11
|
|
return global.clearTimeout(env1_2.current);
|
|
}
|
|
|