Updated Profile

Updated code to filter out subscriptions that have been removed from the
profile, and insert new ones into the list in the Update() fucntion.
This commit is contained in:
Mario Steele 2025-07-21 17:08:17 -05:00
parent 561ba4f34a
commit b08c22e77b

View file

@ -18,6 +18,19 @@ public class Profile
if (other.name != name) name = other.name;
if (other.bgColor != bgColor) bgColor = other.bgColor;
if (other.textColor != textColor) textColor = other.textColor;
if (other.subscriptions.Count != subscriptions.Count) subscriptions = other.subscriptions;
var remove = new List<Subscription>();
foreach (var sub in subscriptions)
{
if (other.subscriptions.Any(x => x.id == sub.id)) continue;
remove.Add(sub);
}
subscriptions.RemoveAll(x => remove.Contains(x));
remove.Clear();
foreach (var sub in other.subscriptions)
{
if (subscriptions.Any(x => x.id == sub.id)) continue;
remove.Add(sub);
}
subscriptions.AddRange(remove);
}
}