From bff7c79ebedce3e2b8a9e0fff40e990bf8995822 Mon Sep 17 00:00:00 2001 From: kspearrin Date: Sat, 4 Jun 2016 15:27:50 -0400 Subject: [PATCH] Fixed nav controller. Pass context from splash. --- src/iOS.Extension/ActionViewController.cs | 10 +- .../ActionViewController.designer.cs | 4 + src/iOS.Extension/MainInterface.storyboard | 131 +++++++++--------- src/iOS.Extension/SplashViewController.cs | 14 ++ 4 files changed, 94 insertions(+), 65 deletions(-) diff --git a/src/iOS.Extension/ActionViewController.cs b/src/iOS.Extension/ActionViewController.cs index 8f1597b4c..8ca145636 100644 --- a/src/iOS.Extension/ActionViewController.cs +++ b/src/iOS.Extension/ActionViewController.cs @@ -44,6 +44,7 @@ namespace Bit.iOS.Extension { } + public NSExtensionContext Context { get; set; } public string ProviderType { get; set; } public Uri Url { get; set; } public string SiteTitle { get; set; } @@ -59,7 +60,7 @@ namespace Bit.iOS.Extension base.ViewDidLoad(); View.BackgroundColor = UIColor.FromPatternImage(new UIImage("boxed-bg.png")); - foreach(var item in ExtensionContext.InputItems) + foreach(var item in Context.InputItems) { var processed = false; foreach(var itemProvider in item.Attachments) @@ -83,6 +84,11 @@ namespace Bit.iOS.Extension } } + partial void CancelClicked (UIBarButtonItem sender) + { + Context.CompleteRequest(null, null); + } + partial void DoneClicked(NSObject sender) { NSDictionary itemData = null; @@ -123,7 +129,7 @@ namespace Bit.iOS.Extension var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } }; var returningItems = new NSExtensionItem[] { resultsItem }; - ExtensionContext.CompleteRequest(returningItems, null); + Context.CompleteRequest(returningItems, null); } private bool ProcessItemProvider(NSItemProvider itemProvider, string type, Action action) diff --git a/src/iOS.Extension/ActionViewController.designer.cs b/src/iOS.Extension/ActionViewController.designer.cs index 890115c59..7fc2e6450 100644 --- a/src/iOS.Extension/ActionViewController.designer.cs +++ b/src/iOS.Extension/ActionViewController.designer.cs @@ -17,6 +17,10 @@ namespace Bit.iOS.Extension [Action ("DoneClicked:")] partial void DoneClicked (Foundation.NSObject sender); + [Action ("CancelClicked:")] + [GeneratedCode ("iOS Designer", "1.0")] + partial void CancelClicked (UIBarButtonItem sender); + void ReleaseDesignerOutlets () { } diff --git a/src/iOS.Extension/MainInterface.storyboard b/src/iOS.Extension/MainInterface.storyboard index b808e165f..bb288336f 100644 --- a/src/iOS.Extension/MainInterface.storyboard +++ b/src/iOS.Extension/MainInterface.storyboard @@ -1,11 +1,10 @@ - + - - + @@ -14,108 +13,114 @@ - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + - + + - + - + - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + - - + + + + + + + + + + + + + + + + + + + + - - - - - \ No newline at end of file diff --git a/src/iOS.Extension/SplashViewController.cs b/src/iOS.Extension/SplashViewController.cs index 6a5fee23a..d7072f41e 100644 --- a/src/iOS.Extension/SplashViewController.cs +++ b/src/iOS.Extension/SplashViewController.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using System.Diagnostics; using Bit.App.Abstractions; using Bit.App.Repositories; using Bit.App.Services; @@ -52,6 +53,19 @@ namespace Bit.iOS.Extension PerformSegue("seque", this); } + public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) + { + var navController = segue.DestinationViewController as UINavigationController; + if(navController != null) + { + var actionController = navController.TopViewController as ActionViewController; + if(actionController != null) + { + actionController.Context = ExtensionContext; + } + } + } + private void SetIoc() { var container = new UnityContainer();