Add missing methods to ExpressionPickerStore
This commit is contained in:
parent
1e8f59f13d
commit
1fb5e8df99
|
@ -168,7 +168,7 @@ export default definePlugin({
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: '"BiteSizeProfileBody"',
|
find: ".hasAvatarForGuild(null==",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /currentUser:\i,guild:\i}\)(?<=user:(\i),bio:null==(\i)\?.+?)/,
|
match: /currentUser:\i,guild:\i}\)(?<=user:(\i),bio:null==(\i)\?.+?)/,
|
||||||
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2 })"
|
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2 })"
|
||||||
|
|
19
src/webpack/common/types/utils.d.ts
vendored
19
src/webpack/common/types/utils.d.ts
vendored
|
@ -223,9 +223,26 @@ export interface Constants {
|
||||||
FriendsSections: Record<string, string>;
|
FriendsSections: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ActiveView = LiteralUnion<"emoji" | "gif" | "sticker" | "soundboard", string>;
|
||||||
|
|
||||||
|
export interface ExpressionPickerStoreState extends Record<PropertyKey, any> {
|
||||||
|
activeView: ActiveView | null;
|
||||||
|
lastActiveView: ActiveView | null;
|
||||||
|
activeViewType: any | null;
|
||||||
|
searchQuery: string;
|
||||||
|
isSearchSuggestion: boolean,
|
||||||
|
pickerId: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ExpressionPickerStore {
|
export interface ExpressionPickerStore {
|
||||||
|
openExpressionPicker(activeView: ActiveView, activeViewType?: any): void;
|
||||||
closeExpressionPicker(activeViewType?: any): void;
|
closeExpressionPicker(activeViewType?: any): void;
|
||||||
openExpressionPicker(activeView: LiteralUnion<"emoji" | "gif" | "sticker", string>, activeViewType?: any): void;
|
toggleMultiExpressionPicker(activeViewType?: any): void;
|
||||||
|
toggleExpressionPicker(activeView: ActiveView, activeViewType?: any): void;
|
||||||
|
setExpressionPickerView(activeView: ActiveView): void;
|
||||||
|
setSearchQuery(searchQuery: string, isSearchSuggestion?: boolean): void;
|
||||||
|
useExpressionPickerStore(): ExpressionPickerStoreState;
|
||||||
|
useExpressionPickerStore<T>(selector: (state: ExpressionPickerStoreState) => T): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BrowserWindowFeatures {
|
export interface BrowserWindowFeatures {
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { canonicalizeMatch } from "@utils/patches";
|
|
||||||
import type { Channel } from "discord-types/general";
|
import type { Channel } from "discord-types/general";
|
||||||
|
|
||||||
// eslint-disable-next-line path-alias/no-relative
|
// eslint-disable-next-line path-alias/no-relative
|
||||||
|
@ -162,11 +161,14 @@ export const InviteActions = findByPropsLazy("resolveInvite");
|
||||||
|
|
||||||
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
|
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
|
||||||
|
|
||||||
const openExpressionPickerMatcher = canonicalizeMatch(/setState\({activeView:\i,activeViewType:/);
|
|
||||||
// TODO: type
|
|
||||||
export const ExpressionPickerStore: t.ExpressionPickerStore = mapMangledModuleLazy("expression-picker-last-active-view", {
|
export const ExpressionPickerStore: t.ExpressionPickerStore = mapMangledModuleLazy("expression-picker-last-active-view", {
|
||||||
|
openExpressionPicker: filters.byCode(/setState\({activeView:(?:(?!null)\i),activeViewType:/),
|
||||||
closeExpressionPicker: filters.byCode("setState({activeView:null"),
|
closeExpressionPicker: filters.byCode("setState({activeView:null"),
|
||||||
openExpressionPicker: m => typeof m === "function" && openExpressionPickerMatcher.test(m.toString()),
|
toggleMultiExpressionPicker: filters.byCode(".EMOJI,"),
|
||||||
|
toggleExpressionPicker: filters.byCode(/getState\(\)\.activeView===\i\?\i\(\):\i\(/),
|
||||||
|
setExpressionPickerView: filters.byCode(/setState\({activeView:\i,lastActiveView:/),
|
||||||
|
setSearchQuery: filters.byCode("searchQuery:"),
|
||||||
|
useExpressionPickerStore: filters.byCode("Object.is")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PopoutActions: t.PopoutActions = mapMangledModuleLazy('type:"POPOUT_WINDOW_OPEN"', {
|
export const PopoutActions: t.PopoutActions = mapMangledModuleLazy('type:"POPOUT_WINDOW_OPEN"', {
|
||||||
|
|
Loading…
Reference in a new issue