mirror of
https://github.com/bitwarden/mobile
synced 2025-12-27 21:53:57 +00:00
Added favorites tab with new selected icon capabilities in TabbedPage
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Controls;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
@@ -19,5 +20,45 @@ namespace Bit.iOS.Controls
|
||||
TabBar.BarTintColor = page.BarTintColor.ToUIColor();
|
||||
TabBar.BackgroundColor = page.BackgroundColor.ToUIColor();
|
||||
}
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
if(TabBar?.Items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tabs = Element as TabbedPage;
|
||||
if(tabs != null)
|
||||
{
|
||||
for(int i = 0; i < TabBar.Items.Length; i++)
|
||||
{
|
||||
UpdateItem(TabBar.Items[i], tabs.Children[i].Icon);
|
||||
}
|
||||
}
|
||||
|
||||
base.ViewWillAppear(animated);
|
||||
}
|
||||
|
||||
private void UpdateItem(UITabBarItem item, string icon)
|
||||
{
|
||||
if(item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
icon = string.Concat(icon, "_selected");
|
||||
if(item?.SelectedImage?.AccessibilityIdentifier == icon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
item.SelectedImage = UIImage.FromBundle(icon);
|
||||
item.SelectedImage.AccessibilityIdentifier = icon;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user