82 lines
3.1 KiB
TypeScript
82 lines
3.1 KiB
TypeScript
// Module ID: 6731
|
|
// Function ID: 6732
|
|
// Name: GuildSubscriptionsActionCreators
|
|
// Dependencies: [585, 6705, 2]
|
|
// Exports: subscribeChannel, subscribeChannelDimensions, subscribeGuild, subscribeMembers, subscribeToMemberUpdates, unsubscribeFromMemberUpdates, unsubscribeMembers
|
|
|
|
// Module 6731 (GuildSubscriptionsActionCreators)
|
|
import DispatcherDefault from "Dispatcher" /* 585 */;
|
|
import GuildChannelSubscriptions from "GuildChannelSubscriptions" /* 6705 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
let result = size.fileFinishedImporting("actions/GuildSubscriptionsActionCreators.tsx");
|
|
|
|
export const subscribeMembers = function subscribeMembers(guildId, userIds) {
|
|
const obj = DispatcherDefault;
|
|
const obj2 = { type: "GUILD_SUBSCRIPTIONS_MEMBERS_ADD", guildId, userIds };
|
|
obj.dispatch(obj2);
|
|
};
|
|
export const unsubscribeMembers = function unsubscribeMembers(guildId, userIds) {
|
|
const obj = DispatcherDefault;
|
|
const obj2 = { type: "GUILD_SUBSCRIPTIONS_MEMBERS_REMOVE", guildId, userIds };
|
|
obj.dispatch(obj2);
|
|
};
|
|
export const subscribeToMemberUpdates = function subscribeToMemberUpdates(guildId) {
|
|
const obj = DispatcherDefault;
|
|
const obj2 = { type: "GUILD_SUBSCRIPTIONS_ADD_MEMBER_UPDATES", guildId };
|
|
obj.dispatch(obj2);
|
|
};
|
|
export const unsubscribeFromMemberUpdates = function unsubscribeFromMemberUpdates(guildId) {
|
|
const obj = DispatcherDefault;
|
|
const obj2 = { type: "GUILD_SUBSCRIPTIONS_REMOVE_MEMBER_UPDATES", guildId };
|
|
obj.dispatch(obj2);
|
|
};
|
|
export const subscribeGuild = function subscribeGuild(guildId) {
|
|
const obj = DispatcherDefault;
|
|
const obj2 = { type: "GUILD_SUBSCRIPTIONS", guildId };
|
|
obj.dispatch(obj2);
|
|
};
|
|
export const subscribeChannel = function subscribeChannel(guildId, channelId, ranges) {
|
|
const obj = DispatcherDefault;
|
|
const obj2 = { type: "GUILD_SUBSCRIPTIONS_CHANNEL", guildId, channelId, ranges };
|
|
obj.dispatch(obj2);
|
|
};
|
|
export const subscribeChannelDimensions = function subscribeChannelDimensions(arg0) {
|
|
let channelId;
|
|
let guildId;
|
|
let height;
|
|
let rowHeight;
|
|
let y;
|
|
({ y, height, rowHeight } = arg0);
|
|
({ guildId, channelId } = arg0);
|
|
const bound = Math.max(0, Math.ceil(Math.ceil(0.5 * height / rowHeight)));
|
|
const tmp2 = -bound;
|
|
const bound1 = Math.max(0, Math.ceil(Math.ceil(y / rowHeight)) + tmp2);
|
|
let num = bound;
|
|
const sum = y + height;
|
|
if (bound === undefined) {
|
|
num = 0;
|
|
}
|
|
const items = [];
|
|
const bound2 = Math.max(0, Math.ceil(Math.ceil(sum / rowHeight)) + num);
|
|
let maxResult = bound1;
|
|
if (bound1 > 0) {
|
|
const _Math = Math;
|
|
const diff = GuildChannelSubscriptions.MINIMUM_RANGE - 1;
|
|
const items1 = [0, diff];
|
|
items.push(items1);
|
|
maxResult = max(diff + 1, bound1);
|
|
}
|
|
const rounded = Math.floor(maxResult / GuildChannelSubscriptions.MINIMUM_RANGE);
|
|
let result = rounded * GuildChannelSubscriptions.MINIMUM_RANGE;
|
|
if (result <= bound2) {
|
|
do {
|
|
let sum1 = result + (GuildChannelSubscriptions.MINIMUM_RANGE - 1);
|
|
let items2 = [result, sum1];
|
|
let arr2 = items.push(items2);
|
|
result = sum1 + 1;
|
|
} while (result <= bound2);
|
|
}
|
|
const obj = DispatcherDefault;
|
|
obj.dispatch({ type: "GUILD_SUBSCRIPTIONS_CHANNEL", guildId, channelId, ranges: items });
|
|
};
|