Fixed nav controller. Pass context from splash.

This commit is contained in:
kspearrin 2016-06-04 15:27:50 -04:00
parent 9ba5498d18
commit bff7c79ebe
4 changed files with 94 additions and 65 deletions

View file

@ -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<NSDictionary> action)

View file

@ -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 ()
{
}

View file

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="64" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="64">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Image-->
<!--Logins-->
<scene sceneID="7MM-of-jgj">
<objects>
<viewController id="ObA-dk-sSI" customClass="ActionViewController" sceneMemberID="viewController">
@ -14,108 +13,114 @@
<viewControllerLayoutGuide type="bottom" id="n38-gi-rB5"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="zMn-AG-sqS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" colorSpace="calibratedWhite" white="1" alpha="1"/>
<subviews>
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NOA-Dm-cuz" fixedFrame="YES">
<rect key="frame" x="0.0" y="20" width="320" height="44"/>
<items>
<navigationItem id="3HJ-uW-3hn" title="Title">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="1717" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="20" y="72" width="560" height="483"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="1722" rowHeight="44">
<rect key="frame" x="0.0" y="22" width="560" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="1723" tableViewCell="1722">
<rect key="frame" x="0.0" y="0.0" width="560" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</tableViewCell>
</prototypes>
</tableView>
</subviews>
<constraints>
<constraint id="1724" firstItem="1717" firstAttribute="top" secondItem="qkL-Od-lgU" secondAttribute="bottom" constant="8" symbolic="YES"/>
<constraint id="1725" firstItem="n38-gi-rB5" firstAttribute="top" secondItem="1717" secondAttribute="bottom" constant="8" symbolic="YES"/>
<constraint id="1726" firstItem="1717" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leading" constant="20" symbolic="YES"/>
<constraint id="1727" firstItem="zMn-AG-sqS" firstAttribute="trailing" secondItem="1717" secondAttribute="trailing" constant="20" symbolic="YES"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="yHH-Ee-etX" title="Sites">
<barButtonItem key="leftBarButtonItem" title="Done" style="done" id="WYi-yp-eM6">
<connections>
<action selector="DoneClicked:" destination="ObA-dk-sSI" id="eDL-XE-zg5"/>
</connections>
</barButtonItem>
<barButtonItem title="Cancel" id="1714" translatesAutoresizingMaskIntoConstraints="NO" key="rightBarButtonItem">
<connections>
<action selector="CancelClicked:" destination="ObA-dk-sSI" id="1729"/>
</connections>
</barButtonItem>
</navigationItem>
</items>
<variation key="heightClass=regular-widthClass=compact" fixedFrame="YES">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
</variation>
</navigationBar>
</subviews>
</view>
<connections/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-67" y="561"/>
<point key="canvasLocation" x="1133" y="555"/>
</scene>
<!--Splash View Controller-->
<scene sceneID="42">
<objects>
<viewController id="43" sceneMemberID="viewController" customClass="SplashViewController">
<viewController id="43" customClass="SplashViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="40"/>
<viewControllerLayoutGuide type="bottom" id="41"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="44">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="47" translatesAutoresizingMaskIntoConstraints="NO" image="logo.png" horizontalContentHuggingPriority="1" verticalContentHuggingPriority="1">
<rect key="frame" x="74" y="77" width="160" height="240"/>
<variation key="heightClass=regular-widthClass=compact">
<rect key="frame" x="66.5" y="291.5" width="282" height="44"/>
</variation>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="1713" translatesAutoresizingMaskIntoConstraints="NO" fixedFrame="YES" image="logo.png">
<rect key="frame" x="159" y="278" width="282" height="44"/>
</imageView>
</subviews>
<variation key="default">
<mask key="subviews">
<exclude reference="47"/>
</mask>
<mask key="constraints">
<exclude reference="1704"/>
<exclude reference="1705"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=compact">
<mask key="subviews">
<include reference="47"/>
</mask>
<mask key="constraints">
<include reference="1704"/>
<include reference="1705"/>
</mask>
</variation>
<constraints>
<constraint id="1704" firstItem="44" firstAttribute="centerY" secondItem="47" secondAttribute="centerY" constant="126" symbolic="YES">
<variation key="heightClass=regular-widthClass=compact" constant="20"/>
</constraint>
<constraint id="1705" firstItem="47" firstAttribute="centerX" secondItem="44" secondAttribute="centerX" symbolic="YES">
<variation key="heightClass=regular-widthClass=compact" constant="20"/>
</constraint>
</constraints>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<connections>
<segue id="1679" destination="ObA-dk-sSI" kind="show" identifier="seque"/>
<segue destination="oCZ-GQ-aOK" kind="show" identifier="seque" id="1679"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-561" y="555"/>
<point key="canvasLocation" x="-374" y="560"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="63">
<objects>
<navigationController definesPresentationContext="YES" id="64" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="67">
<rect key="frame" x="0.0" y="20" width="880" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<rect key="frame" x="0.0" y="20" width="320" height="44"/>
</navigationBar>
<connections>
<segue id="617" destination="43" kind="relationship" relationship="rootViewController"/>
<segue destination="43" kind="relationship" relationship="rootViewController" id="617"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="68" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1097" y="564"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="RvZ-Bc-vCe">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="oCZ-GQ-aOK" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="8A5-AR-QHS">
<rect key="frame" x="0.0" y="20" width="880" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="ObA-dk-sSI" kind="relationship" relationship="rootViewController" id="B4Z-aR-cOD"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Kkn-u3-rq1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="399" y="561"/>
</scene>
</scenes>
<resources>
<image name="logo.png" width="282" height="44"/>
<image name="Icon.png" width="57" height="57"/>
<image name="boxed-bg.png" width="400" height="400"/>
<image name="logo.png" width="282" height="44"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedScreenMetrics key="destination" type="retina47"/>
<simulatedOrientationMetrics key="orientation"/>
</simulatedMetricsContainer>
</document>

View file

@ -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();