From e24c5877a99b20db45c45ceda45476ac853816bc Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 10 Dec 2023 23:33:08 -0500 Subject: [PATCH] Some quick fixes to get Mac to build. --- .../dialogs/ChartEditorUploadChartDialog.hx | 51 +++---------------- .../dialogs/ChartEditorWelcomeDialog.hx | 21 ++------ .../ChartEditorNotificationHandler.hx | 3 +- 3 files changed, 10 insertions(+), 65 deletions(-) diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx index 49d5593b0..ec6a850f9 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx @@ -113,41 +113,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}'); } } @@ -165,15 +141,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); @@ -181,15 +150,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.');