163 lines
8.9 KiB
TypeScript
163 lines
8.9 KiB
TypeScript
/* Metro module 11248; source: modules/favorites/FavoritesHooks.tsx; dependencies: [3969, 1878, 1382, 11249, 1880, 11250, 566, 1900, 21, 1314, 6892, 2] */
|
|
function _fun85972(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#85972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:6, offset: 0x01f8308b, size: 326 bytes, params: 8, frame: 23
|
|
let env0_0 = require;
|
|
const closure = useFavoritesAccess;
|
|
const closure2 = function() {
|
|
return require(dependencyMap[6]).useStateFromStoresObject([FavoriteStore], _fun85976);
|
|
};
|
|
const closure3 = getFavoritesCategories;
|
|
const closure4 = useIsFavoritesGuildSelected;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const favoriteStore = importDefault(1382) /* metro dependency 1382: FavoriteStore */;
|
|
const env0_6 = (require(11249) /* metro dependency 11249: FavoritesNotificationStore */).useFavoritesNotificationStore;
|
|
const env0_7 = (require(1880) /* metro dependency 1880: PremiumConstants */).PremiumTypes;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/favorites/FavoritesHooks.tsx');
|
|
exports.useFavoritesAccess = closure;
|
|
exports.useFavorites = closure2;
|
|
exports.useFavorite = function(a0) {
|
|
var env0_0 = a0;
|
|
return require(dependencyMap[6]).useStateFromStores([FavoriteStore], _fun85982);
|
|
};
|
|
exports.useFavoritedChannelIds = useFavoritedChannelIds;
|
|
exports.getFavoritesCategories = closure3;
|
|
exports.useFavoritesCategories = function() {
|
|
return require(dependencyMap[6]).useStateFromStores([FavoriteStore], _fun85985);
|
|
};
|
|
exports.useIsFavoritesGuildSelected = closure4;
|
|
exports.useFavoritesAwareChannel = useFavoritesAwareChannel;
|
|
exports.useFavoriteAdded = function() {
|
|
var object = {};
|
|
object.favoriteAdded = useFavoritesNotificationStore(_fun85989);
|
|
object.notifyFavoriteAdded = useFavoritesNotificationStore(_fun85990);
|
|
object.clearFavoriteAdded = useFavoritesNotificationStore(_fun85991);
|
|
return object;
|
|
};
|
|
}
|
|
|
|
function useFavoritesAccess(a0) { // fn#85973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:190, offset: 0x01f831d1, size: 168 bytes, params: 2, frame: 18
|
|
const {enabled,
|
|
hasHigherPrivileges} = (require(11250) /* metro dependency 11250: FavoritesGuildExperiment */).useFavoritesGuildConfig({location: a0});
|
|
const currentUser = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
|
|
return UserStore.getCurrentUser();
|
|
});
|
|
const defaultImport = importDefault(1900) /* metro dependency 1900: PremiumTypeUtils */;
|
|
const isPremiumExactly = defaultImport.isPremiumExactly;
|
|
const TIER_2 = PremiumTypes.TIER_2;
|
|
return {hasAccess: enabled && Reflect.apply(isPremiumExactly, defaultImport, [currentUser, TIER_2]),
|
|
isExperimentEnabled: enabled, hasHigherPrivileges: hasHigherPrivileges};
|
|
}
|
|
|
|
function useFavorites() { // fn#85975, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:474, offset: 0x01f83279, size: 60 bytes, params: 1, frame: 13
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([FavoriteStore], function() {
|
|
return FavoriteStore.getFavoriteChannels();
|
|
});
|
|
}
|
|
|
|
function getFavoritesCategories() { // fn#85977, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:573, offset: 0x01f832c8, size: 199 bytes, params: 1, frame: 26
|
|
var r7;
|
|
var r16;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var property;
|
|
var type;
|
|
var FavoriteChannelType;
|
|
var CATEGORY;
|
|
var push;
|
|
var id;
|
|
var nickname;
|
|
let value = a0;
|
|
const r13 = value !== undefined ? value : FavoriteStore.getFavoriteChannels();
|
|
value = '';
|
|
const items2 = [{'id': null, 'name': ''}];
|
|
for (propertyName in r13) {
|
|
property = r13[propertyName];
|
|
type = property.type;
|
|
FavoriteChannelType = (require(1314) /* metro dependency 1314: preloaded_user_settings */).FavoriteChannelType;
|
|
CATEGORY = FavoriteChannelType.CATEGORY;
|
|
if (type !== CATEGORY) {
|
|
r7 = propertyName2;
|
|
continue;
|
|
}
|
|
push = items2.push;
|
|
id = property.id;
|
|
nickname = property.nickname;
|
|
if (nickname != null) {
|
|
r16 = nickname;
|
|
continue;
|
|
}
|
|
r16 = value;
|
|
continue;
|
|
Reflect.apply(push, items2, [{id: id, name: r16}]);
|
|
r7 = propertyName2;
|
|
}
|
|
items2.sort(_fun85978);
|
|
return items2;
|
|
}
|
|
|
|
function useIsFavoritesGuildSelected() { // fn#85979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:929, offset: 0x01f833f0, size: 82 bytes, params: 1, frame: 16
|
|
const fluxModule = require(566) /* metro dependency 566: flux */;
|
|
const useStateFromStores = fluxModule.useStateFromStores;
|
|
return (require(6892) /* metro dependency 6892: FavoritesUtils */).isFavoritesGuildId(Reflect.apply(useStateFromStores,
|
|
fluxModule, [[SelectedGuildStore], function() {
|
|
return SelectedGuildStore.getGuildId();
|
|
}]));
|
|
}
|
|
|
|
function useFavorite(a0) { // fn#85981, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:1218, offset: 0x01f83455, size: 66 bytes, params: 2, frame: 14
|
|
const env0_0 = a0;
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([FavoriteStore], _fun85982);
|
|
}
|
|
|
|
function useFavoritedChannelIds() { // fn#85983, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:1330, offset: 0x01f834b2, size: 45 bytes, params: 1, frame: 13
|
|
return (importDefault(21) /* metro dependency 21: SnowflakeUtils */).keys(useFavorites());
|
|
}
|
|
|
|
function useFavoritesCategories() { // fn#85984, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:1482, offset: 0x01f834df, size: 59 bytes, params: 1, frame: 13
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([FavoriteStore], _fun85985);
|
|
}
|
|
|
|
function useFavoritesAwareChannel(a0, a1) { // fn#85986, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:1695, offset: 0x01f83538, size: 150 bytes, params: 3, frame: 19
|
|
const value = a0;
|
|
const value3 = useIsFavoritesGuildSelected();
|
|
const hasAccess = useFavoritesAccess(a1).hasAccess;
|
|
const fluxModule = require(566) /* metro dependency 566: flux */;
|
|
const useStateFromStores = fluxModule.useStateFromStores;
|
|
return value3 ? hasAccess && Reflect.apply(useStateFromStores, fluxModule, [[FavoriteStore], _fun85987,
|
|
[value]]) ? value == null ? value ?? null : value.isCategory() ? null : value ?? null : null : value ?? null;
|
|
}
|
|
|
|
function useFavoriteAdded() { // fn#85988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:2003, offset: 0x01f8362e, size: 66 bytes, params: 1, frame: 13
|
|
const object2 = {};
|
|
object2.favoriteAdded = useFavoritesNotificationStore(function(a0) {
|
|
return a0.favoriteAdded;
|
|
});
|
|
object2.notifyFavoriteAdded = useFavoritesNotificationStore(function(a0) {
|
|
return a0.notifyFavoriteAdded;
|
|
});
|
|
object2.clearFavoriteAdded = useFavoritesNotificationStore(function(a0) {
|
|
return a0.clearFavoriteAdded;
|
|
});
|
|
return object2;
|
|
}
|
|
|
|
function _fun85978({id}, {id}) { // fn#85978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:800, offset: 0x01f8338f, size: 97 bytes, params: 3, frame: 7
|
|
return (env0_0[id]?.order ?? 0) - (env0_0[id]?.order ?? 0);
|
|
}
|
|
|
|
function _fun85982() { // fn#85982, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:1281, offset: 0x01f83497, size: 27 bytes, params: 1, frame: 11
|
|
return FavoriteStore.getFavorite(env0_0);
|
|
}
|
|
|
|
function _fun85985() { // fn#85985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:1555, offset: 0x01f8351a, size: 30 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
return getFavoritesCategories(FavoriteStore.getFavoriteChannels());
|
|
}
|
|
|
|
function _fun85987() { // fn#85987, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11434:1838, offset: 0x01f835ce, size: 96 bytes, params: 1, frame: 14
|
|
return env0_0 != null && (FavoriteStore.isFavorite(env0_0.id) || env0_0.isThread() && FavoriteStore.isFavorite(env0_0.parent_id));
|
|
}
|
|
|