removed fallback logic in NotificationService and some settings cleanup
This commit is contained in:
@@ -336,43 +336,24 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
|
|
||||||
if (!_dalamudUtilService.IsLoggedIn) return;
|
if (!_dalamudUtilService.IsLoggedIn) return;
|
||||||
|
|
||||||
// Get both old and new notification locations
|
// Get notification location based on type and system pref
|
||||||
var oldLocation = msg.Type switch
|
var location = _configService.Current.UseLightlessNotifications
|
||||||
{
|
? msg.Type switch
|
||||||
NotificationType.Info => _configService.Current.InfoNotification,
|
|
||||||
NotificationType.Warning => _configService.Current.WarningNotification,
|
|
||||||
NotificationType.Error => _configService.Current.ErrorNotification,
|
|
||||||
_ => NotificationLocation.Nowhere
|
|
||||||
};
|
|
||||||
|
|
||||||
var newLocation = msg.Type switch
|
|
||||||
{
|
|
||||||
NotificationType.Info => _configService.Current.LightlessInfoNotification,
|
|
||||||
NotificationType.Warning => _configService.Current.LightlessWarningNotification,
|
|
||||||
NotificationType.Error => _configService.Current.LightlessErrorNotification,
|
|
||||||
_ => NotificationLocation.LightlessUI
|
|
||||||
};
|
|
||||||
|
|
||||||
// Show notifications based on system selection with backwards compatibility
|
|
||||||
if (!_configService.Current.UseLightlessNotifications)
|
|
||||||
{
|
|
||||||
// Only use old system when new system is disabled
|
|
||||||
ShowNotificationLocationBased(msg, oldLocation);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Use new system as primary
|
|
||||||
ShowNotificationLocationBased(msg, newLocation);
|
|
||||||
|
|
||||||
// Also use old system as fallback for backwards compatibility
|
|
||||||
// Only if it's different from the new location and not "Nowhere"
|
|
||||||
if (oldLocation != NotificationLocation.Nowhere &&
|
|
||||||
oldLocation != newLocation &&
|
|
||||||
!IsLightlessLocation(oldLocation))
|
|
||||||
{
|
{
|
||||||
ShowNotificationLocationBased(msg, oldLocation);
|
NotificationType.Info => _configService.Current.LightlessInfoNotification,
|
||||||
|
NotificationType.Warning => _configService.Current.LightlessWarningNotification,
|
||||||
|
NotificationType.Error => _configService.Current.LightlessErrorNotification,
|
||||||
|
_ => NotificationLocation.LightlessUI
|
||||||
}
|
}
|
||||||
}
|
: msg.Type switch
|
||||||
|
{
|
||||||
|
NotificationType.Info => _configService.Current.InfoNotification,
|
||||||
|
NotificationType.Warning => _configService.Current.WarningNotification,
|
||||||
|
NotificationType.Error => _configService.Current.ErrorNotification,
|
||||||
|
_ => NotificationLocation.Nowhere
|
||||||
|
};
|
||||||
|
|
||||||
|
ShowNotificationLocationBased(msg, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowNotificationLocationBased(NotificationMessage msg, NotificationLocation location)
|
private void ShowNotificationLocationBased(NotificationMessage msg, NotificationLocation location)
|
||||||
@@ -488,13 +469,4 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
_chatGui.Print(se.BuiltString);
|
_chatGui.Print(se.BuiltString);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsLightlessLocation(NotificationLocation location)
|
|
||||||
{
|
|
||||||
return location switch
|
|
||||||
{
|
|
||||||
NotificationLocation.LightlessUI => true,
|
|
||||||
NotificationLocation.ChatAndLightlessUI => true,
|
|
||||||
_ => false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -2623,24 +2623,25 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
bool useLightlessNotifications = _configService.Current.UseLightlessNotifications;
|
bool useLightlessNotifications = _configService.Current.UseLightlessNotifications;
|
||||||
if (ImGui.Checkbox("Use Enhanced Lightless Notifications", ref useLightlessNotifications))
|
if (ImGui.Checkbox("Use Lightless Notifications", ref useLightlessNotifications))
|
||||||
{
|
{
|
||||||
_configService.Current.UseLightlessNotifications = useLightlessNotifications;
|
_configService.Current.UseLightlessNotifications = useLightlessNotifications;
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
_uiShared.DrawHelpText("Enable the new enhanced notification system with interactive buttons, animations, and better visual design.");
|
_uiShared.DrawHelpText("Enable modern notifications with interactive buttons, animations, and progress tracking. Disable for classic Dalamud toast/chat notifications.");
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
_uiShared.UnderlinedBigText("Notification Locations", UIColors.Get("LightlessBlue"));
|
_uiShared.UnderlinedBigText("Notification Locations", UIColors.Get("LightlessBlue"));
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
UiSharedService.ColorTextWrapped("Configure where different types of notifications appear. Enhanced notifications provide modern interactive notifications with backwards compatibility support for classic toast/chat notifications.", ImGuiColors.DalamudGrey);
|
UiSharedService.ColorTextWrapped("Choose where each notification type appears.", ImGuiColors.DalamudGrey);
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
if (useLightlessNotifications)
|
if (useLightlessNotifications)
|
||||||
{
|
{
|
||||||
// Enhanced notification locations (primary)
|
// Lightless notification locations
|
||||||
_uiShared.BigText("Enhanced Notification Locations");
|
ImGui.Indent();
|
||||||
ImGuiHelpers.ScaledDummy(3);
|
|
||||||
|
|
||||||
var lightlessLocations = GetLightlessNotificationLocations();
|
var lightlessLocations = GetLightlessNotificationLocations();
|
||||||
|
|
||||||
@@ -2674,53 +2675,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
_configService.Save();
|
_configService.Save();
|
||||||
}, _configService.Current.LightlessErrorNotification);
|
}, _configService.Current.LightlessErrorNotification);
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
|
||||||
|
ImGui.Unindent();
|
||||||
// Classic notification locations (backwards compatibility)
|
|
||||||
if (ImGui.CollapsingHeader("Classic Notification Settings (Backwards Compatibility)"))
|
|
||||||
{
|
|
||||||
_uiShared.DrawHelpText("These settings provide backwards compatibility. They will also be used if they're different from the enhanced settings above and don't conflict.");
|
|
||||||
ImGuiHelpers.ScaledDummy(3);
|
|
||||||
|
|
||||||
var classicLocations = GetClassicNotificationLocations();
|
|
||||||
|
|
||||||
ImGui.AlignTextToFramePadding();
|
|
||||||
ImGui.TextUnformatted("Info Fallback:");
|
|
||||||
ImGui.SameLine();
|
|
||||||
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
|
|
||||||
_uiShared.DrawCombo("###classic_info", classicLocations, GetNotificationLocationLabel, (location) =>
|
|
||||||
{
|
|
||||||
_configService.Current.InfoNotification = location;
|
|
||||||
_configService.Save();
|
|
||||||
}, _configService.Current.InfoNotification);
|
|
||||||
|
|
||||||
ImGui.AlignTextToFramePadding();
|
|
||||||
ImGui.TextUnformatted("Warning Fallback:");
|
|
||||||
ImGui.SameLine();
|
|
||||||
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
|
|
||||||
_uiShared.DrawCombo("###classic_warning", classicLocations, GetNotificationLocationLabel, (location) =>
|
|
||||||
{
|
|
||||||
_configService.Current.WarningNotification = location;
|
|
||||||
_configService.Save();
|
|
||||||
}, _configService.Current.WarningNotification);
|
|
||||||
|
|
||||||
ImGui.AlignTextToFramePadding();
|
|
||||||
ImGui.TextUnformatted("Error Fallback:");
|
|
||||||
ImGui.SameLine();
|
|
||||||
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
|
|
||||||
_uiShared.DrawCombo("###classic_error", classicLocations, GetNotificationLocationLabel, (location) =>
|
|
||||||
{
|
|
||||||
_configService.Current.ErrorNotification = location;
|
|
||||||
_configService.Save();
|
|
||||||
}, _configService.Current.ErrorNotification);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Only classic notifications when enhanced is disabled
|
// Classic notifications when lightless notifs is disabled
|
||||||
var classicLocations = GetClassicNotificationLocations();
|
var classicLocations = GetClassicNotificationLocations();
|
||||||
_uiShared.BigText("Classic Notification Locations");
|
ImGui.Indent();
|
||||||
ImGuiHelpers.ScaledDummy(3);
|
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
ImGui.TextUnformatted("Info Notifications:");
|
ImGui.TextUnformatted("Info Notifications:");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
@@ -2750,23 +2712,17 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
_configService.Current.ErrorNotification = location;
|
_configService.Current.ErrorNotification = location;
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}, _configService.Current.ErrorNotification);
|
}, _configService.Current.ErrorNotification);
|
||||||
|
|
||||||
|
ImGui.Unindent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(3);
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
if (useLightlessNotifications)
|
if (useLightlessNotifications)
|
||||||
{
|
{
|
||||||
UiSharedService.ColorTextWrapped("• Lightless Notifications: Modern animated notifications with interactive buttons", ImGuiColors.DalamudGrey);
|
_uiShared.UnderlinedBigText("Test Notifications", UIColors.Get("LightlessBlue"));
|
||||||
UiSharedService.ColorTextWrapped("• Chat: Traditional chat messages with colored text", ImGuiColors.DalamudGrey);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
UiSharedService.ColorTextWrapped("• Combined options: Show in multiple locations simultaneously", ImGuiColors.DalamudGrey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UiSharedService.ColorTextWrapped("• Toast: Dalamud's built-in notification toasts", ImGuiColors.DalamudGrey);
|
|
||||||
UiSharedService.ColorTextWrapped("• Chat: Traditional chat messages with colored text", ImGuiColors.DalamudGrey);
|
|
||||||
UiSharedService.ColorTextWrapped("• Both: Show in both toast and chat", ImGuiColors.DalamudGrey);
|
|
||||||
}
|
|
||||||
ImGui.Separator();
|
|
||||||
if (useLightlessNotifications)
|
|
||||||
{
|
|
||||||
ImGui.Indent();
|
ImGui.Indent();
|
||||||
|
|
||||||
// Test notification buttons
|
// Test notification buttons
|
||||||
@@ -2784,10 +2740,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
Mediator.Publish(new NotificationMessage("Test Error", "This is a test error notification!", NotificationType.Error));
|
Mediator.Publish(new NotificationMessage("Test Error", "This is a test error notification!", NotificationType.Error));
|
||||||
}
|
}
|
||||||
_uiShared.DrawHelpText("Click to preview different notification types with your current settings.");
|
_uiShared.DrawHelpText("Preview how notifications will appear with your current settings.");
|
||||||
|
|
||||||
ImGui.Unindent();
|
ImGui.Unindent();
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
_uiShared.UnderlinedBigText("Basic Settings", UIColors.Get("LightlessBlue"));
|
_uiShared.UnderlinedBigText("Basic Settings", UIColors.Get("LightlessBlue"));
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|||||||
Reference in New Issue
Block a user