mirror of
https://github.com/bitwarden/android.git
synced 2024-12-19 07:41:52 +03:00
ios extension removed storyboard. return values to js.
This commit is contained in:
parent
38a8010b81
commit
b5a7f9430a
7 changed files with 71 additions and 96 deletions
|
@ -1,25 +1,56 @@
|
|||
using System;
|
||||
|
||||
using MobileCoreServices;
|
||||
using System;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using MobileCoreServices;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Extension
|
||||
{
|
||||
public partial class ActionViewController : UIViewController
|
||||
{
|
||||
public ActionViewController(IntPtr handle) : base(handle)
|
||||
public ActionViewController() : base("ActionViewController", null)
|
||||
{
|
||||
}
|
||||
|
||||
public string Content { get; set; }
|
||||
public Uri Uri { get; set; }
|
||||
public string HtmlContent { get; set; }
|
||||
public Uri BaseUri { get; set; }
|
||||
public Uri Url { get; set; }
|
||||
|
||||
public override void DidReceiveMemoryWarning()
|
||||
{
|
||||
base.DidReceiveMemoryWarning();
|
||||
}
|
||||
|
||||
public override void LoadView()
|
||||
{
|
||||
View = new UIView(new CGRect(x: 0.0, y: 0, width: 320.0, height: 200.0));
|
||||
var button = new UIButton(new CGRect(x: 10.0, y: 50.0, width: 200.0, height: 30.0));
|
||||
button.SetTitle("Done", UIControlState.Normal);
|
||||
button.TouchUpInside += Button_TouchUpInside;
|
||||
View.AddSubview(button);
|
||||
}
|
||||
|
||||
private void Button_TouchUpInside(object sender, EventArgs e)
|
||||
{
|
||||
var itemData = new NSDictionary(
|
||||
new NSString("username"),
|
||||
new NSString("myusername"),
|
||||
new NSString("password"),
|
||||
new NSString("mypassword"));
|
||||
|
||||
var resultsProvider = new NSItemProvider(
|
||||
new NSDictionary(NSJavaScriptExtension.FinalizeArgumentKey, itemData),
|
||||
UTType.PropertyList);
|
||||
|
||||
var resultsItem = new NSExtensionItem
|
||||
{
|
||||
Attachments = new NSItemProvider[] { resultsProvider }
|
||||
};
|
||||
|
||||
var returningItems = new NSExtensionItem[] { resultsItem };
|
||||
ExtensionContext.CompleteRequest(returningItems, null);
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
|
@ -47,11 +78,9 @@ namespace Bit.iOS.Extension
|
|||
return;
|
||||
}
|
||||
|
||||
Content = result.ValueForKey(new NSString("content")) as NSString;
|
||||
Uri = new Uri(result.ValueForKey(new NSString("uri")) as NSString);
|
||||
|
||||
Console.WriteLine("BITWARDEN LOG, Content: {0}", Content);
|
||||
Console.WriteLine("BITWARDEN LOG, Uri: {0}", Uri);
|
||||
HtmlContent = result.ValueForKey(new NSString("htmlContent")) as NSString;
|
||||
BaseUri = new Uri(result.ValueForKey(new NSString("baseUri")) as NSString);
|
||||
Url = new Uri(result.ValueForKey(new NSString("url")) as NSString);
|
||||
});
|
||||
|
||||
break;
|
||||
|
@ -59,9 +88,5 @@ namespace Bit.iOS.Extension
|
|||
}
|
||||
}
|
||||
|
||||
partial void DoneClicked(NSObject sender)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
14
src/iOS.Extension/ActionViewController.designer.cs
generated
14
src/iOS.Extension/ActionViewController.designer.cs
generated
|
@ -1,9 +1,9 @@
|
|||
// WARNING
|
||||
//
|
||||
// This file has been generated automatically to store outlets and
|
||||
// actions made in the Xcode designer. If it is removed, they will be lost.
|
||||
// Manual changes to this file may not be handled correctly.
|
||||
// This file has been generated automatically by Visual Studio from the outlets and
|
||||
// actions declared in your storyboard file.
|
||||
// Manual changes to this file will not be maintained.
|
||||
//
|
||||
using UIKit;
|
||||
using Foundation;
|
||||
|
||||
namespace Bit.iOS.Extension
|
||||
|
@ -11,12 +11,6 @@ namespace Bit.iOS.Extension
|
|||
[Register("ActionViewController")]
|
||||
partial class ActionViewController
|
||||
{
|
||||
[Outlet]
|
||||
UIImageView imageView { get; set; }
|
||||
|
||||
[Action("DoneClicked:")]
|
||||
partial void DoneClicked(NSObject sender);
|
||||
|
||||
void ReleaseDesignerOutlets()
|
||||
{
|
||||
}
|
||||
|
|
18
src/iOS.Extension/ActionViewController.xib
Normal file
18
src/iOS.Extension/ActionViewController.xib
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703" />
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ActionViewController">
|
||||
<connections>
|
||||
<outlet property="view" destination="2" id="RRd-Eg-VrN" />
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder" />
|
||||
<view contentMode="scaleToFill" id="2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
|
@ -46,8 +46,8 @@
|
|||
<key>NSExtensionPointVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
<string>MainInterface</string>
|
||||
<key>NSExtensionPrincipalClass</key>
|
||||
<string>ActionViewController</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.ui-services</string>
|
||||
</dict>
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6154.17" systemVersion="13D65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="ObA-dk-sSI">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6153.11"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Action View Controller - Image-->
|
||||
<scene sceneID="7MM-of-jgj">
|
||||
<objects>
|
||||
<viewController title="Image" 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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9ga-4F-77Z">
|
||||
<rect key="frame" x="0.0" y="64" width="320" height="464"/>
|
||||
</imageView>
|
||||
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NOA-Dm-cuz">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="44"/>
|
||||
<items>
|
||||
<navigationItem id="3HJ-uW-3hn">
|
||||
<barButtonItem key="leftBarButtonItem" title="Done" style="done" id="WYi-yp-eM6">
|
||||
<connections>
|
||||
<action selector="DoneClicked" destination="ObA-dk-sSI" id="Qdu-qn-U6V"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</items>
|
||||
</navigationBar>
|
||||
</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="9ga-4F-77Z" firstAttribute="top" secondItem="NOA-Dm-cuz" secondAttribute="bottom" id="Fps-3D-QQW"/>
|
||||
<constraint firstItem="NOA-Dm-cuz" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leading" id="HxO-8t-aoh"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9ga-4F-77Z" secondAttribute="trailing" id="Ozw-Hg-0yh"/>
|
||||
<constraint firstItem="9ga-4F-77Z" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leading" id="XH5-ld-ONA"/>
|
||||
<constraint firstItem="n38-gi-rB5" firstAttribute="top" secondItem="9ga-4F-77Z" secondAttribute="bottom" id="eQg-nn-Zy4"/>
|
||||
<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="imageView" destination="9ga-4F-77Z" id="5y6-5w-9QO"/>
|
||||
<outlet property="view" destination="zMn-AG-sqS" id="Qma-de-2ek"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="252" y="-124"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination" type="retina4"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
|
@ -6,8 +6,9 @@ BitwardenExtension.prototype = {
|
|||
console.log(arguments);
|
||||
|
||||
var args = {
|
||||
content: document.body.innerHTML,
|
||||
uri: document.baseURI
|
||||
baseUri: document.baseURI,
|
||||
url: document.URL,
|
||||
htmlContent: document.body.innerHTML
|
||||
};
|
||||
arguments.completionFunction(args);
|
||||
},
|
||||
|
|
|
@ -87,16 +87,16 @@
|
|||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ActionViewController.cs" />
|
||||
<Compile Include="ActionViewController.designer.cs">
|
||||
<DependentUpon>ActionViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<InterfaceDefinition Include="ActionViewController.xib" />
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ActionViewController.cs" />
|
||||
<InterfaceDefinition Include="MainInterface.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
Loading…
Reference in a new issue