mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-03-30 10:15:49 +00:00
implement publishing the site (untested)
This commit is contained in:
parent
a84bd41d58
commit
fc906ef976
3 changed files with 24 additions and 1 deletions
|
|
@ -43,4 +43,7 @@ extern NSString *BlogPostDeletedNotification;
|
|||
- (PMKPromise *)requestUnpublishPostWithPath:(NSString *)path;
|
||||
- (PMKPromise *)requestDeletePostWithPath:(NSString *)path;
|
||||
|
||||
- (PMKPromise *)requestPublishToStagingEnvironment;
|
||||
- (PMKPromise *)requestPublishToProductionEnvironment;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -137,4 +137,12 @@ NSString *BlogPostDeletedNotification = @"BlogPostDeletedNotification";
|
|||
});
|
||||
}
|
||||
|
||||
- (PMKPromise *)requestPublishToStagingEnvironment {
|
||||
return [_service requestPublishEnvironment:@"staging"];
|
||||
}
|
||||
|
||||
- (PMKPromise *)requestPublishToProductionEnvironment {
|
||||
return [_service requestPublishEnvironment:@"production"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -194,7 +194,19 @@ static const NSUInteger SectionPublished = 1;
|
|||
}
|
||||
|
||||
- (IBAction)publish:(id)sender {
|
||||
NSLog(@"publish");
|
||||
// TODO: activity indicator, maybe show an action sheet to select Staging or Production?
|
||||
self.publishButton.enabled = NO;
|
||||
[self.blogController requestPublishToStagingEnvironment].then(^{
|
||||
[self requestStatusWithoutCaching];
|
||||
}).catch(^(NSError *error) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Error" message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}).finally(^{
|
||||
self.publishButton.enabled = YES;
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - Segues
|
||||
|
|
|
|||
Loading…
Reference in a new issue