mirror of
https://github.com/bitwarden/mobile
synced 2025-12-16 00:03:22 +00:00
ios extension removed storyboard. return values to js.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user