From ac397abc337a2ef6b2353c547a5ae1f7de185b52 Mon Sep 17 00:00:00 2001 From: kurzee Date: Wed, 3 Feb 2016 15:19:36 -0600 Subject: [PATCH 1/3] Reorganizes appearance of geotagging and post defaults. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moves Geotagging option to new “This Device” section. Only showing Default Post Category and Default Post Format to REST API admin users. Will not show for non-admin or XML-RPC users. --- .../Blog/SiteSettingsViewController.m | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m index c5a173f4feb5..50780a5b7fb9 100644 --- a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m @@ -42,9 +42,13 @@ SiteSettingsAccountCount, }; +NS_ENUM(NSInteger, SiteSettingsDevice) { + SiteSettingsDeviceGeotagging = 0, + SiteSettingsDeviceCount +}; + NS_ENUM(NSInteger, SiteSettingsWriting) { - SiteSettingsWritingGeotagging = 0, - SiteSettingsWritingDefaultCategory, + SiteSettingsWritingDefaultCategory= 0, SiteSettingsWritingDefaultPostFormat, SiteSettingsWritingRelatedPosts, SiteSettingsWritingCount, @@ -59,6 +63,7 @@ NS_ENUM(NSInteger, SiteSettingsSection) { SiteSettingsSectionGeneral = 0, SiteSettingsSectionAccount, + SiteSettingsSectionDevice, SiteSettingsSectionWriting, SiteSettingsSectionDiscussion, SiteSettingsSectionRemoveSite, @@ -128,7 +133,12 @@ - (void)viewDidLoad [sections addObject:@(SiteSettingsSectionAccount)]; } - [sections addObject:@(SiteSettingsSectionWriting)]; + [sections addObject:@(SiteSettingsSectionDevice)]; + + if ([self.blog supports:BlogFeatureWPComRESTAPI] && self.blog.isAdmin) { + // only REST API connections and admins can change Writing options + [sections addObject:@(SiteSettingsSectionWriting)]; + } if ([self.blog supports:BlogFeatureWPComRESTAPI]) { [sections addObject:@(SiteSettingsSectionDiscussion)]; @@ -194,18 +204,11 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger case SiteSettingsSectionAccount: { return SiteSettingsAccountCount; } + case SiteSettingsSectionDevice: { + return SiteSettingsDeviceCount; + } case SiteSettingsSectionWriting: { - if (!self.blog.isAdmin) { - // If we're not admin, we just want to show the geotagging cell - return 1; - } - NSInteger rowsToHide = 0; - if (![self.blog supports:BlogFeatureWPComRESTAPI]) { - // NOTE: Sergio Estevao (2015-09-23): Hides the related post for self-hosted sites not in jetpack - // because this options is not available for them. - rowsToHide += 1; - } - return SiteSettingsWritingCount - rowsToHide; + return SiteSettingsWritingCount; } case SiteSettingsSectionDiscussion: { return 1; @@ -342,10 +345,6 @@ - (UITableViewCell *)removeSiteCell - (UITableViewCell *)tableView:(UITableView *)tableView cellForWritingSettingsAtRow:(NSInteger)row { switch (row) { - case (SiteSettingsWritingGeotagging):{ - return self.geotaggingCell; - } - break; case (SiteSettingsWritingDefaultCategory):{ PostCategoryService *postCategoryService = [[PostCategoryService alloc] initWithManagedObjectContext:[[ContextManager sharedInstance] mainContext]]; PostCategory *postCategory = [postCategoryService findWithBlogObjectID:self.blog.objectID andCategoryID:self.blog.settings.defaultCategoryID]; @@ -488,6 +487,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case SiteSettingsSectionAccount: { return [self tableView:tableView cellForAccountSettingsInRow:indexPath.row]; } + case SiteSettingsSectionDevice: { + return self.geotaggingCell; + } case SiteSettingsSectionWriting: { return [self tableView:tableView cellForWritingSettingsAtRow:indexPath.row]; } @@ -543,6 +545,9 @@ - (NSString *)titleForHeaderInSection:(NSInteger)section case SiteSettingsSectionAccount: headingTitle = NSLocalizedString(@"Account", @"Title for the account section in site settings screen"); break; + case SiteSettingsSectionDevice: + headingTitle = NSLocalizedString(@"This Device", @"Title for the device section in site settings screen"); + break; case SiteSettingsSectionWriting: headingTitle = NSLocalizedString(@"Writing", @"Title for the writing section in site settings screen"); break; From 378d8e02c9f761f90ff65305374a226a20e04f8c Mon Sep 17 00:00:00 2001 From: kurzee Date: Wed, 3 Feb 2016 16:27:45 -0600 Subject: [PATCH 2/3] Moves "This Device" section and code placement to below all options except deleting. --- .../Blog/SiteSettingsViewController.m | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m index 50780a5b7fb9..9e8aaf1c7e6e 100644 --- a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m @@ -42,11 +42,6 @@ SiteSettingsAccountCount, }; -NS_ENUM(NSInteger, SiteSettingsDevice) { - SiteSettingsDeviceGeotagging = 0, - SiteSettingsDeviceCount -}; - NS_ENUM(NSInteger, SiteSettingsWriting) { SiteSettingsWritingDefaultCategory= 0, SiteSettingsWritingDefaultPostFormat, @@ -54,6 +49,11 @@ SiteSettingsWritingCount, }; +NS_ENUM(NSInteger, SiteSettingsDevice) { + SiteSettingsDeviceGeotagging = 0, + SiteSettingsDeviceCount +}; + NS_ENUM(NSInteger, SiteSettingsAdvanced) { SiteSettingsAdvancedStartOver = 0, SiteSettingsAdvancedDeleteSite, @@ -63,9 +63,9 @@ NS_ENUM(NSInteger, SiteSettingsSection) { SiteSettingsSectionGeneral = 0, SiteSettingsSectionAccount, - SiteSettingsSectionDevice, SiteSettingsSectionWriting, SiteSettingsSectionDiscussion, + SiteSettingsSectionDevice, SiteSettingsSectionRemoveSite, SiteSettingsSectionAdvanced, }; @@ -83,12 +83,13 @@ @interface SiteSettingsViewController () Date: Wed, 3 Feb 2016 17:06:49 -0600 Subject: [PATCH 3/3] Changes the default BlogSettings update for default post category and format. --- WordPress/Classes/Services/BlogService.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WordPress/Classes/Services/BlogService.m b/WordPress/Classes/Services/BlogService.m index f986b023bd85..051e4bb2f05e 100644 --- a/WordPress/Classes/Services/BlogService.m +++ b/WordPress/Classes/Services/BlogService.m @@ -6,6 +6,7 @@ #import "WPError.h" #import "Comment.h" #import "Post.h" +#import "PostCategory.h" #import "Page.h" #import "Media.h" #import "PostCategoryService.h" @@ -802,8 +803,8 @@ - (void)updateSettings:(BlogSettings *)settings withRemoteSettings:(RemoteBlogSe settings.privacy = remoteSettings.privacy ?: settings.privacy; // Writing - settings.defaultCategoryID = remoteSettings.defaultCategoryID ?: settings.defaultCategoryID; - settings.defaultPostFormat = remoteSettings.defaultPostFormat ?: settings.defaultPostFormat; + settings.defaultCategoryID = remoteSettings.defaultCategoryID ?: @(PostCategoryUncategorized); + settings.defaultPostFormat = remoteSettings.defaultPostFormat; // Discussion settings.commentsAllowed = [remoteSettings.commentsAllowed boolValue];