From: Yurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics Date: Wed, 10 Jan 2024 11:37:33 +0000 (+0100) Subject: update customization logic X-Git-Tag: accepted/tizen/unified/20240222.163404~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb92f1807e8ed7fea30e7afbf4a4bc3a8cbfb5f7;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsettings.git update customization logic --- diff --git a/SettingView/SettingView.cs b/SettingView/SettingView.cs index e5e1959..2eca6dc 100644 --- a/SettingView/SettingView.cs +++ b/SettingView/SettingView.cs @@ -184,15 +184,30 @@ namespace SettingView var customizationMainMenusStr = customizationMainMenus.Where(i => i.IsVisible).Select(x => new string(x.Path)); var cacheMainMenuStr = MainMenuInfo.CacheMenu.Select(x => new string(x.Path)); + var notCachedGadgets = customizationMainMenusStr.Except(cacheMainMenuStr); + var removedGedgets = cacheMainMenuStr.Except(customizationMainMenusStr); if (!customizationMainMenusStr.SequenceEqual(cacheMainMenuStr)) { - Logger.Verbose($"customization has changed. Reload main view."); - if (page != null) + var newMainMenus = new List(); + + if (notCachedGadgets.Count() > 0) + { + foreach (var gadgetInfo in customizationMainMenus.Where(a => notCachedGadgets.Any(e => e.Equals(a.Path)))) + { + if (MainMenuInfo.Create(gadgetInfo) is MainMenuInfo menu) + { + newMainMenus.Add(gadgetInfo); + } + } + } + + if (removedGedgets.Count() > 0 || newMainMenus.Count() > 0) { + Logger.Verbose($"customization has changed. Reload main view."); await Post(() => { - CreateContent(); + CreateContent(true); return true; }); }