26 lines
756 B
TypeScript
26 lines
756 B
TypeScript
import { dialog, OpenDialogOptions } from 'electron';
|
|
import { injectable } from 'inversify';
|
|
import { inject } from '../../core/inject';
|
|
import type { DialogInterface } from './dialog-interface';
|
|
|
|
@injectable()
|
|
export class Dialog implements DialogInterface {
|
|
private readonly translator: I18nTranslatorInterface;
|
|
|
|
public constructor(@inject('i18n-translator') translator: I18nTranslatorInterface) {
|
|
this.translator = translator;
|
|
}
|
|
|
|
public selectFolder(options: OpenDialogOptions): ReturnType<typeof dialog.showOpenDialog> {
|
|
return dialog.showOpenDialog({
|
|
...{
|
|
title: this.translator.t('select a folder'),
|
|
},
|
|
...options,
|
|
...{
|
|
properties: ['openDirectory', 'showHiddenFiles'],
|
|
},
|
|
});
|
|
}
|
|
}
|