Merge pull request #245 from FunkinCrew/bugfix/quick-mac-fixes

Some quick fixes to get Mac to build.
This commit is contained in:
Cameron Taylor 2023-12-11 11:31:50 -05:00 committed by GitHub
commit 8f85e09de8
3 changed files with 10 additions and 65 deletions

View file

@ -113,41 +113,17 @@ class ChartEditorUploadChartDialog extends ChartEditorBaseDialog
var result:Null<Array<String>> = ChartEditorImportExportHandler.loadFromFNFCPath(state, path.toString()); var result:Null<Array<String>> = ChartEditorImportExportHandler.loadFromFNFCPath(state, path.toString());
if (result != null) if (result != null)
{ {
#if !mac state.success('Loaded Chart', result.length == 0 ? 'Loaded chart (${path.toString()})' : 'Loaded chart (${path.toString()})\n${result.join("\n")}');
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
this.hideDialog(DialogButton.APPLY); this.hideDialog(DialogButton.APPLY);
} }
else else
{ {
#if !mac state.failure('Failed to Load Chart', 'Failed to load chart (${path.toString()})');
NotificationManager.instance.addNotification(
{
title: 'Failure',
body: 'Failed to load chart (${path.toString()})',
type: NotificationType.Error,
expiryMs: Constants.NOTIFICATION_DISMISS_TIME
});
#end
} }
} }
catch (err) catch (err)
{ {
#if !mac state.failure('Failed to Load Chart', 'Failed to load chart (${path.toString()}): ${err}');
NotificationManager.instance.addNotification(
{
title: 'Failure',
body: 'Failed to load chart (${path.toString()}): ${err}',
type: NotificationType.Error,
expiryMs: Constants.NOTIFICATION_DISMISS_TIME
});
#end
} }
} }
@ -165,15 +141,8 @@ class ChartEditorUploadChartDialog extends ChartEditorBaseDialog
var result:Null<Array<String>> = ChartEditorImportExportHandler.loadFromFNFC(state, selectedFile.bytes); var result:Null<Array<String>> = ChartEditorImportExportHandler.loadFromFNFC(state, selectedFile.bytes);
if (result != null) if (result != null)
{ {
#if !mac state.success('Loaded Chart',
NotificationManager.instance.addNotification( result.length == 0 ? 'Loaded chart (${selectedFile.name})' : 'Loaded chart (${selectedFile.name})\n${result.join("\n")}');
{
title: 'Success',
body: 'Loaded chart (${selectedFile.name})',
type: NotificationType.Success,
expiryMs: Constants.NOTIFICATION_DISMISS_TIME
});
#end
if (selectedFile.fullPath != null) state.currentWorkingFilePath = selectedFile.fullPath; if (selectedFile.fullPath != null) state.currentWorkingFilePath = selectedFile.fullPath;
this.hideDialog(DialogButton.APPLY); this.hideDialog(DialogButton.APPLY);
@ -181,15 +150,7 @@ class ChartEditorUploadChartDialog extends ChartEditorBaseDialog
} }
catch (err) catch (err)
{ {
#if !mac state.failure('Failed to Load Chart', 'Failed to load chart (${selectedFile.name}): ${err}');
NotificationManager.instance.addNotification(
{
title: 'Failure',
body: 'Failed to load chart (${selectedFile.name}): ${err}',
type: NotificationType.Error,
expiryMs: Constants.NOTIFICATION_DISMISS_TIME
});
#end
} }
} }
} }

View file

@ -102,27 +102,12 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog
var result:Null<Array<String>> = ChartEditorImportExportHandler.loadFromFNFCPath(state, chartPath); var result:Null<Array<String>> = ChartEditorImportExportHandler.loadFromFNFCPath(state, chartPath);
if (result != null) if (result != null)
{ {
#if !mac state.success('Loaded Chart',
NotificationManager.instance.addNotification( result.length == 0 ? 'Loaded chart (${chartPath.toString()})' : 'Loaded chart (${chartPath.toString()})\n${result.join("\n")}');
{
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
} }
else else
{ {
#if !mac state.error('Failed to Load Chart', 'Failed to load chart (${chartPath.toString()})');
NotificationManager.instance.addNotification(
{
title: 'Failure',
body: 'Failed to load chart (${chartPath.toString()})',
type: NotificationType.Error,
expiryMs: Constants.NOTIFICATION_DISMISS_TIME
});
#end
} }
} }

View file

@ -103,7 +103,6 @@ class ChartEditorNotificationHandler
static function sendNotification(state:ChartEditorState, title:String, body:String, ?type:NotificationType, ?actions:Array<NotificationAction>):Notification static function sendNotification(state:ChartEditorState, title:String, body:String, ?type:NotificationType, ?actions:Array<NotificationAction>):Notification
{ {
#if !mac
var actionNames:Array<String> = actions == null ? [] : actions.map(action -> action.text); var actionNames:Array<String> = actions == null ? [] : actions.map(action -> action.text);
var notif = NotificationManager.instance.addNotification( var notif = NotificationManager.instance.addNotification(
@ -138,7 +137,7 @@ class ChartEditorNotificationHandler
} }
return notif; return notif;
#else #if false
// TODO: Implement notifications on Mac OS OR... make sure the null is handled properly on mac? // TODO: Implement notifications on Mac OS OR... make sure the null is handled properly on mac?
return null; return null;
trace('WARNING: Notifications are not supported on Mac OS.'); trace('WARNING: Notifications are not supported on Mac OS.');