Some quick fixes to get Mac to build.

This commit is contained in:
EliteMasterEric 2023-12-10 23:33:08 -05:00
parent cf41eb661d
commit e24c5877a9
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());
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<Array<String>> = 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}');
}
}
}

View file

@ -102,27 +102,12 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog
var result:Null<Array<String>> = 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()})');
}
}

View file

@ -103,7 +103,6 @@ class ChartEditorNotificationHandler
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 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.');