mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-04-21 13:55:53 +00:00
enable publishing to production from the share extension
This commit is contained in:
parent
171a262a6e
commit
4322e4b247
1 changed files with 2 additions and 2 deletions
|
|
@ -41,13 +41,13 @@
|
|||
NSLog(@"title = %@", title);
|
||||
NSLog(@"body = %@", body);
|
||||
NSItemProvider *urlProvider = [self firstURLProvider];
|
||||
BOOL reallyPost = NO;
|
||||
BOOL reallyPost = YES;
|
||||
[urlProvider loadItemForTypeIdentifier:@"public.url" options:nil completionHandler:^(NSURL *url, NSError *error) {
|
||||
// TODO: image
|
||||
NSLog(@"url = %@", url);
|
||||
if (reallyPost) {
|
||||
Post *post = [Post newDraftWithTitle:title body:body url:url];
|
||||
[blogController requestCreateDraft:post publishImmediatelyToEnvironment:@"staging" waitForCompilation:NO].catch(^(NSError *error) {
|
||||
[blogController requestCreateDraft:post publishImmediatelyToEnvironment:@"production" waitForCompilation:NO].catch(^(NSError *error) {
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Error" message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alert addAction:[UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
|
|
|
|||
Loading…
Reference in a new issue