Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add missing types for confirmation dialogs #264

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion lib/common/OC.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,48 @@ declare namespace Nextcloud.Common {
FILEPICKER_TYPE_COPY: number;
FILEPICKER_TYPE_COPY_MOVE: number;

readonly YES_NO_BUTTONS: number,
readonly OK_BUTTONS: number,

filepicker(
title: string,
callback: Function,
multiselect?: boolean,
mimeTypeFilter?: Array<string>,
modal?: boolean,
type?: number,
path?: string): void;
path?: string,
): void;

/**
* Displays confirmation dialog
* @param text content of dialog
* @param title dialog title
* @param callback which will be triggered when user presses OK (true or false would be passed to callback respectively)
* @param modal make the dialog modal
*/
confirm(
text: string,
title: string,
callback: (answer: boolean) => void,
modal?: boolean,
): Promise<void>;

/**
* Displays confirmation dialog
* @param text content of dialog
* @param title dialog title
* @param buttons text content of buttons
* @param callback which will be triggered when user presses OK (true or false would be passed to callback respectively)
* @param modal make the dialog modal
*/
confirmDestructive(
text: string,
title: string,
buttons: number | { type: number, confirm: string, cancel: string, confirmClasses: string },
callback: (answer: boolean) => void,
modal?: boolean,
): Promise<void>;
}

interface TranslationOptions {
Expand Down
11 changes: 4 additions & 7 deletions lib/v17/OC.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ declare namespace Nextcloud.v17 {
allowDirectoryChooser: boolean
}

interface Dialogs {
FILEPICKER_TYPE_CHOOSE: number;
FILEPICKER_TYPE_MOVE: number;
FILEPICKER_TYPE_COPY: number;
FILEPICKER_TYPE_COPY_MOVE: number;

interface Dialogs extends Omit<Nextcloud.v16.OC['dialogs'], 'filepicker'>{
// options parameter was added
filepicker(
title: string,
callback: Function,
Expand All @@ -18,7 +14,8 @@ declare namespace Nextcloud.v17 {
modal?: boolean,
type?: number,
path?: string,
options?: FilePickerOptions): void;
options?: FilePickerOptions,
): void;
}

interface OC extends Nextcloud.v16.OC {
Expand Down
Loading