1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +01:00

extension debug

This commit is contained in:
Kyle Spearrin 2016-05-25 00:09:11 -04:00
parent 83e872f4b6
commit 38a8010b81
2 changed files with 30 additions and 18 deletions

View File

@ -28,25 +28,33 @@ namespace Bit.iOS.Extension
{ {
foreach(var itemProvider in item.Attachments) foreach(var itemProvider in item.Attachments)
{ {
if(itemProvider.HasItemConformingTo(UTType.PropertyList)) if(!itemProvider.HasItemConformingTo(UTType.PropertyList))
{ {
itemProvider.LoadItem(UTType.PropertyList, null, delegate (NSObject list, NSError error) continue;
{
if(list != null)
{
var dict = list as NSDictionary;
var result = dict[NSJavaScriptExtension.PreprocessingResultsKey];
if(result != null)
{
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;
} }
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;
} }
} }
} }

View File

@ -2,6 +2,9 @@
BitwardenExtension.prototype = { BitwardenExtension.prototype = {
run: function (arguments) { run: function (arguments) {
console.log("Run");
console.log(arguments);
var args = { var args = {
content: document.body.innerHTML, content: document.body.innerHTML,
uri: document.baseURI uri: document.baseURI
@ -9,7 +12,8 @@ BitwardenExtension.prototype = {
arguments.completionFunction(args); arguments.completionFunction(args);
}, },
finalize: function (arguments) { finalize: function (arguments) {
alert('finalize'); console.log("Finalize");
console.log(arguments);
} }
}; };