From 135f3233722a3ce91b0d8d09846669497d1b72d5 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 7 Jul 2016 20:53:01 -0400 Subject: [PATCH] revert back to default ios bar color. Added new Add Site view controller for extension (WIP) --- src/App/Controls/ExtendedTabbedPage.cs | 9 +- src/App/Pages/MainPage.cs | 3 +- src/iOS.Extension/ActionViewController.cs | 18 ++ .../ActionViewController.designer.cs | 4 + src/iOS.Extension/AddSiteViewController.cs | 50 +++++ .../AddSiteViewController.designer.cs | 61 ++++++ src/iOS.Extension/LoadingViewController.cs | 2 +- src/iOS.Extension/MainInterface.storyboard | 184 +++++++++++++++++- src/iOS.Extension/iOS.Extension.csproj | 4 + .../Controls/ExtendedTabbedPageRenderer.cs | 10 +- 10 files changed, 328 insertions(+), 17 deletions(-) create mode 100644 src/iOS.Extension/AddSiteViewController.cs create mode 100644 src/iOS.Extension/AddSiteViewController.designer.cs diff --git a/src/App/Controls/ExtendedTabbedPage.cs b/src/App/Controls/ExtendedTabbedPage.cs index 629a299ff..f5769875e 100644 --- a/src/App/Controls/ExtendedTabbedPage.cs +++ b/src/App/Controls/ExtendedTabbedPage.cs @@ -13,19 +13,12 @@ namespace Bit.App.Controls public static readonly BindableProperty TintColorProperty = BindableProperty.Create(nameof(TintColor), typeof(Color), typeof(ExtendedTabbedPage), Color.White); - public static readonly BindableProperty BarTintColorProperty = - BindableProperty.Create(nameof(BarTintColor), typeof(Color), typeof(ExtendedTabbedPage), Color.White); - public Color TintColor { get { return (Color)GetValue(TintColorProperty); } set { SetValue(TintColorProperty, value); } } - public Color BarTintColor - { - get { return (Color)GetValue(BarTintColorProperty); } - set { SetValue(BarTintColorProperty, value); } - } + public bool NoBorder { get; set; } } } diff --git a/src/App/Pages/MainPage.cs b/src/App/Pages/MainPage.cs index 4761463b2..8c22bd80f 100644 --- a/src/App/Pages/MainPage.cs +++ b/src/App/Pages/MainPage.cs @@ -9,8 +9,7 @@ namespace Bit.App.Pages { public MainPage() { - BarTintColor = Color.FromHex("222d32"); - TintColor = Color.FromHex("ffffff"); + TintColor = Color.FromHex("3c8dbc"); var settingsNavigation = new ExtendedNavigationPage(new SettingsPage()); var favoritesNavigation = new ExtendedNavigationPage(new VaultListSitesPage(true)); diff --git a/src/iOS.Extension/ActionViewController.cs b/src/iOS.Extension/ActionViewController.cs index f1d008983..eb42b9b36 100644 --- a/src/iOS.Extension/ActionViewController.cs +++ b/src/iOS.Extension/ActionViewController.cs @@ -63,6 +63,24 @@ namespace Bit.iOS.Extension Context.ExtContext.CompleteRequest(returningItems, null); } + partial void UIBarButtonItem2293_Activated(UIBarButtonItem sender) + { + PerformSegue("addSiteSegue", this); + } + + public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) + { + var navController = segue.DestinationViewController as UINavigationController; + if(navController != null) + { + var addSiteController = navController.TopViewController as AddSiteViewController; + if(addSiteController != null) + { + addSiteController.Context = Context; + } + } + } + public class TableSource : UITableViewSource { private const string CellIdentifier = "TableCell"; diff --git a/src/iOS.Extension/ActionViewController.designer.cs b/src/iOS.Extension/ActionViewController.designer.cs index 62193b091..3f53f1aa4 100644 --- a/src/iOS.Extension/ActionViewController.designer.cs +++ b/src/iOS.Extension/ActionViewController.designer.cs @@ -25,6 +25,10 @@ namespace Bit.iOS.Extension [GeneratedCode ("iOS Designer", "1.0")] partial void CancelClicked (UIBarButtonItem sender); + [Action ("UIBarButtonItem2293_Activated:")] + [GeneratedCode ("iOS Designer", "1.0")] + partial void UIBarButtonItem2293_Activated (UIBarButtonItem sender); + void ReleaseDesignerOutlets () { if (tableView != null) { diff --git a/src/iOS.Extension/AddSiteViewController.cs b/src/iOS.Extension/AddSiteViewController.cs new file mode 100644 index 000000000..6739377cb --- /dev/null +++ b/src/iOS.Extension/AddSiteViewController.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Bit.App.Abstractions; +using Bit.App.Models; +using Bit.iOS.Core; +using Bit.iOS.Extension.Models; +using Foundation; +using MobileCoreServices; +using Newtonsoft.Json; +using UIKit; +using XLabs.Ioc; + +namespace Bit.iOS.Extension +{ + public partial class AddSiteViewController : UITableViewController + { + public AddSiteViewController(IntPtr handle) : base(handle) + { } + + public Context Context { get; set; } + + public override void ViewWillAppear(bool animated) + { + UINavigationBar.Appearance.ShadowImage = new UIImage(); + UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); + + base.ViewWillAppear(animated); + } + + public override void ViewDidLoad() + { + tableView.RowHeight = UITableView.AutomaticDimension; + tableView.EstimatedRowHeight = 44; + + base.ViewDidLoad(); + } + + partial void UIBarButtonItem2289_Activated(UIBarButtonItem sender) + { + DismissViewController(true, null); + } + + partial void UIBarButtonItem2290_Activated(UIBarButtonItem sender) + { + DismissViewController(true, null); + } + } +} diff --git a/src/iOS.Extension/AddSiteViewController.designer.cs b/src/iOS.Extension/AddSiteViewController.designer.cs new file mode 100644 index 000000000..59425678e --- /dev/null +++ b/src/iOS.Extension/AddSiteViewController.designer.cs @@ -0,0 +1,61 @@ +// WARNING +// +// This file has been generated automatically by Xamarin Studio from the outlets and +// actions declared in your storyboard file. +// Manual changes to this file will not be maintained. +// +using Foundation; +using System; +using System.CodeDom.Compiler; +using UIKit; + +namespace Bit.iOS.Extension +{ + [Register ("AddSiteViewController")] + partial class AddSiteViewController + { + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UITableViewCell nameCell { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UITextField nameField { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UILabel nameLabel { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UITableView tableView { get; set; } + + [Action ("UIBarButtonItem2289_Activated:")] + [GeneratedCode ("iOS Designer", "1.0")] + partial void UIBarButtonItem2289_Activated (UIBarButtonItem sender); + + [Action ("UIBarButtonItem2290_Activated:")] + [GeneratedCode ("iOS Designer", "1.0")] + partial void UIBarButtonItem2290_Activated (UIBarButtonItem sender); + + void ReleaseDesignerOutlets () + { + if (nameCell != null) { + nameCell.Dispose (); + nameCell = null; + } + if (nameField != null) { + nameField.Dispose (); + nameField = null; + } + if (nameLabel != null) { + nameLabel.Dispose (); + nameLabel = null; + } + if (tableView != null) { + tableView.Dispose (); + tableView = null; + } + } + } +} diff --git a/src/iOS.Extension/LoadingViewController.cs b/src/iOS.Extension/LoadingViewController.cs index 66ab250f8..c43fae328 100644 --- a/src/iOS.Extension/LoadingViewController.cs +++ b/src/iOS.Extension/LoadingViewController.cs @@ -65,7 +65,7 @@ namespace Bit.iOS.Extension public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); - PerformSegue("seque", this); + PerformSegue("siteListSegue", this); } public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) diff --git a/src/iOS.Extension/MainInterface.storyboard b/src/iOS.Extension/MainInterface.storyboard index 4bb797dd8..62143266f 100644 --- a/src/iOS.Extension/MainInterface.storyboard +++ b/src/iOS.Extension/MainInterface.storyboard @@ -81,14 +81,26 @@ + + + + + + + + + + + + - + @@ -113,7 +125,7 @@ - + @@ -158,6 +170,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/iOS.Extension/iOS.Extension.csproj b/src/iOS.Extension/iOS.Extension.csproj index ddec7f342..ec4016ba8 100644 --- a/src/iOS.Extension/iOS.Extension.csproj +++ b/src/iOS.Extension/iOS.Extension.csproj @@ -95,6 +95,10 @@ iPhone Distribution + + + AddSiteViewController.cs + ActionViewController.cs diff --git a/src/iOS/Controls/ExtendedTabbedPageRenderer.cs b/src/iOS/Controls/ExtendedTabbedPageRenderer.cs index 572af79e3..351cb1b55 100644 --- a/src/iOS/Controls/ExtendedTabbedPageRenderer.cs +++ b/src/iOS/Controls/ExtendedTabbedPageRenderer.cs @@ -18,12 +18,14 @@ namespace Bit.iOS.Controls var page = (ExtendedTabbedPage)Element; TabBar.TintColor = page.TintColor.ToUIColor(); - TabBar.BarTintColor = page.BarTintColor.ToUIColor(); TabBar.BackgroundColor = page.BackgroundColor.ToUIColor(); - // remove top border - // ref: http://stackoverflow.com/questions/14371343/ios-uitabbar-remove-top-shadow-gradient-line - TabBar.SetValueForKeyPath(FromObject(true), new NSString("_hidesShadow")); + if(page.NoBorder) + { + // remove top border + // ref: http://stackoverflow.com/questions/14371343/ios-uitabbar-remove-top-shadow-gradient-line + TabBar.SetValueForKeyPath(FromObject(true), new NSString("_hidesShadow")); + } } public override void ViewWillAppear(bool animated)