Skip to content

Instantly share code, notes, and snippets.

@imgly-gists
Last active June 2, 2017 12:26
Show Gist options
  • Save imgly-gists/656cdebd5fe999e1535c395dba9ae3fa to your computer and use it in GitHub Desktop.
Save imgly-gists/656cdebd5fe999e1535c395dba9ae3fa to your computer and use it in GitHub Desktop.
- (void)present:(CDVInvokedUrlCommand *)command {
if (self.lastCommand == nil) {
self.lastCommand = command;
PESDKConfiguration *configuration = [[PESDKConfiguration alloc] initWithBuilder:^(PESDKConfigurationBuilder * _Nonnull builder) {
// Customize the SDK to match your requirements:
// ...eg.:
// [builder setBackgroundColor:[UIColor whiteColor]];
}];
PESDKCameraViewController *cameraViewController = [[PESDKCameraViewController alloc] initWithConfiguration:configuration];
[cameraViewController setCompletionBlock:^(UIImage * _Nullable image, NSURL * _Nullable url) {
PESDKPhotoEditViewController *photoEditViewController = [[PESDKPhotoEditViewController alloc] initWithPhoto:image configuration:configuration];
photoEditViewController.delegate = self;
PESDKToolbarController *toolbarController = [PESDKToolbarController new];
[toolbarController pushViewController:photoEditViewController animated:YES completion:nil];
[self.viewController dismissViewControllerAnimated:YES completion:^{
[self.viewController presentViewController:toolbarController animated:YES completion:nil];
}];
}];
dispatch_async(dispatch_get_main_queue(), ^{
[self.viewController presentViewController:cameraViewController animated:YES completion:nil];
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment