#import "Sns.h"
#import <Cordova/CDV.h>

@implementation Sns
-(void) share:(CDVInvokedUrlCommand *) command
{
    [self.commandDelegate runInBackground:^{
        NSString* callbackId = [command callbackId];
        NSString* title = [[command arguments] objectAtIndex:0];
        NSString* desc = [[command arguments] objectAtIndex:1];
        NSString* imgUrl = [[command arguments] objectAtIndex:2];
        NSString* link = [[command arguments] objectAtIndex:3];
        NSString* str = [NSString stringWithFormat:@"标题:%@\n简介:%@\n图片:%@\n链接:%@",title,desc,imgUrl,link];
        
        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:str];
        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
    }];
}
@end