mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
add notification and system notification
This commit is contained in:
@@ -4,6 +4,7 @@ import { BsmImage } from "renderer/components/shared/bsm-image.component";
|
||||
import TitleBar from "renderer/components/title-bar/title-bar.component";
|
||||
import { IpcService } from "renderer/services/ipc.service";
|
||||
import { MapsDownloaderService } from "renderer/services/maps-downloader.service";
|
||||
import { NotificationService } from "renderer/services/notification.service";
|
||||
import { ProgressBarService } from "renderer/services/progress-bar.service";
|
||||
import { ThemeService } from "renderer/services/theme.service";
|
||||
import { BeatSaverService } from "renderer/services/thrird-partys/beat-saver.service";
|
||||
@@ -20,6 +21,7 @@ export default function OneClickDownloadMap() {
|
||||
const themeService = ThemeService.getInstance();
|
||||
const progressBar = ProgressBarService.getInstance();
|
||||
const windows = WindowManagerService.getInstance();
|
||||
const notification = NotificationService.getInstance();
|
||||
|
||||
const [mapInfo, setMapInfo] = useState<BsvMapDetail>(null);
|
||||
|
||||
@@ -38,6 +40,7 @@ export default function OneClickDownloadMap() {
|
||||
const promise = new Promise<void>(async (resolve, reject) => {
|
||||
|
||||
try{
|
||||
|
||||
const ipcRes = await ipc.send<{id: string, isHash: boolean}>("one-click-map-info");
|
||||
|
||||
if(!ipcRes.success){ return reject(ipcRes.error); }
|
||||
@@ -60,6 +63,16 @@ export default function OneClickDownloadMap() {
|
||||
|
||||
});
|
||||
|
||||
// TODO TRANSLATE
|
||||
|
||||
promise.catch(() => {
|
||||
notification.notifySystem({title: "Erreur", body: "Une erreur c'est produite lors de l'installation de la map"});
|
||||
})
|
||||
|
||||
promise.then(() => {
|
||||
notification.notifySystem({title: "OneClick", body: "Installation de la map terminé"});
|
||||
});
|
||||
|
||||
promise.finally(() =>{
|
||||
windows.close("oneclick-download-map.html");
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import { BsmImage } from "renderer/components/shared/bsm-image.component";
|
||||
import TitleBar from "renderer/components/title-bar/title-bar.component";
|
||||
import { IpcService } from "renderer/services/ipc.service";
|
||||
import { ModelDownloaderService } from "renderer/services/model-downloader.service";
|
||||
import { NotificationService } from "renderer/services/notification.service";
|
||||
import { ProgressBarService } from "renderer/services/progress-bar.service";
|
||||
import { ThemeService } from "renderer/services/theme.service";
|
||||
import { ModelSaberService } from "renderer/services/thrird-partys/model-saber.service";
|
||||
@@ -19,6 +20,7 @@ export default function OneClickDownloadModel() {
|
||||
const progress = ProgressBarService.getInstance();
|
||||
const modelDownloader = ModelDownloaderService.getInstance();
|
||||
const windows = WindowManagerService.getInstance();
|
||||
const notification = NotificationService.getInstance();
|
||||
|
||||
const [model, setModel] = useState<MSModel>(null);
|
||||
|
||||
@@ -48,6 +50,16 @@ export default function OneClickDownloadModel() {
|
||||
|
||||
});
|
||||
|
||||
// TODO TRANSLATE
|
||||
|
||||
promise.catch(() => {
|
||||
notification.notifySystem({title: "Erreur", body: "Une erreur c'est produite lors de l'installation du model"});
|
||||
})
|
||||
|
||||
promise.then(() => {
|
||||
notification.notifySystem({title: "OneClick", body: "Installation du model terminé"});
|
||||
});
|
||||
|
||||
promise.finally(() => windows.close("oneclick-download-model.html"));
|
||||
|
||||
return () => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { BsmImage } from "renderer/components/shared/bsm-image.component";
|
||||
import TitleBar from "renderer/components/title-bar/title-bar.component";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
import { IpcService } from "renderer/services/ipc.service"
|
||||
import { NotificationService } from "renderer/services/notification.service";
|
||||
import { PlaylistDownloaderService } from "renderer/services/playlist-downloader.service";
|
||||
import { ThemeService } from "renderer/services/theme.service";
|
||||
import { BeatSaverService } from "renderer/services/thrird-partys/beat-saver.service";
|
||||
@@ -21,6 +22,7 @@ export default function OneClickDownloadPlaylist() {
|
||||
const playlistDownloader = PlaylistDownloaderService.getInstance();
|
||||
const mapsContainer = useRef<HTMLDivElement>(null);
|
||||
const windows = WindowManagerService.getInstance();
|
||||
const notification = NotificationService.getInstance();
|
||||
|
||||
const [playlist, setPlaylist] = useState<BsvPlaylist>(null);
|
||||
const downloadedMap = useObservable(playlistDownloader.progress$.pipe(filter(download => !!download), map(download => [...(download.downloadedMaps ?? []), download?.current])), []);
|
||||
@@ -49,6 +51,16 @@ export default function OneClickDownloadPlaylist() {
|
||||
|
||||
});
|
||||
|
||||
// TODO TRANSLATE
|
||||
|
||||
promise.catch(() => {
|
||||
notification.notifySystem({title: "Erreur", body: "Une erreur c'est produite lors de l'installation de la playlist"});
|
||||
})
|
||||
|
||||
promise.then(() => {
|
||||
notification.notifySystem({title: "OneClick", body: "Installation de la playlist terminé"});
|
||||
});
|
||||
|
||||
promise.finally(() => {
|
||||
windows.close("oneclick-download-playlist.html");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user