removed fallback logic in NotificationService and some settings cleanup

This commit is contained in:
choco
2025-10-09 11:31:35 +02:00
parent 2b118df892
commit 0dfa667ed3
2 changed files with 36 additions and 107 deletions

View File

@@ -336,43 +336,24 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
if (!_dalamudUtilService.IsLoggedIn) return;
// Get both old and new notification locations
var oldLocation = 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))
// Get notification location based on type and system pref
var location = _configService.Current.UseLightlessNotifications
? msg.Type switch
{
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)
@@ -488,13 +469,4 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
_chatGui.Print(se.BuiltString);
}
private bool IsLightlessLocation(NotificationLocation location)
{
return location switch
{
NotificationLocation.LightlessUI => true,
NotificationLocation.ChatAndLightlessUI => true,
_ => false
};
}
}

View File

@@ -2623,24 +2623,25 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGuiHelpers.ScaledDummy(5);
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.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();
_uiShared.UnderlinedBigText("Notification Locations", UIColors.Get("LightlessBlue"));
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);
if (useLightlessNotifications)
{
// Enhanced notification locations (primary)
_uiShared.BigText("Enhanced Notification Locations");
ImGuiHelpers.ScaledDummy(3);
// Lightless notification locations
ImGui.Indent();
var lightlessLocations = GetLightlessNotificationLocations();
@@ -2674,53 +2675,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
}, _configService.Current.LightlessErrorNotification);
ImGuiHelpers.ScaledDummy(5);
// 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);
}
ImGui.Unindent();
}
else
{
// Only classic notifications when enhanced is disabled
// Classic notifications when lightless notifs is disabled
var classicLocations = GetClassicNotificationLocations();
_uiShared.BigText("Classic Notification Locations");
ImGuiHelpers.ScaledDummy(3);
ImGui.Indent();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Info Notifications:");
ImGui.SameLine();
@@ -2750,23 +2712,17 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ErrorNotification = location;
_configService.Save();
}, _configService.Current.ErrorNotification);
ImGui.Unindent();
}
ImGuiHelpers.ScaledDummy(3);
ImGui.Separator();
if (useLightlessNotifications)
{
UiSharedService.ColorTextWrapped("• Lightless Notifications: Modern animated notifications with interactive buttons", ImGuiColors.DalamudGrey);
UiSharedService.ColorTextWrapped("• Chat: Traditional chat messages with colored text", ImGuiColors.DalamudGrey);
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)
{
_uiShared.UnderlinedBigText("Test Notifications", UIColors.Get("LightlessBlue"));
ImGuiHelpers.ScaledDummy(5);
ImGui.Indent();
// 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));
}
_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();
ImGuiHelpers.ScaledDummy(5);
ImGui.Separator();
_uiShared.UnderlinedBigText("Basic Settings", UIColors.Get("LightlessBlue"));
ImGuiHelpers.ScaledDummy(5);