Sync with rauenzi/BetterDiscordApp 70420bd
This commit is contained in:
parent
9140aa30e9
commit
121ca68647
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@ import WebpackModules from "./modules/webpackModules";
|
||||||
export const minimumDiscordVersion = "0.0.306";
|
export const minimumDiscordVersion = "0.0.306";
|
||||||
export const currentDiscordVersion = (window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion()) || "0.0.306";
|
export const currentDiscordVersion = (window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion()) || "0.0.306";
|
||||||
export const minSupportedVersion = "0.3.0";
|
export const minSupportedVersion = "0.3.0";
|
||||||
export const bbdVersion = "0.3.4";
|
export const bbdVersion = "0.3.5";
|
||||||
/*
|
/*
|
||||||
export const LCChanelog = {
|
export const LCChanelog = {
|
||||||
description: "Lightcord's changelog",
|
description: "Lightcord's changelog",
|
||||||
|
|
|
@ -442,25 +442,26 @@ export default class Utils {
|
||||||
* @returns {string} - the key used for this modal
|
* @returns {string} - the key used for this modal
|
||||||
*/
|
*/
|
||||||
static showConfirmationModal(title, content, options = {}) {
|
static showConfirmationModal(title, content, options = {}) {
|
||||||
const ModalStack = WebpackModules.findByProps("push", "update", "pop", "popWithKey");
|
const ModalActions = WebpackModules.findByProps("openModal", "updateModal");
|
||||||
const Markdown = WebpackModules.findByDisplayName("Markdown");
|
const Markdown = WebpackModules.findByDisplayName("Markdown");
|
||||||
const ConfirmationModal = WebpackModules.find(m => m.defaultProps && m.key && m.key() == "confirm-modal");
|
const ConfirmationModal = WebpackModules.findByDisplayName("ConfirmModal");
|
||||||
if (!ModalStack || !ConfirmationModal || !Markdown) return Utils.alert(title, content);
|
if (!ModalActions || !ConfirmationModal || !Markdown) return Utils.alert(title, content);
|
||||||
|
|
||||||
const emptyFunction = () => {};
|
const emptyFunction = () => {};
|
||||||
const {onConfirm = emptyFunction, onCancel = emptyFunction, confirmText = "Okay", cancelText = "Cancel", danger = false, key = undefined} = options;
|
const {onConfirm = emptyFunction, onCancel = emptyFunction, confirmText = "Okay", cancelText = "Cancel", danger = false, key = undefined} = options;
|
||||||
|
|
||||||
if (!Array.isArray(content)) content = [content];
|
if (!Array.isArray(content)) content = [content];
|
||||||
content = content.map(c => typeof(c) === "string" ? BDV2.React.createElement(Markdown, null, c) : c);
|
content = content.map(c => typeof(c) === "string" ? BDV2.React.createElement(Markdown, null, c) : c);
|
||||||
return ModalStack.push(ConfirmationModal, {
|
return ModalActions.openModal(props => {
|
||||||
header: title,
|
return BDV2.React.createElement(ConfirmationModal, Object.assign({
|
||||||
children: content,
|
header: title,
|
||||||
red: danger,
|
red: danger,
|
||||||
confirmText: confirmText,
|
confirmText: confirmText,
|
||||||
cancelText: cancelText,
|
cancelText: cancelText,
|
||||||
onConfirm: onConfirm,
|
onConfirm: onConfirm,
|
||||||
onCancel: onCancel
|
onCancel: onCancel
|
||||||
}, key);
|
}, props), content);
|
||||||
|
}, {modalKey: key});
|
||||||
}
|
}
|
||||||
|
|
||||||
static removeDa(className){
|
static removeDa(className){
|
||||||
|
|
Loading…
Reference in New Issue