storybaord work for extension

This commit is contained in:
Kyle Spearrin 2016-06-04 12:10:03 -04:00
parent f7ac5e08f2
commit 9ba5498d18
10 changed files with 214 additions and 74 deletions

View File

@ -2,18 +2,10 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Bit.App.Abstractions;
using Bit.App.Repositories;
using Bit.App.Services;
using Bit.iOS.Core.Services;
using CoreGraphics;
using Foundation;
using Microsoft.Practices.Unity;
using MobileCoreServices;
using Newtonsoft.Json;
using UIKit;
using XLabs.Ioc;
using XLabs.Ioc.Unity;
namespace Bit.iOS.Extension
{
@ -62,44 +54,10 @@ namespace Bit.iOS.Extension
public PasswordGenerationOptions PasswordOptions { get; set; }
public PageDetails Details { get; set; }
private void SetIoc()
{
var container = new UnityContainer();
container
// Services
.RegisterType<IDatabaseService, DatabaseService>(new ContainerControlledLifetimeManager())
.RegisterType<ISqlService, SqlService>(new ContainerControlledLifetimeManager())
//.RegisterType<ISecureStorageService, KeyChainStorageService>(new ContainerControlledLifetimeManager())
.RegisterType<ICryptoService, CryptoService>(new ContainerControlledLifetimeManager())
.RegisterType<IAuthService, AuthService>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderService, FolderService>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteService, SiteService>(new ContainerControlledLifetimeManager())
.RegisterType<ISyncService, SyncService>(new ContainerControlledLifetimeManager())
//.RegisterType<IClipboardService, ClipboardService>(new ContainerControlledLifetimeManager())
// Repositories
.RegisterType<IFolderRepository, FolderRepository>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderApiRepository, FolderApiRepository>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteRepository, SiteRepository>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager());
// Other
//.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
//.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
//.RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager())
//.RegisterInstance(CrossFingerprint.Current, new ContainerControlledLifetimeManager());
Resolver.SetResolver(new UnityResolver(container));
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
if(!Resolver.IsSet)
{
SetIoc();
}
View.BackgroundColor = UIColor.FromPatternImage(new UIImage("boxed-bg.png"));
foreach(var item in ExtensionContext.InputItems)
{
@ -125,8 +83,8 @@ namespace Bit.iOS.Extension
}
}
partial void DoneClicked(Foundation.NSObject sender)
{
partial void DoneClicked(NSObject sender)
{
NSDictionary itemData = null;
if(ProviderType == UTType.PropertyList)
{
@ -324,7 +282,7 @@ namespace Bit.iOS.Extension
return default(T);
}
private T DeserializeString<T>(NSString jsonString)
private T DeserializeString<T>(NSString jsonString)
{
if(jsonString != null)
{

View File

@ -14,19 +14,11 @@ namespace Bit.iOS.Extension
[Register ("ActionViewController")]
partial class ActionViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIImageView logo { get; set; }
[Action ("DoneClicked:")]
partial void DoneClicked (Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (logo != null) {
logo.Dispose ();
logo = null;
}
}
}
}

View File

@ -1,5 +1,5 @@
<?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="ObA-dk-sSI">
<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">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
@ -8,19 +8,19 @@
<!--Image-->
<scene sceneID="7MM-of-jgj">
<objects>
<viewController title="Selection" id="ObA-dk-sSI" customClass="ActionViewController" sceneMemberID="viewController">
<viewController id="ObA-dk-sSI" customClass="ActionViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="qkL-Od-lgU"/>
<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="528"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NOA-Dm-cuz">
<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">
<navigationItem id="3HJ-uW-3hn" title="Title">
<barButtonItem key="leftBarButtonItem" title="Done" style="done" id="WYi-yp-eM6">
<connections>
<action selector="DoneClicked:" destination="ObA-dk-sSI" id="eDL-XE-zg5"/>
@ -28,30 +28,94 @@
</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>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="3" translatesAutoresizingMaskIntoConstraints="NO" fixedFrame="YES" image="Icon.png">
<rect key="frame" x="71" y="143" width="178" height="153"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="NOA-Dm-cuz" secondAttribute="trailing" id="A05-Pj-hrr"/>
<constraint firstItem="NOA-Dm-cuz" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leading" id="HxO-8t-aoh"/>
<constraint firstItem="NOA-Dm-cuz" firstAttribute="top" secondItem="qkL-Od-lgU" secondAttribute="bottom" id="we0-1t-bgp"/>
</constraints>
</view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="528"/>
<connections>
<outlet property="logo" destination="3" id="name-outlet-3"/>
</connections>
<connections/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="252" y="-124"/>
<point key="canvasLocation" x="-67" y="561"/>
</scene>
<scene sceneID="42">
<objects>
<viewController id="43" sceneMemberID="viewController" customClass="SplashViewController">
<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"/>
<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>
</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>
</view>
<connections>
<segue id="1679" destination="ObA-dk-sSI" kind="show" identifier="seque"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-561" y="555"/>
</scene>
<scene sceneID="63">
<objects>
<navigationController definesPresentationContext="YES" id="64" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="67">
<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"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="68" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1097" y="564"/>
</scene>
</scenes>
<resources>
<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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -0,0 +1,97 @@
using System;
using System.Drawing;
using Bit.App.Abstractions;
using Bit.App.Repositories;
using Bit.App.Services;
using Bit.iOS.Core.Services;
using Foundation;
using Microsoft.Practices.Unity;
using UIKit;
using XLabs.Ioc;
using XLabs.Ioc.Unity;
namespace Bit.iOS.Extension
{
public partial class SplashViewController : UIViewController
{
public SplashViewController(IntPtr handle) : base(handle)
{
}
public override void DidReceiveMemoryWarning()
{
// Releases the view if it doesn't have a superview.
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
#region View lifecycle
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = UIColor.FromPatternImage(new UIImage("boxed-bg.png"));
NavigationController.SetNavigationBarHidden(true, false);
}
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
if(!Resolver.IsSet)
{
SetIoc();
}
PerformSegue("seque", this);
}
private void SetIoc()
{
var container = new UnityContainer();
container
// Services
.RegisterType<IDatabaseService, DatabaseService>(new ContainerControlledLifetimeManager())
.RegisterType<ISqlService, SqlService>(new ContainerControlledLifetimeManager())
//.RegisterType<ISecureStorageService, KeyChainStorageService>(new ContainerControlledLifetimeManager())
.RegisterType<ICryptoService, CryptoService>(new ContainerControlledLifetimeManager())
.RegisterType<IAuthService, AuthService>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderService, FolderService>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteService, SiteService>(new ContainerControlledLifetimeManager())
.RegisterType<ISyncService, SyncService>(new ContainerControlledLifetimeManager())
//.RegisterType<IClipboardService, ClipboardService>(new ContainerControlledLifetimeManager())
// Repositories
.RegisterType<IFolderRepository, FolderRepository>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderApiRepository, FolderApiRepository>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteRepository, SiteRepository>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager());
// Other
//.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
//.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
//.RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager())
//.RegisterInstance(CrossFingerprint.Current, new ContainerControlledLifetimeManager());
Resolver.SetResolver(new UnityResolver(container));
}
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
}
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
}
#endregion
}
}

View File

@ -0,0 +1,21 @@
// 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 ("SplashViewController")]
partial class SplashViewController
{
void ReleaseDesignerOutlets ()
{
}
}
}

View File

@ -95,6 +95,10 @@
</Compile>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="SplashViewController.cs" />
<Compile Include="SplashViewController.designer.cs">
<DependentUpon>SplashViewController.cs</DependentUpon>
</Compile>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -140,6 +144,10 @@
<BundleResource Include="Resources\Icon.png" />
<BundleResource Include="Resources\Icon%402x.png" />
<BundleResource Include="Resources\Icon%403x.png" />
<BundleResource Include="Resources\boxed-bg.png" />
<BundleResource Include="Resources\logo.png" />
<BundleResource Include="Resources\logo%402x.png" />
<BundleResource Include="Resources\logo%403x.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\App\App.csproj">