RelationshipStore: Type Updates
This commit is contained in:
parent
ea972836d3
commit
9a906c9cb6
7 changed files with 47 additions and 46 deletions
|
|
@ -1,38 +1,53 @@
|
|||
import { FluxStore } from "..";
|
||||
|
||||
export const enum RelationshipType {
|
||||
NONE = 0,
|
||||
FRIEND = 1,
|
||||
BLOCKED = 2,
|
||||
INCOMING_REQUEST = 3,
|
||||
OUTGOING_REQUEST = 4,
|
||||
IMPLICIT = 5,
|
||||
SUGGESTION = 6
|
||||
}
|
||||
|
||||
export class RelationshipStore extends FluxStore {
|
||||
getFriendIDs(): string[];
|
||||
getIgnoredIDs(): string[];
|
||||
getBlockedIDs(): string[];
|
||||
getBlockedOrIgnoredIDs(): string[];
|
||||
|
||||
getPendingCount(): number;
|
||||
getRelationshipCount(): number;
|
||||
|
||||
/** Related to friend nicknames. */
|
||||
getNickname(userId: string): string;
|
||||
|
||||
/** @returns Enum value from constants.RelationshipTypes */
|
||||
getRelationshipType(userId: string): number;
|
||||
isBlockedOrIgnored(userId: string): boolean;
|
||||
isBlockedOrIgnoredForMessage(userId: string): boolean;
|
||||
isBlocked(userId: string): boolean;
|
||||
isBlockedForMessage(userId: string): boolean;
|
||||
isFriend(userId: string): boolean;
|
||||
isIgnored(userId: string): boolean;
|
||||
isIgnoredForMessage(userId: string): boolean;
|
||||
isUnfilteredPendingIncoming(userId: string): boolean;
|
||||
isSpam(userId): boolean;
|
||||
getSince(userId: string): string;
|
||||
getSinces(): Record<number, string>;
|
||||
|
||||
getFriendCount(): number;
|
||||
getRelationshipCount(): number;
|
||||
getFriendIDs(): string[];
|
||||
getIgnoredIDs(): string[];
|
||||
|
||||
getMutableRelationships(): Map<string, number>;
|
||||
getNickname(userId: string): string;
|
||||
getOriginApplicationId(applicationId: string): string;
|
||||
getOutgoingCount(): number;
|
||||
getPendingCount(): number;
|
||||
getPendingIgnoredCount(): number;
|
||||
getSpamCount(): number;
|
||||
getRelationshipCount(): number;
|
||||
|
||||
getMutableRelationships(): Map<string, number>;
|
||||
/** @returns Enum value from constants.RelationshipTypes */
|
||||
getRelationshipType(userId: string): RelationshipType;
|
||||
getSince(userId: string): string;
|
||||
getSinces(): Record<number, string>;
|
||||
getSpamCount(): number;
|
||||
getVersion(): number;
|
||||
getPendingCount(): number;
|
||||
getRelationshipCount(): number;
|
||||
|
||||
isBlocked(userId: string): boolean;
|
||||
isBlockedForMessage(userId: string): boolean;
|
||||
|
||||
/**
|
||||
* @see {@link isBlocked}
|
||||
* @see {@link isIgnored}
|
||||
*/
|
||||
isBlockedOrIgnored(userId: string): boolean;
|
||||
isBlockedOrIgnoredForMessage(userId: string): boolean;
|
||||
|
||||
isFriend(userId: string): boolean;
|
||||
isIgnored(userId: string): boolean;
|
||||
isIgnoredForMessage(userId: string): boolean;
|
||||
isStranger(userId: string): boolean;
|
||||
isSpam(userId: string): boolean;
|
||||
isUnfilteredPendingIncoming(userId: string): boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin, { makeRange, OptionType } from "@utils/types";
|
||||
import { Channel, Message, User } from "@vencord/discord-types";
|
||||
import { Channel, Message, RelationshipType, User } from "@vencord/discord-types";
|
||||
import { MessageType } from "@vencord/discord-types/enums";
|
||||
import { findByPropsLazy, findStore } from "@webpack";
|
||||
import { Button, ChannelStore, GuildRoleStore, NavigationRouter, RelationshipStore, SelectedChannelStore, StreamerModeStore, UserStore } from "@webpack/common";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import { NotificationData, showNotification } from "./components/Notifications";
|
||||
import { RelationshipType, StreamingTreatment } from "./types";
|
||||
import { StreamingTreatment } from "./types";
|
||||
|
||||
let ignoredUsers: string[] = [];
|
||||
let notifyFor: string[] = [];
|
||||
|
|
|
|||
|
|
@ -16,13 +16,6 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export const enum RelationshipType {
|
||||
FRIEND = 1,
|
||||
BLOCKED = 2,
|
||||
INCOMING_REQUEST = 3,
|
||||
OUTGOING_REQUEST = 4,
|
||||
}
|
||||
|
||||
export const enum StreamingTreatment {
|
||||
NORMAL = 0,
|
||||
NO_CONTENT = 1,
|
||||
|
|
|
|||
|
|
@ -17,11 +17,12 @@
|
|||
*/
|
||||
|
||||
import { getUniqueUsername, openUserProfile } from "@utils/discord";
|
||||
import { RelationshipType } from "@vencord/discord-types";
|
||||
import { ChannelType } from "@vencord/discord-types/enums";
|
||||
import { UserUtils } from "@webpack/common";
|
||||
|
||||
import settings from "./settings";
|
||||
import { ChannelDelete, GuildDelete, RelationshipRemove, RelationshipType } from "./types";
|
||||
import { ChannelDelete, GuildDelete, RelationshipRemove } from "./types";
|
||||
import { deleteGroup, deleteGuild, getGroup, getGuild, GuildAvailabilityStore, notify } from "./utils";
|
||||
|
||||
let manuallyRemovedFriend: string | undefined;
|
||||
|
|
|
|||
|
|
@ -51,10 +51,3 @@ export interface SimpleGuild {
|
|||
name: string;
|
||||
iconURL?: string;
|
||||
}
|
||||
|
||||
export const enum RelationshipType {
|
||||
FRIEND = 1,
|
||||
BLOCKED = 2,
|
||||
INCOMING_REQUEST = 3,
|
||||
OUTGOING_REQUEST = 4,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ import * as DataStore from "@api/DataStore";
|
|||
import { popNotice, showNotice } from "@api/Notices";
|
||||
import { showNotification } from "@api/Notifications";
|
||||
import { getUniqueUsername, openUserProfile } from "@utils/discord";
|
||||
import { FluxStore } from "@vencord/discord-types";
|
||||
import { FluxStore, RelationshipType } from "@vencord/discord-types";
|
||||
import { ChannelType } from "@vencord/discord-types/enums";
|
||||
import { findStoreLazy } from "@webpack";
|
||||
import { ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
|
||||
|
||||
import settings from "./settings";
|
||||
import { RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types";
|
||||
import { SimpleGroupChannel, SimpleGuild } from "./types";
|
||||
|
||||
export const GuildAvailabilityStore = findStoreLazy("GuildAvailabilityStore") as FluxStore & {
|
||||
totalGuilds: number;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ export let SpellCheckStore: t.SpellCheckStore;
|
|||
export let UploadAttachmentStore: t.UploadAttachmentStore;
|
||||
export let OverridePremiumTypeStore: t.OverridePremiumTypeStore;
|
||||
|
||||
|
||||
/**
|
||||
* @see jsdoc of {@link t.useStateFromStores}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue