Skip to content

Commit

Permalink
- Fixing bug with some actions not getting properly upgraded as part …
Browse files Browse the repository at this point in the history
…of settings upgrade
  • Loading branch information
Matthew Olivo committed Sep 29, 2024
1 parent 7cff586 commit d904e85
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
7 changes: 7 additions & 0 deletions MixItUp.Base/Model/Actions/OverlayActionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ public OverlayActionModel() { }

protected override async Task PerformInternal(CommandParametersModel parameters)
{
#pragma warning disable CS0612 // Type or member is obsolete
if (this.OverlayItem != null)
{
SettingsV3Upgrader.UpdateActionsV7(ChannelSession.Settings, new List<ActionModelBase>() { this });
}
#pragma warning restore CS0612 // Type or member is obsolete

if (this.WidgetID != Guid.Empty)
{
OverlayWidgetV3Model widget = ChannelSession.Settings.OverlayWidgetsV3.FirstOrDefault(w => w.Item.ID.Equals(this.WidgetID));
Expand Down
12 changes: 10 additions & 2 deletions MixItUp.Base/Services/SettingsService.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using MixItUp.Base.Model.Actions;
using MixItUp.Base.Model.Commands;
using MixItUp.Base.Model.Commands.Games;
using MixItUp.Base.Model.Currency;
using MixItUp.Base.Model.Overlay;
using MixItUp.Base.Model.Overlay.Widgets;
using MixItUp.Base.Model.Settings;
using MixItUp.Base.Services.External;
using MixItUp.Base.Util;
using MixItUp.Base.ViewModel.Overlay;
using Newtonsoft.Json.Linq;
Expand All @@ -17,7 +17,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
using Twitch.Base.Services.NewAPI;

namespace MixItUp.Base.Services
Expand Down Expand Up @@ -432,6 +431,15 @@ public static async Task Version7Upgrade(int version, string filePath)
settings.Commands.ManualValueChanged(command.ID);
}
}
else if (kvp.Value is GameCommandModelBase)
{
GameCommandModelBase command = (GameCommandModelBase)kvp.Value;
foreach (CommandModelBase subCommand in command.GetInnerCommands())
{
UpdateActionsV7(settings, subCommand.Actions);
}
settings.Commands.ManualValueChanged(kvp.Key);
}

if (UpdateActionsV7(settings, kvp.Value.Actions))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime;
using System.Threading.Tasks;
using System.Windows.Input;

Expand Down Expand Up @@ -590,6 +591,13 @@ public OverlayActionEditorControlViewModel(OverlayActionModel action)
{
this.SelectedOverlayEndpoint = ServiceManager.Get<OverlayV3Service>().GetDefaultOverlayEndpoint();

#pragma warning disable CS0612 // Type or member is obsolete
if (action.OverlayItem != null)
{
SettingsV3Upgrader.UpdateActionsV7(ChannelSession.Settings, new List<ActionModelBase>() { action });
}
#pragma warning restore CS0612 // Type or member is obsolete

if (action.OverlayItemV3 != null)
{
OverlayEndpointV3Model overlayEndpoint = ServiceManager.Get<OverlayV3Service>().GetOverlayEndpoint(action.OverlayItemV3.OverlayEndpointID);
Expand Down

0 comments on commit d904e85

Please sign in to comment.