/********* Capture Plugin.m Cordova Plugin Implementation *******/

#import <Cordova/CDV.h>
#import "SGRecordViewController.h"

@interface CapturePlugin : CDVPlugin {
  // Member variables go here.
}

- (void)capture:(CDVInvokedUrlCommand*)command;
@end

@implementation CapturePlugin

- (void)capture:(CDVInvokedUrlCommand*)command
{
    CDVPluginResult* pluginResult = nil;
    SGRecordViewController *vc = [[SGRecordViewController alloc]init];
    vc.view.frame = CGRectMake(0, 0,vc.view.frame.size.width,vc.view.frame.size.height);
    // Run later to avoid the "took a long time" log message.
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.viewController presentViewController:vc animated:YES completion:nil];
    });

    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

@end
