+
+ {!!(mode & IndicatorType.FRIEND) && }
+ {!!(mode & IndicatorType.SERVER) && }
+
+ ;
+ },
+
+ handlePresenceUpdate() {
+ onlineFriends = 0;
+ const relations = RelationshipStore.getRelationships();
+ for (const id of Object.keys(relations)) {
+ const type = relations[id];
+ // FRIEND relationship type
+ if (type === 1 && PresenceStore.getStatus(id) !== "offline") {
+ onlineFriends += 1;
+ }
+ }
+ forceUpdateFriendCount?.();
+ },
+
+ handleGuildUpdate() {
+ guildCount = GuildStore.getGuildCount();
+ forceUpdateGuildCount?.();
+ },
+
+ start() {
+ this.handlePresenceUpdate();
+ this.handleGuildUpdate();
+ addServerListElement(ServerListRenderPosition.Above, this.renderIndicator);
+ FluxDispatcher.subscribe("PRESENCE_UPDATES", this.handlePresenceUpdate);
+ FluxDispatcher.subscribe("GUILD_CREATE", this.handleGuildUpdate);
+ FluxDispatcher.subscribe("GUILD_DELETE", this.handleGuildUpdate);
+ },
+
+ stop() {
+ removeServerListElement(ServerListRenderPosition.Above, this.renderIndicator);
+ FluxDispatcher.unsubscribe("PRESENCE_UPDATES", this.handlePresenceUpdate);
+ FluxDispatcher.unsubscribe("GUILD_CREATE", this.handleGuildUpdate);
+ FluxDispatcher.unsubscribe("GUILD_DELETE", this.handleGuildUpdate);
+ }
+});
diff --git a/src/webpack/common.tsx b/src/webpack/common.tsx
index bd6a69a4..773cc149 100644
--- a/src/webpack/common.tsx
+++ b/src/webpack/common.tsx
@@ -50,6 +50,7 @@ export let UserStore: Stores.UserStore;
export let SelectedChannelStore: Stores.SelectedChannelStore;
export let SelectedGuildStore: any;
export let ChannelStore: Stores.ChannelStore;
+export let RelationshipStore: Stores.RelationshipStore;
export const Forms = {} as {
FormTitle: Components.FormTitle;
@@ -156,6 +157,7 @@ waitFor("getSortedPrivateChannels", m => ChannelStore = m);
waitFor("getCurrentlySelectedChannelId", m => SelectedChannelStore = m);
waitFor("getLastSelectedGuildId", m => SelectedGuildStore = m);
waitFor("getGuildCount", m => GuildStore = m);
+waitFor("getRelationshipType", m => RelationshipStore = m);
waitFor(["Hovers", "Looks", "Sizes"], m => Button = m);
waitFor(filters.byCode("helpdeskArticleId"), m => Switch = m);