mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
fb0a73c4fe
5 changed files with 25 additions and 17 deletions
|
@ -20,6 +20,7 @@ import { Devs } from "@utils/constants";
|
|||
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
|
||||
import { runtimeHashMessageKey } from "@utils/intlHash";
|
||||
import { SYM_LAZY_CACHED, SYM_LAZY_GET } from "@utils/lazy";
|
||||
import { ModalAPI } from "@utils/modal";
|
||||
import { relaunch } from "@utils/native";
|
||||
import { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement } from "@utils/patches";
|
||||
import definePlugin, { PluginNative, StartAt } from "@utils/types";
|
||||
|
@ -144,6 +145,8 @@ function makeShortcuts() {
|
|||
me: { getter: () => Common.UserStore.getCurrentUser(), preload: false },
|
||||
meId: { getter: () => Common.UserStore.getCurrentUser().id, preload: false },
|
||||
messages: { getter: () => Common.MessageStore.getMessages(Common.SelectedChannelStore.getChannelId()), preload: false },
|
||||
openModal: { getter: () => ModalAPI.openModal },
|
||||
openModalLazy: { getter: () => ModalAPI.openModalLazy },
|
||||
|
||||
Stores: {
|
||||
getter: () => Object.fromEntries(
|
||||
|
|
|
@ -30,13 +30,13 @@ export default definePlugin({
|
|||
{
|
||||
find: ".removeMosaicItemHoverButton),",
|
||||
replacement: {
|
||||
match: /\.nonMediaMosaicItem\]:.{0,40}children:\[(?<=showDownload:(\i).+?isVisualMediaType:(\i).+?)/,
|
||||
replace: "$&$1&&$2&&$self.renderPiPButton(),"
|
||||
match: /\.nonMediaMosaicItem\]:.{0,40}children:\i.slice\(\i\)(?<=showDownload:(\i).+?isVisualMediaType:(\i).+?)/,
|
||||
replace: (m, showDownload, isVisualMediaType) => `${m}.unshift(${showDownload}&&${isVisualMediaType}&&$self.PictureInPictureButton())`
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
renderPiPButton: ErrorBoundary.wrap(() => {
|
||||
PictureInPictureButton: ErrorBoundary.wrap(() => {
|
||||
return (
|
||||
<Tooltip text="Toggle Picture in Picture">
|
||||
{tooltipProps => (
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import "./spotifyStyles.css";
|
||||
|
||||
import { Settings } from "@api/Settings";
|
||||
import { Flex } from "@components/Flex";
|
||||
import { ImageIcon, LinkIcon, OpenExternalIcon } from "@components/Icons";
|
||||
import { debounce } from "@shared/debounce";
|
||||
|
@ -130,7 +131,9 @@ function Controls() {
|
|||
>
|
||||
<Shuffle />
|
||||
</Button>
|
||||
<Button onClick={() => SpotifyStore.prev()}>
|
||||
<Button onClick={() => {
|
||||
Settings.plugins.SpotifyControls.previousButtonRestartsTrack && SpotifyStore.position > 3000 ? SpotifyStore.seek(0) : SpotifyStore.prev();
|
||||
}}>
|
||||
<SkipPrev />
|
||||
</Button>
|
||||
<Button onClick={() => SpotifyStore.setPlaying(!isPlaying)}>
|
||||
|
|
|
@ -44,6 +44,11 @@ export default definePlugin({
|
|||
type: OptionType.BOOLEAN,
|
||||
description: "Open Spotify URIs instead of Spotify URLs. Will only work if you have Spotify installed and might not work on all platforms",
|
||||
default: false
|
||||
},
|
||||
previousButtonRestartsTrack: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Restart currently playing track when pressing the previous button if playtime is >3s",
|
||||
default: true
|
||||
}
|
||||
},
|
||||
patches: [
|
||||
|
|
|
@ -141,35 +141,32 @@ export const ModalContent = LazyComponent(() => Modals.ModalContent);
|
|||
export const ModalFooter = LazyComponent(() => Modals.ModalFooter);
|
||||
export const ModalCloseButton = LazyComponent(() => Modals.ModalCloseButton);
|
||||
|
||||
const ModalAPI = findByPropsLazy("openModalLazy");
|
||||
export const ModalAPI = findByPropsLazy("openModalLazy");
|
||||
|
||||
/**
|
||||
* Wait for the render promise to resolve, then open a modal with it.
|
||||
* This is equivalent to render().then(openModal)
|
||||
* You should use the Modal components exported by this file
|
||||
*/
|
||||
export function openModalLazy(render: () => Promise<RenderFunction>, options?: ModalOptions & { contextKey?: string; }): Promise<string> {
|
||||
return ModalAPI.openModalLazy(render, options);
|
||||
}
|
||||
export const openModalLazy: (render: () => Promise<RenderFunction>, options?: ModalOptions & { contextKey?: string; }) => Promise<string>
|
||||
= proxyLazyWebpack(() => ModalAPI.openModalLazy);
|
||||
|
||||
/**
|
||||
* Open a Modal with the given render function.
|
||||
* You should use the Modal components exported by this file
|
||||
*/
|
||||
export function openModal(render: RenderFunction, options?: ModalOptions, contextKey?: string): string {
|
||||
return ModalAPI.openModal(render, options, contextKey);
|
||||
}
|
||||
export const openModal: (render: RenderFunction, options?: ModalOptions, contextKey?: string) => string
|
||||
= proxyLazyWebpack(() => ModalAPI.openModal);
|
||||
|
||||
/**
|
||||
* Close a modal by its key
|
||||
*/
|
||||
export function closeModal(modalKey: string, contextKey?: string): void {
|
||||
return ModalAPI.closeModal(modalKey, contextKey);
|
||||
}
|
||||
export const closeModal: (modalKey: string, contextKey?: string) => void
|
||||
= proxyLazyWebpack(() => ModalAPI.closeModal);
|
||||
|
||||
/**
|
||||
* Close all open modals
|
||||
*/
|
||||
export function closeAllModals(): void {
|
||||
return ModalAPI.closeAllModals();
|
||||
}
|
||||
export const closeAllModals: () => void
|
||||
= proxyLazyWebpack(() => ModalAPI.closeAllModals);
|
||||
|
||||
|
|
Loading…
Reference in a new issue