2016-05-07 08:54:44 +03:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using MobileCoreServices;
|
|
|
|
|
using Foundation;
|
|
|
|
|
using UIKit;
|
|
|
|
|
|
|
|
|
|
namespace Bit.iOS.Extension
|
|
|
|
|
{
|
|
|
|
|
public partial class ActionViewController : UIViewController
|
|
|
|
|
{
|
|
|
|
|
public ActionViewController(IntPtr handle) : base(handle)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Content { get; set; }
|
|
|
|
|
public Uri Uri { get; set; }
|
|
|
|
|
|
|
|
|
|
public override void DidReceiveMemoryWarning()
|
|
|
|
|
{
|
|
|
|
|
base.DidReceiveMemoryWarning();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ViewDidLoad()
|
|
|
|
|
{
|
|
|
|
|
base.ViewDidLoad();
|
|
|
|
|
|
|
|
|
|
foreach(var item in ExtensionContext.InputItems)
|
|
|
|
|
{
|
|
|
|
|
foreach(var itemProvider in item.Attachments)
|
|
|
|
|
{
|
2016-05-25 07:09:11 +03:00
|
|
|
|
if(!itemProvider.HasItemConformingTo(UTType.PropertyList))
|
2016-05-07 08:54:44 +03:00
|
|
|
|
{
|
2016-05-25 07:09:11 +03:00
|
|
|
|
continue;
|
2016-05-07 08:54:44 +03:00
|
|
|
|
}
|
2016-05-25 07:09:11 +03:00
|
|
|
|
|
|
|
|
|
itemProvider.LoadItem(UTType.PropertyList, null, (NSObject list, NSError error) =>
|
|
|
|
|
{
|
|
|
|
|
if(list == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var dict = list as NSDictionary;
|
|
|
|
|
var result = dict[NSJavaScriptExtension.PreprocessingResultsKey];
|
|
|
|
|
if(result == null)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
break;
|
2016-05-07 08:54:44 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
partial void DoneClicked(NSObject sender)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|