mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
fix: fixed an issue if "Always on top" is enabled, the dialog is displayed below the window
- fix #1379
This commit is contained in:
10
src/index.ts
10
src/index.ts
@ -554,7 +554,15 @@ app.on('ready', async () => {
|
|||||||
message: 'A new version is available',
|
message: 'A new version is available',
|
||||||
detail: `A new version is available and can be downloaded at ${downloadLink}`,
|
detail: `A new version is available and can be downloaded at ${downloadLink}`,
|
||||||
};
|
};
|
||||||
dialog.showMessageBox(dialogOptions).then((dialogOutput) => {
|
|
||||||
|
let dialogPromise: Promise<Electron.MessageBoxReturnValue>;
|
||||||
|
if (mainWindow) {
|
||||||
|
dialogPromise = dialog.showMessageBox(mainWindow, dialogOptions);
|
||||||
|
} else {
|
||||||
|
dialogPromise = dialog.showMessageBox(dialogOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPromise.then((dialogOutput) => {
|
||||||
switch (dialogOutput.response) {
|
switch (dialogOutput.response) {
|
||||||
// Download
|
// Download
|
||||||
case 1: {
|
case 1: {
|
||||||
|
|||||||
@ -68,8 +68,9 @@ const sendError = (error: Error, source?: string) => {
|
|||||||
const cause = error.cause ? `\n\n${String(error.cause)}` : '';
|
const cause = error.cause ? `\n\n${String(error.cause)}` : '';
|
||||||
const message = `${error.toString()}${songNameMessage}${cause}`;
|
const message = `${error.toString()}${songNameMessage}${cause}`;
|
||||||
|
|
||||||
console.error(message, error, error?.stack);
|
console.error(message);
|
||||||
dialog.showMessageBox({
|
console.trace(error);
|
||||||
|
dialog.showMessageBox(win, {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
title: 'Error in download!',
|
title: 'Error in download!',
|
||||||
@ -527,7 +528,7 @@ export async function downloadPlaylist(givenUrl?: string | URL) {
|
|||||||
mkdirSync(playlistFolder, { recursive: true });
|
mkdirSync(playlistFolder, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox(win, {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
title: 'Started Download',
|
title: 'Started Download',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ipcMain, dialog } from 'electron';
|
import { ipcMain, dialog, BrowserWindow } from 'electron';
|
||||||
|
|
||||||
export default () => {
|
export default (win: BrowserWindow) => {
|
||||||
ipcMain.handle('qualityChanger', async (_, qualityLabels: string[], currentIndex: number) => await dialog.showMessageBox({
|
ipcMain.handle('qualityChanger', async (_, qualityLabels: string[], currentIndex: number) => await dialog.showMessageBox(win, {
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: qualityLabels,
|
buttons: qualityLabels,
|
||||||
defaultId: currentIndex,
|
defaultId: currentIndex,
|
||||||
|
|||||||
Reference in New Issue
Block a user