decord/source/modules/friend_groups/FriendGroupsStore.tsx

181 lines
5.2 KiB
TypeScript
Raw Normal View History

// Module ID: 13705
// Function ID: 13706
2026-07-29 08:29:29 +00:00
// Name: initialize
// Dependencies: [7659, 6595, 4209, 1371, 504, 573, 2]
2026-07-23 10:11:24 +00:00
// Module 13705 (initialize)
import initializeDefault from "initialize" /* 504 */;
import dispatcherDefault from "dispatcher" /* 573 */;
import closure_0 from "recomputeAffinities" /* 7659 */;
import closure_1 from "hasConsented" /* 6595 */;
import closure_2 from "markAllUserIdListsStale" /* 4209 */;
import closure_3 from "mergeGuildAvatar" /* 1371 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
let closure_4 = [];
let c5 = false;
2026-08-24 06:08:38 +00:00
const PersistedStore = initializeDefault.PersistedStore;
2026-07-29 08:29:29 +00:00
class FriendGroupsStore extends PersistedStore {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = FriendGroupsStore.prototype;
prototype["initialize"] = function initialize(groups) {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_1, closure_2, closure_0, closure_3);
2026-07-29 08:29:29 +00:00
if (null != groups) {
groups = groups.groups;
if (groups == null) {
groups = [];
}
let flag = groups.isInitialized;
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
};
prototype["getGroups"] = function getGroups() {
return closure_4;
};
prototype["getGroup"] = function getGroup(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
let found = arr.find((id) => id.id === closure_0);
2026-07-29 08:29:29 +00:00
if (found == null) {
found = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return found;
};
prototype["getGroupIds"] = function getGroupIds() {
return arr.map((id) => id.id);
};
prototype["getUserGroups"] = function getUserGroups(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
return arr.filter((userIds) => {
userIds = userIds.userIds;
2026-08-24 06:08:38 +00:00
return userIds.includes(closure_0);
2026-07-29 08:29:29 +00:00
});
};
prototype["isGroupEmpty"] = function isGroupEmpty(arg0) {
const group = this.getGroup(arg0);
let tmp2 = null == group;
if (!tmp2) {
tmp2 = 0 === group.userIds.length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
};
prototype["isInitialized"] = function isInitialized() {
return c5;
};
prototype["getState"] = function getState() {
return { groups: closure_4, isInitialized: c5 };
};
FriendGroupsStore.displayName = "FriendGroupsStore";
FriendGroupsStore.persistKey = "FriendGroupsStoreV2";
2026-08-24 06:08:38 +00:00
const friendGroupsStore = new FriendGroupsStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
POST_CONNECTION_OPEN: function handleInitializeFriendGroups() {
2026-07-29 08:29:29 +00:00
if (!c5) {
2026-07-20 16:05:17 +00:00
if (arr.length <= 0) {
2026-07-23 10:11:24 +00:00
arr = [];
2026-07-29 08:29:29 +00:00
c5 = true;
2026-07-20 16:05:17 +00:00
}
}
return false;
},
CREATE_FRIEND_GROUP: function handleCreateFriendGroup(groupId) {
groupId = groupId.groupId;
2026-07-29 08:29:29 +00:00
const someResult = arr.some((id) => id.id === groupId);
let flag = !someResult;
if (!someResult) {
const obj = { id: null, name: null, userIds: null };
obj[0] = groupId;
obj[1] = groupId.name;
obj[2] = [];
2026-07-23 10:11:24 +00:00
arr = arr.push(obj);
2026-07-20 16:05:17 +00:00
flag = true;
}
return flag;
},
UPDATE_FRIEND_GROUP: function handleUpdateFriendGroup(groupId) {
groupId = groupId.groupId;
const findIndexResult = arr.findIndex((id) => id.id === groupId);
let flag = -1 !== findIndexResult;
if (flag) {
const obj = {};
const merged = Object.assign(arr[findIndexResult]);
2026-07-29 08:29:29 +00:00
obj.name = groupId.name;
2026-07-20 16:05:17 +00:00
arr[findIndexResult] = obj;
flag = true;
}
return flag;
},
DELETE_FRIEND_GROUP: function handleDeleteFriendGroup(groupId) {
groupId = groupId.groupId;
2026-07-23 10:11:24 +00:00
found = found.filter((id) => id.id !== groupId);
2026-07-20 16:05:17 +00:00
return found.length !== found.length;
},
2026-07-29 08:29:29 +00:00
REORDER_FRIEND_GROUPS: function handleReorderFriendGroups(arg0) {
2026-07-23 10:11:24 +00:00
let items = [];
2026-07-29 08:29:29 +00:00
const map = new Map(items.map((id) => {
2026-08-24 06:08:38 +00:00
items = [id.id, id];
2026-07-29 08:29:29 +00:00
return items;
}));
while (tmp !== undefined) {
let value = map.get(tmp2);
if (null != value) {
let tmp5 = value;
let arr = items.push(tmp4);
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let flag = items.length === items.length;
2026-07-20 16:05:17 +00:00
if (flag) {
flag = true;
}
return flag;
},
ADD_USERS_TO_GROUP: function handleAddUsersToGroup(arg0) {
2026-08-24 06:08:38 +00:00
({ groupId: closure_0, userIds } = arg0);
2026-07-23 10:11:24 +00:00
let set;
2026-08-24 06:08:38 +00:00
const findIndexResult = arr.findIndex((id) => id.id === closure_0);
2026-07-20 16:05:17 +00:00
if (-1 === findIndexResult) {
return false;
} else {
const _Set = Set;
2026-07-23 10:11:24 +00:00
set = new Set(tmp11.userIds);
2026-07-20 16:05:17 +00:00
const found = userIds.filter((arg0) => !set.has(arg0));
let flag = 0 !== found.length;
if (flag) {
const obj = {};
const merged = Object.assign(tmp11);
const items = [];
HermesBuiltin.arraySpread(found, HermesBuiltin.arraySpread(tmp11.userIds, 0));
2026-07-29 08:29:29 +00:00
obj.userIds = items;
2026-07-20 16:05:17 +00:00
arr[findIndexResult] = obj;
flag = true;
}
return flag;
}
},
REMOVE_USERS_FROM_GROUP: function handleRemoveUsersFromGroup(arg0) {
2026-08-24 06:08:38 +00:00
({ groupId: closure_0, userIds } = arg0);
2026-07-23 10:11:24 +00:00
let set;
2026-08-24 06:08:38 +00:00
const findIndexResult = arr.findIndex((id) => id.id === closure_0);
2026-07-20 16:05:17 +00:00
if (-1 === findIndexResult) {
return false;
} else {
const _Set = Set;
2026-07-23 10:11:24 +00:00
set = new Set(userIds);
2026-07-29 08:29:29 +00:00
userIds = tmp3.userIds;
2026-07-20 16:05:17 +00:00
const found = userIds.filter((arg0) => !set.has(arg0));
2026-07-29 08:29:29 +00:00
let flag = found.length !== tmp3.userIds.length;
2026-07-20 16:05:17 +00:00
if (flag) {
const obj = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(tmp3);
obj.userIds = found;
2026-07-20 16:05:17 +00:00
arr[findIndexResult] = obj;
flag = true;
}
return flag;
}
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/friend_groups/FriendGroupsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default friendGroupsStore;