mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 08:12:26 +03:00
Fixed nav controller. Pass context from splash.
This commit is contained in:
parent
9ba5498d18
commit
bff7c79ebe
4 changed files with 94 additions and 65 deletions
|
@ -44,6 +44,7 @@ namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NSExtensionContext Context { get; set; }
|
||||||
public string ProviderType { get; set; }
|
public string ProviderType { get; set; }
|
||||||
public Uri Url { get; set; }
|
public Uri Url { get; set; }
|
||||||
public string SiteTitle { get; set; }
|
public string SiteTitle { get; set; }
|
||||||
|
@ -59,7 +60,7 @@ namespace Bit.iOS.Extension
|
||||||
base.ViewDidLoad();
|
base.ViewDidLoad();
|
||||||
View.BackgroundColor = UIColor.FromPatternImage(new UIImage("boxed-bg.png"));
|
View.BackgroundColor = UIColor.FromPatternImage(new UIImage("boxed-bg.png"));
|
||||||
|
|
||||||
foreach(var item in ExtensionContext.InputItems)
|
foreach(var item in Context.InputItems)
|
||||||
{
|
{
|
||||||
var processed = false;
|
var processed = false;
|
||||||
foreach(var itemProvider in item.Attachments)
|
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)
|
partial void DoneClicked(NSObject sender)
|
||||||
{
|
{
|
||||||
NSDictionary itemData = null;
|
NSDictionary itemData = null;
|
||||||
|
@ -123,7 +129,7 @@ namespace Bit.iOS.Extension
|
||||||
var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } };
|
var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } };
|
||||||
var returningItems = new NSExtensionItem[] { resultsItem };
|
var returningItems = new NSExtensionItem[] { resultsItem };
|
||||||
|
|
||||||
ExtensionContext.CompleteRequest(returningItems, null);
|
Context.CompleteRequest(returningItems, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ProcessItemProvider(NSItemProvider itemProvider, string type, Action<NSDictionary> action)
|
private bool ProcessItemProvider(NSItemProvider itemProvider, string type, Action<NSDictionary> action)
|
||||||
|
|
|
@ -17,6 +17,10 @@ namespace Bit.iOS.Extension
|
||||||
[Action ("DoneClicked:")]
|
[Action ("DoneClicked:")]
|
||||||
partial void DoneClicked (Foundation.NSObject sender);
|
partial void DoneClicked (Foundation.NSObject sender);
|
||||||
|
|
||||||
|
[Action ("CancelClicked:")]
|
||||||
|
[GeneratedCode ("iOS Designer", "1.0")]
|
||||||
|
partial void CancelClicked (UIBarButtonItem sender);
|
||||||
|
|
||||||
void ReleaseDesignerOutlets ()
|
void ReleaseDesignerOutlets ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?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>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--Image-->
|
<!--Logins-->
|
||||||
<scene sceneID="7MM-of-jgj">
|
<scene sceneID="7MM-of-jgj">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="ObA-dk-sSI" customClass="ActionViewController" sceneMemberID="viewController">
|
<viewController id="ObA-dk-sSI" customClass="ActionViewController" sceneMemberID="viewController">
|
||||||
|
@ -14,108 +13,114 @@
|
||||||
<viewControllerLayoutGuide type="bottom" id="n38-gi-rB5"/>
|
<viewControllerLayoutGuide type="bottom" id="n38-gi-rB5"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="zMn-AG-sqS">
|
<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"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" colorSpace="calibratedWhite" white="1" alpha="1"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NOA-Dm-cuz" fixedFrame="YES">
|
<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="0.0" y="20" width="320" height="44"/>
|
<rect key="frame" x="20" y="72" width="560" height="483"/>
|
||||||
<items>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<navigationItem id="3HJ-uW-3hn" title="Title">
|
<prototypes>
|
||||||
<barButtonItem key="leftBarButtonItem" title="Done" style="done" id="WYi-yp-eM6">
|
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="1722" rowHeight="44">
|
||||||
<connections>
|
<rect key="frame" x="0.0" y="22" width="560" height="44"/>
|
||||||
<action selector="DoneClicked:" destination="ObA-dk-sSI" id="eDL-XE-zg5"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
</connections>
|
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="1723" tableViewCell="1722">
|
||||||
</barButtonItem>
|
<rect key="frame" x="0.0" y="0.0" width="560" height="43.5"/>
|
||||||
</navigationItem>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
</items>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<variation key="heightClass=regular-widthClass=compact" fixedFrame="YES">
|
</view>
|
||||||
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
|
</tableViewCell>
|
||||||
</variation>
|
</prototypes>
|
||||||
</navigationBar>
|
</tableView>
|
||||||
</subviews>
|
</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>
|
</view>
|
||||||
<connections/>
|
<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>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="-67" y="561"/>
|
<point key="canvasLocation" x="1133" y="555"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--Splash View Controller-->
|
||||||
<scene sceneID="42">
|
<scene sceneID="42">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="43" sceneMemberID="viewController" customClass="SplashViewController">
|
<viewController id="43" customClass="SplashViewController" sceneMemberID="viewController">
|
||||||
<layoutGuides>
|
<layoutGuides>
|
||||||
<viewControllerLayoutGuide type="top" id="40"/>
|
<viewControllerLayoutGuide type="top" id="40"/>
|
||||||
<viewControllerLayoutGuide type="bottom" id="41"/>
|
<viewControllerLayoutGuide type="bottom" id="41"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="44">
|
<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"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="47" translatesAutoresizingMaskIntoConstraints="NO" image="logo.png" horizontalContentHuggingPriority="1" verticalContentHuggingPriority="1">
|
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="1713" translatesAutoresizingMaskIntoConstraints="NO" fixedFrame="YES" image="logo.png">
|
||||||
<rect key="frame" x="74" y="77" width="160" height="240"/>
|
<rect key="frame" x="159" y="278" width="282" height="44"/>
|
||||||
<variation key="heightClass=regular-widthClass=compact">
|
|
||||||
<rect key="frame" x="66.5" y="291.5" width="282" height="44"/>
|
|
||||||
</variation>
|
|
||||||
</imageView>
|
</imageView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<variation key="default">
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<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>
|
|
||||||
</view>
|
</view>
|
||||||
<connections>
|
<connections>
|
||||||
<segue id="1679" destination="ObA-dk-sSI" kind="show" identifier="seque"/>
|
<segue destination="oCZ-GQ-aOK" kind="show" identifier="seque" id="1679"/>
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="-561" y="555"/>
|
<point key="canvasLocation" x="-374" y="560"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--Navigation Controller-->
|
||||||
<scene sceneID="63">
|
<scene sceneID="63">
|
||||||
<objects>
|
<objects>
|
||||||
<navigationController definesPresentationContext="YES" id="64" sceneMemberID="viewController">
|
<navigationController definesPresentationContext="YES" id="64" sceneMemberID="viewController">
|
||||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="67">
|
<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"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||||
<rect key="frame" x="0.0" y="20" width="320" height="44"/>
|
|
||||||
</navigationBar>
|
</navigationBar>
|
||||||
<connections>
|
<connections>
|
||||||
<segue id="617" destination="43" kind="relationship" relationship="rootViewController"/>
|
<segue destination="43" kind="relationship" relationship="rootViewController" id="617"/>
|
||||||
</connections>
|
</connections>
|
||||||
</navigationController>
|
</navigationController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="68" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="68" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="-1097" y="564"/>
|
<point key="canvasLocation" x="-1097" y="564"/>
|
||||||
</scene>
|
</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>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
|
<image name="logo.png" width="282" height="44"/>
|
||||||
<image name="Icon.png" width="57" height="57"/>
|
<image name="Icon.png" width="57" height="57"/>
|
||||||
<image name="boxed-bg.png" width="400" height="400"/>
|
<image name="boxed-bg.png" width="400" height="400"/>
|
||||||
<image name="logo.png" width="282" height="44"/>
|
|
||||||
</resources>
|
</resources>
|
||||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
|
||||||
<simulatedScreenMetrics key="destination" type="retina47"/>
|
|
||||||
<simulatedOrientationMetrics key="orientation"/>
|
|
||||||
</simulatedMetricsContainer>
|
|
||||||
</document>
|
</document>
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Diagnostics;
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Repositories;
|
using Bit.App.Repositories;
|
||||||
using Bit.App.Services;
|
using Bit.App.Services;
|
||||||
|
@ -52,6 +53,19 @@ namespace Bit.iOS.Extension
|
||||||
PerformSegue("seque", this);
|
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()
|
private void SetIoc()
|
||||||
{
|
{
|
||||||
var container = new UnityContainer();
|
var container = new UnityContainer();
|
||||||
|
|
Loading…
Reference in a new issue