diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx index 597f3fb2c..4b7a950be 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx @@ -114,41 +114,17 @@ class ChartEditorUploadChartDialog extends ChartEditorBaseDialog var result:Null> = ChartEditorImportExportHandler.loadFromFNFCPath(state, path.toString()); if (result != null) { - #if !mac - NotificationManager.instance.addNotification( - { - title: 'Success', - body: result.length == 0 ? 'Loaded chart (${path.toString()})' : 'Loaded chart (${path.toString()})\n${result.join("\n")}', - type: result.length == 0 ? NotificationType.Success : NotificationType.Warning, - expiryMs: Constants.NOTIFICATION_DISMISS_TIME - }); - #end + state.success('Loaded Chart', result.length == 0 ? 'Loaded chart (${path.toString()})' : 'Loaded chart (${path.toString()})\n${result.join("\n")}'); this.hideDialog(DialogButton.APPLY); } else { - #if !mac - NotificationManager.instance.addNotification( - { - title: 'Failure', - body: 'Failed to load chart (${path.toString()})', - type: NotificationType.Error, - expiryMs: Constants.NOTIFICATION_DISMISS_TIME - }); - #end + state.failure('Failed to Load Chart', 'Failed to load chart (${path.toString()})'); } } catch (err) { - #if !mac - NotificationManager.instance.addNotification( - { - title: 'Failure', - body: 'Failed to load chart (${path.toString()}): ${err}', - type: NotificationType.Error, - expiryMs: Constants.NOTIFICATION_DISMISS_TIME - }); - #end + state.failure('Failed to Load Chart', 'Failed to load chart (${path.toString()}): ${err}'); } } @@ -166,15 +142,8 @@ class ChartEditorUploadChartDialog extends ChartEditorBaseDialog var result:Null> = ChartEditorImportExportHandler.loadFromFNFC(state, selectedFile.bytes); if (result != null) { - #if !mac - NotificationManager.instance.addNotification( - { - title: 'Success', - body: 'Loaded chart (${selectedFile.name})', - type: NotificationType.Success, - expiryMs: Constants.NOTIFICATION_DISMISS_TIME - }); - #end + state.success('Loaded Chart', + result.length == 0 ? 'Loaded chart (${selectedFile.name})' : 'Loaded chart (${selectedFile.name})\n${result.join("\n")}'); if (selectedFile.fullPath != null) state.currentWorkingFilePath = selectedFile.fullPath; this.hideDialog(DialogButton.APPLY); @@ -182,15 +151,7 @@ class ChartEditorUploadChartDialog extends ChartEditorBaseDialog } catch (err) { - #if !mac - NotificationManager.instance.addNotification( - { - title: 'Failure', - body: 'Failed to load chart (${selectedFile.name}): ${err}', - type: NotificationType.Error, - expiryMs: Constants.NOTIFICATION_DISMISS_TIME - }); - #end + state.failure('Failed to Load Chart', 'Failed to load chart (${selectedFile.name}): ${err}'); } } } diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx index 744bf4ac4..2a30c7d9e 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx @@ -102,27 +102,12 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog var result:Null> = ChartEditorImportExportHandler.loadFromFNFCPath(state, chartPath); if (result != null) { - #if !mac - NotificationManager.instance.addNotification( - { - title: 'Success', - body: result.length == 0 ? 'Loaded chart (${chartPath.toString()})' : 'Loaded chart (${chartPath.toString()})\n${result.join("\n")}', - type: result.length == 0 ? NotificationType.Success : NotificationType.Warning, - expiryMs: Constants.NOTIFICATION_DISMISS_TIME - }); - #end + state.success('Loaded Chart', + result.length == 0 ? 'Loaded chart (${chartPath.toString()})' : 'Loaded chart (${chartPath.toString()})\n${result.join("\n")}'); } else { - #if !mac - NotificationManager.instance.addNotification( - { - title: 'Failure', - body: 'Failed to load chart (${chartPath.toString()})', - type: NotificationType.Error, - expiryMs: Constants.NOTIFICATION_DISMISS_TIME - }); - #end + state.error('Failed to Load Chart', 'Failed to load chart (${chartPath.toString()})'); } } diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx index 5c340feb7..14d95347b 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx @@ -103,7 +103,6 @@ class ChartEditorNotificationHandler static function sendNotification(state:ChartEditorState, title:String, body:String, ?type:NotificationType, ?actions:Array):Notification { - #if !mac var actionNames:Array = actions == null ? [] : actions.map(action -> action.text); var notif = NotificationManager.instance.addNotification( @@ -138,7 +137,7 @@ class ChartEditorNotificationHandler } return notif; - #else + #if false // TODO: Implement notifications on Mac OS OR... make sure the null is handled properly on mac? return null; trace('WARNING: Notifications are not supported on Mac OS.');