Always present settings from OWSNavigationController

// FREEBIE
This commit is contained in:
Michael Kirk 2017-09-07 11:03:54 -04:00
parent 29848835f3
commit 25a2646c8b
7 changed files with 30 additions and 4 deletions

View File

@ -20,6 +20,7 @@
#import "OWSDatabaseMigration.h"
#import "OWSLogger.h"
#import "OWSMessageEditing.h"
#import "OWSNavigationController.h"
#import "OWSProfileManager.h"
#import "OWSProgressView.h"
#import "OWSViewController.h"

View File

@ -4,6 +4,15 @@
#import "OWSTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class OWSNavigationController;
@interface AppSettingsViewController : OWSTableViewController
+ (OWSNavigationController *)inModalNavigationController;
- (instancetype)init NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END

View File

@ -10,6 +10,7 @@
#import "NotificationSettingsViewController.h"
#import "OWSContactsManager.h"
#import "OWSLinkedDevicesTableViewController.h"
#import "OWSNavigationController.h"
#import "PrivacySettingsTableViewController.h"
#import "ProfileViewController.h"
#import "PropertyListPreferences.h"
@ -29,6 +30,18 @@
@implementation AppSettingsViewController
/**
* We always present the settings controller modally, from within an OWSNavigationController
*/
+ (OWSNavigationController *)inModalNavigationController
{
AppSettingsViewController *viewController = [AppSettingsViewController new];
OWSNavigationController *navController =
[[OWSNavigationController alloc] initWithRootViewController:viewController];
return navController;
}
- (instancetype)init
{
self = [super init];
@ -64,6 +77,8 @@
[super viewDidLoad];
[self.navigationItem setHidesBackButton:YES];
OWSAssert([self.navigationController isKindOfClass:[OWSNavigationController class]]);
[self.navigationController.navigationBar setTranslucent:NO];
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop

View File

@ -905,7 +905,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
assert(fromViewController != nil)
// Construct the "settings" view & push the "privacy settings" view.
let navigationController = UINavigationController(rootViewController:AppSettingsViewController())
let navigationController = AppSettingsViewController.inModalNavigationController()
navigationController.pushViewController(PrivacySettingsTableViewController(), animated:false)
fromViewController?.present(navigationController, animated: true, completion: nil)

View File

@ -126,7 +126,7 @@ private class CallKitExperienceUpgradeViewController: ExperienceUpgradeViewContr
assert(fromViewController != nil)
// Construct the "settings" view & push the "privacy settings" view.
let navigationController = UINavigationController(rootViewController:AppSettingsViewController())
let navigationController = AppSettingsViewController.inModalNavigationController()
navigationController.pushViewController(PrivacySettingsTableViewController(), animated:false)
fromViewController?.present(navigationController, animated: true, completion: nil)

View File

@ -95,6 +95,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)viewDidLoad {
[super viewDidLoad];
OWSAssert([self.navigationController isKindOfClass:[OWSNavigationController class]]);
// HACK otherwise CNContactViewController Navbar is shown as black.
// RADAR rdar://28433898 http://www.openradar.me/28433898
// CNContactViewController incompatible with opaque navigation bar

View File

@ -310,8 +310,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
}
- (void)settingsButtonPressed:(id)sender {
AppSettingsViewController *vc = [AppSettingsViewController new];
OWSNavigationController *navigationController = [[OWSNavigationController alloc] initWithRootViewController:vc];
OWSNavigationController *navigationController = [AppSettingsViewController inModalNavigationController];
[self presentViewController:navigationController animated:YES completion:nil];
}