mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'mkirk/fix-swipe-back'
This commit is contained in:
commit
acf3a6e027
15 changed files with 44 additions and 64 deletions
|
@ -8,8 +8,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@interface UIViewController (OWS)
|
||||
|
||||
/**
|
||||
* Takes up a bit less space than the default system back button
|
||||
* used in the MessagesViewController to help left-align the title view.
|
||||
*
|
||||
* **note** Using this breaks the interactive pop gesture (swipe back) unless you set/unset the
|
||||
* interactivePopGesture.delegate to self/nil on viewWillAppear/Disappear
|
||||
*/
|
||||
- (UIBarButtonItem *)createOWSBackButton;
|
||||
- (void)useOWSBackButton;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -10,18 +10,39 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (UIBarButtonItem *)createOWSBackButton
|
||||
{
|
||||
// Nudge closer to the left edge to match default back button item.
|
||||
const CGFloat kExtraLeftPadding = -8;
|
||||
|
||||
// Give some extra hit area to the back button. This is a little smaller
|
||||
// than the default back button, but makes sense for our left aligned title
|
||||
// view in the MessagesViewController
|
||||
const CGFloat kExtraRightPadding = 10;
|
||||
|
||||
// Extra hit area above/below
|
||||
const CGFloat kExtraHeightPadding = 4;
|
||||
|
||||
// Matching the default backbutton placement is tricky.
|
||||
// We can't just adjust the imageEdgeInsets on a UIBarButtonItem directly,
|
||||
// so we adjust the imageEdgeInsets on a UIButton, then wrap that
|
||||
// in a UIBarButtonItem.
|
||||
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[backButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
UIImage *backImage = [UIImage imageNamed:@"NavBarBack"];
|
||||
OWSAssert(backImage);
|
||||
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:backImage
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(backButtonPressed:)];
|
||||
return backItem;
|
||||
}
|
||||
[backButton setImage:backImage forState:UIControlStateNormal];
|
||||
|
||||
- (void)useOWSBackButton
|
||||
{
|
||||
self.navigationItem.leftBarButtonItem = [self createOWSBackButton];
|
||||
backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
||||
|
||||
// Default back button is 1.5 pixel lower than our extracted image.
|
||||
const CGFloat kTopInsetPadding = 1.5
|
||||
backButton.imageEdgeInsets = UIEdgeInsetsMake(kTopInsetPadding, kExtraLeftPadding, 0, 0);
|
||||
|
||||
backButton.frame = CGRectMake(0, 0, backImage.size.width + kExtraRightPadding, backImage.size.height + kExtraHeightPadding);
|
||||
|
||||
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
|
||||
|
||||
return backItem;
|
||||
}
|
||||
|
||||
#pragma mark - Event Handling
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#import <Social/Social.h>
|
||||
#import "AboutTableViewController.h"
|
||||
#import "UIUtil.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
|
||||
@interface AboutTableViewController ()
|
||||
|
||||
|
@ -33,7 +32,6 @@ typedef NS_ENUM(NSUInteger, AboutTableViewControllerSection) {
|
|||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self.navigationController.navigationBar setTranslucent:NO];
|
||||
[self useOWSBackButton];
|
||||
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#import "RPAccountManager.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import "TSAccountManager.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import "Pastelog.h"
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
|
||||
|
@ -52,8 +51,6 @@ typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
|
|||
|
||||
self.title = NSLocalizedString(@"SETTINGS_ADVANCED_TITLE", @"");
|
||||
|
||||
[self useOWSBackButton];
|
||||
|
||||
// Enable Log
|
||||
self.enableLogCell = [[UITableViewCell alloc] init];
|
||||
self.enableLogCell.textLabel.text = NSLocalizedString(@"SETTINGS_ADVANCED_DEBUGLOG", @"");
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#import "Signal-Swift.h"
|
||||
#import "UIUtil.h"
|
||||
#import "UIViewController+CameraPermissions.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import <SignalServiceKit/NSDate+millisecondTimeStamp.h>
|
||||
#import <SignalServiceKit/OWSError.h>
|
||||
#import <SignalServiceKit/OWSFingerprint.h>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#import "Signal-Swift.h"
|
||||
#import "UIColor+OWS.h"
|
||||
#import "UIUtil.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -462,6 +462,9 @@ typedef enum : NSUInteger {
|
|||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
|
||||
self.navigationController.interactivePopGestureRecognizer.delegate = self;
|
||||
|
||||
// We need to recheck on every appearance, since the user may have left the group in the settings VC,
|
||||
// or on another device.
|
||||
[self hideInputIfNeeded];
|
||||
|
@ -543,6 +546,9 @@ typedef enum : NSUInteger {
|
|||
[super viewWillDisappear:animated];
|
||||
[self toggleObservers:NO];
|
||||
|
||||
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
|
||||
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
|
||||
|
||||
[_unreadContainer removeFromSuperview];
|
||||
_unreadContainer = nil;
|
||||
|
||||
|
@ -769,24 +775,6 @@ typedef enum : NSUInteger {
|
|||
((OWSMessagesComposerTextView *) self.inputToolbar.contentView.textView).textViewPasteDelegate = self;
|
||||
}
|
||||
|
||||
- (nullable UILabel *)findNavbarTitleLabel
|
||||
{
|
||||
for (UIView *view in self.navigationController.navigationBar.subviews) {
|
||||
if ([view isKindOfClass:NSClassFromString(@"UINavigationItemView")]) {
|
||||
UIView *navItemView = view;
|
||||
for (UIView *aView in navItemView.subviews) {
|
||||
if ([aView isKindOfClass:[UILabel class]]) {
|
||||
UILabel *label = (UILabel *)aView;
|
||||
if ([label.text isEqualToString:self.title]) {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Overiding JSQMVC layout defaults
|
||||
- (void)initializeCollectionViewLayout
|
||||
{
|
||||
|
@ -1360,12 +1348,6 @@ typedef enum : NSUInteger {
|
|||
[self.navigationController pushViewController:settingsVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)didTapTitle
|
||||
{
|
||||
DDLogDebug(@"%@ Tapped title in navbar", self.tag);
|
||||
[self showConversationSettings];
|
||||
}
|
||||
|
||||
- (void)didTapTimerInNavbar:(id)sender
|
||||
{
|
||||
DDLogDebug(@"%@ Tapped timer in navbar", self.tag);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#import "TSOutgoingMessage.h"
|
||||
#import "UIImage+normalizeImage.h"
|
||||
#import "UIUtil.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import <MobileCoreServices/UTCoreTypes.h>
|
||||
#import <SignalServiceKit/MimeTypeUtil.h>
|
||||
#import <SignalServiceKit/NSDate+millisecondTimeStamp.h>
|
||||
|
@ -101,7 +100,6 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self.navigationController.navigationBar setTranslucent:NO];
|
||||
[self useOWSBackButton];
|
||||
|
||||
contacts = self.contactsManager.signalContacts;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#import "NotificationSettingsOptionsViewController.h"
|
||||
#import "Environment.h"
|
||||
#import "PropertyListPreferences.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
|
||||
@interface NotificationSettingsOptionsViewController ()
|
||||
|
||||
|
@ -19,8 +18,6 @@
|
|||
self.options = @[ @(NotificationNamePreview), @(NotificationNameNoPreview), @(NotificationNoNameNoPreview) ];
|
||||
|
||||
[super viewDidLoad];
|
||||
|
||||
[self useOWSBackButton];
|
||||
}
|
||||
|
||||
#pragma mark - Table view data source
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#import "Environment.h"
|
||||
#import "NotificationSettingsOptionsViewController.h"
|
||||
#import "PropertyListPreferences.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
|
||||
#define kNotificationOptionSection 0
|
||||
|
||||
|
@ -26,8 +25,6 @@
|
|||
[super viewDidLoad];
|
||||
[self setTitle:NSLocalizedString(@"SETTINGS_NOTIFICATIONS", nil)];
|
||||
|
||||
[self useOWSBackButton];
|
||||
|
||||
self.notificationsSections = @[
|
||||
NSLocalizedString(@"NOTIFICATIONS_SECTION_BACKGROUND", nil),
|
||||
NSLocalizedString(@"NOTIFICATIONS_SECTION_INAPP", nil)
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#import "ShowGroupMembersViewController.h"
|
||||
#import "UIFont+OWS.h"
|
||||
#import "UIUtil.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import <25519/Curve25519.h>
|
||||
#import <SignalServiceKit/NSDate+millisecondTimeStamp.h>
|
||||
#import <SignalServiceKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
|
||||
|
@ -179,8 +178,6 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
|
|||
self.listGroupMembersCell.textLabel.text
|
||||
= NSLocalizedString(@"LIST_GROUP_MEMBERS_ACTION", @"table cell label in conversation settings");
|
||||
|
||||
[self useOWSBackButton];
|
||||
|
||||
self.toggleDisappearingMessagesCell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
self.disappearingMessagesDurationCell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
|
@ -211,6 +208,7 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
|
|||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// HACK to unselect rows when swiping back
|
||||
// http://stackoverflow.com/questions/19379510/uitableviewcell-doesnt-get-deselected-when-swiping-back-quickly
|
||||
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#import "OWSDeviceProvisioningURLParser.h"
|
||||
#import "OWSLinkedDevicesTableViewController.h"
|
||||
#import "SettingsTableViewController.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import <SignalServiceKit/ECKeyPair+OWSPrivateKey.h>
|
||||
#import <SignalServiceKit/OWSDeviceProvisioner.h>
|
||||
#import <SignalServiceKit/TSStorageManager+IdentityKeyStore.h>
|
||||
|
@ -28,8 +27,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self useOWSBackButton];
|
||||
|
||||
// HACK to get full width preview layer
|
||||
CGRect oldFrame = self.qrScanningView.frame;
|
||||
self.qrScanningView.frame = CGRectMake(
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#import "OWSDeviceTableViewCell.h"
|
||||
#import "OWSLinkDeviceViewController.h"
|
||||
#import "UIViewController+CameraPermissions.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import <SignalServiceKit/OWSDevice.h>
|
||||
#import <SignalServiceKit/OWSDevicesService.h>
|
||||
#import <SignalServiceKit/TSDatabaseView.h>
|
||||
|
@ -41,8 +40,6 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
|
|||
[super viewDidLoad];
|
||||
self.title = NSLocalizedString(@"LINKED_DEVICES_TITLE", @"Menu item and navbar title for the device manager");
|
||||
|
||||
[self useOWSBackButton];
|
||||
|
||||
self.isExpectingMoreDevices = NO;
|
||||
self.tableView.rowHeight = UITableViewAutomaticDimension;
|
||||
self.tableView.estimatedRowHeight = 70;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#import "Environment.h"
|
||||
#import "PropertyListPreferences.h"
|
||||
#import "UIUtil.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import <25519/Curve25519.h>
|
||||
|
||||
|
@ -61,8 +60,6 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) {
|
|||
|
||||
self.title = NSLocalizedString(@"SETTINGS_PRIVACY_TITLE", @"");
|
||||
|
||||
[self useOWSBackButton];
|
||||
|
||||
// CallKit opt-out
|
||||
self.enableCallKitCell = [UITableViewCell new];
|
||||
self.enableCallKitCell.textLabel.text = NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_TITLE", @"Short table cell label");
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#import "Environment.h"
|
||||
#import "GroupContactsResult.h"
|
||||
#import "UIUtil.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import <AddressBookUI/AddressBookUI.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
@ -59,8 +58,6 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
|
||||
self.title = _thread.groupModel.groupName;
|
||||
|
||||
[self useOWSBackButton];
|
||||
|
||||
[self initializeTableView];
|
||||
|
||||
self.groupContacts =
|
||||
|
|
Loading…
Reference in a new issue