Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-04-03 17:12:29 -04:00
parent 89e244ee0a
commit db31454320
10 changed files with 75 additions and 64 deletions

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="tuk-0x-yCb">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="tuk-0x-yCb">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
@ -678,7 +678,7 @@
<objects>
<navigationController storyboardIdentifier="UserInitialViewController" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="tuk-0x-yCb" customClass="SignalsNavigationController" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" id="VNq-cN-pk9">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="VNq-cN-pk9">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.082137122750282288" green="0.46843802928924561" blue="0.91112053394317627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -788,7 +788,7 @@
<scene sceneID="nF7-wR-ITu">
<objects>
<navigationController storyboardIdentifier="SettingsNavigationController" id="u7y-N1-6Ba" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" id="OEe-gh-9Ii">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="OEe-gh-9Ii">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
@ -1069,7 +1069,7 @@
<connections>
<outlet property="aboutLabel" destination="qeN-f1-cIQ" id="kmc-iU-NK5"/>
<outlet property="advancedLabel" destination="dkL-Nz-E6H" id="HUw-SB-apQ"/>
<outlet property="blocklistLabel" destination="jQa-vx-tCW" id="m54-NJ-dpu"/>
<outlet property="blockListLabel" destination="jQa-vx-tCW" id="m54-NJ-dpu"/>
<outlet property="destroyAccountButton" destination="4Mk-ly-6fq" id="6Xj-Rb-kfF"/>
<outlet property="inviteLabel" destination="9FD-M0-WLe" id="TfU-b4-OtN"/>
<outlet property="linkedDevicesLabel" destination="hrc-lZ-NeA" id="VkD-E5-2kW"/>
@ -1181,7 +1181,7 @@
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="cZ7-de-SUi" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" translucent="NO" id="gzw-fh-en2">
<navigationBar key="navigationBar" contentMode="scaleToFill" translucent="NO" id="gzw-fh-en2">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.082137122750282288" green="0.46843802928924561" blue="0.91112053394317627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -1306,11 +1306,11 @@
<viewControllerLayoutGuide type="bottom" id="kH6-9L-pzh"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="P0X-AM-Yjw">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ukg-om-VX3" userLabel="Group Details">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<rect key="frame" x="0.0" y="20" width="375" height="100"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ul8-NY-i4c">
<rect key="frame" x="8" y="20" width="60" height="60"/>
@ -1345,7 +1345,7 @@
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsMultipleSelection="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="cFo-AT-Srf">
<rect key="frame" x="0.0" y="108" width="375" height="495"/>
<rect key="frame" x="0.0" y="128" width="375" height="539"/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="ekO-kw-iHV" userLabel="Header View">
<rect key="frame" x="0.0" y="0.0" width="375" height="40"/>

View file

@ -83,8 +83,9 @@ NSString * const kAddToBlockListViewControllerCellIdentifier = @"kAddToBlockList
_countryNameButton.titleLabel.font = [UIFont ows_mediumFontWithSize:16.f];
[_countryNameButton setTitleColor:[UIColor blackColor]
forState:UIControlStateNormal];
[_countryNameButton setTitle:NSLocalizedString(@"REGISTRATION_DEFAULT_COUNTRY_NAME", @"")
forState:UIControlStateNormal];
[_countryNameButton
setTitle:NSLocalizedString(@"REGISTRATION_DEFAULT_COUNTRY_NAME", @"Label for the country code field")
forState:UIControlStateNormal];
[_countryNameButton addTarget:self
action:@selector(showCountryCodeView:)
forControlEvents:UIControlEventTouchUpInside];
@ -116,7 +117,8 @@ NSString * const kAddToBlockListViewControllerCellIdentifier = @"kAddToBlockList
UILabel *phoneNumberLabel = [UILabel new];
phoneNumberLabel.font = [UIFont ows_mediumFontWithSize:16.f];
phoneNumberLabel.textColor = [UIColor blackColor];
phoneNumberLabel.text = NSLocalizedString(@"REGISTRATION_PHONENUMBER_BUTTON", @"");
phoneNumberLabel.text
= NSLocalizedString(@"REGISTRATION_PHONENUMBER_BUTTON", @"Label for the phone number textfield");
[phoneNumberRow addSubview:phoneNumberLabel];
[phoneNumberLabel autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:20.f];
[phoneNumberLabel autoVCenterInSuperview];
@ -125,7 +127,8 @@ NSString * const kAddToBlockListViewControllerCellIdentifier = @"kAddToBlockList
_phoneNumberTextField.font = [UIFont ows_mediumFontWithSize:16.f];
_phoneNumberTextField.textAlignment = NSTextAlignmentRight;
_phoneNumberTextField.textColor = [UIColor ows_signalBrandBlueColor];
_phoneNumberTextField.placeholder = NSLocalizedString(@"REGISTRATION_ENTERNUMBER_DEFAULT_TEXT", @"");
_phoneNumberTextField.placeholder = NSLocalizedString(
@"REGISTRATION_ENTERNUMBER_DEFAULT_TEXT", @"Placeholder text for the phone number textfield");
_phoneNumberTextField.keyboardType = UIKeyboardTypeNumberPad;
_phoneNumberTextField.delegate = self;
[_phoneNumberTextField addTarget:self
@ -206,7 +209,7 @@ NSString * const kAddToBlockListViewControllerCellIdentifier = @"kAddToBlockList
[_countryCodeButton layoutSubviews];
}
- (void)setcallingCode:(NSString *)callingCode
- (void)setCallingCode:(NSString *)callingCode
{
_callingCode = callingCode;
@ -233,6 +236,7 @@ NSString * const kAddToBlockListViewControllerCellIdentifier = @"kAddToBlockList
- (void)tryToBlockPhoneNumber
{
if (![self hasValidPhoneNumber]) {
OWSAssert(0);
return;
}
@ -248,8 +252,7 @@ NSString * const kAddToBlockListViewControllerCellIdentifier = @"kAddToBlockList
message:[NSString
stringWithFormat:NSLocalizedString(@"BLOCK_LIST_VIEW_BLOCKED_ALERT_MESSAGE_FORMAT",
@"The message format of the 'phone number blocked' alert in "
@"the block view. It is populated with the blocked phone "
@"number."),
@"the block view. Embeds {{the blocked phone number}}."),
[parsedPhoneNumber toE164]]
preferredStyle:UIAlertControllerStyleAlert];

View file

@ -10,8 +10,6 @@
NS_ASSUME_NONNULL_BEGIN
NSString * const kBlockListViewControllerCellIdentifier = @"kBlockListViewControllerCellIdentifier";
// TODO: We should label phone numbers with contact names where possible.
@interface BlockListViewController ()
@ -42,10 +40,8 @@ typedef NS_ENUM(NSInteger, BlockListViewControllerSection) {
_blockingManager = [OWSBlockingManager sharedManager];
_blockedPhoneNumbers = [_blockingManager blockedPhoneNumbers];
self.title = NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE", @"");
[self.tableView registerClass:[UITableViewCell class]
forCellReuseIdentifier:kBlockListViewControllerCellIdentifier];
self.title
= NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE", @"Label for the block list section of the settings view");
[self addNotificationListeners];
}
@ -102,7 +98,7 @@ typedef NS_ENUM(NSInteger, BlockListViewControllerSection) {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kBlockListViewControllerCellIdentifier];
UITableViewCell *cell = [UITableViewCell new];
OWSAssert(cell);
switch (indexPath.section) {

View file

@ -4,6 +4,8 @@
#import "OWSTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class TSThread;
@interface DebugUITableViewController : OWSTableViewController
@ -12,3 +14,5 @@
fromViewController:(UIViewController *)fromViewController;
@end
NS_ASSUME_NONNULL_END

View file

@ -4,6 +4,8 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class OWSTableItem;
@class OWSTableSection;
@ -19,10 +21,9 @@
@interface OWSTableSection : NSObject
@property (nonatomic) NSString *title;
@property (nonatomic, nullable) NSString *title;
+ (OWSTableSection *)sectionWithTitle:(NSString *)title
items:(NSArray *)items;
+ (OWSTableSection *)sectionWithTitle:(NSString *)title items:(NSArray<OWSTableItem *> *)items;
- (void)addItem:(OWSTableItem *)item;
@ -54,3 +55,5 @@ typedef void (^OWSTableActionBlock)();
- (void)presentFromViewController:(UIViewController *)fromViewController;
@end
NS_ASSUME_NONNULL_END

View file

@ -3,8 +3,6 @@
//
#import "OWSTableViewController.h"
//#import "Environment.h"
//#import "Signal-Swift.h"
NS_ASSUME_NONNULL_BEGIN
@ -18,14 +16,16 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSTableContents
-(instancetype)init {
- (instancetype)init
{
if (self = [super init]) {
_sections = [NSMutableArray new];
}
return self;
}
- (void)addSection:(OWSTableSection *)section {
- (void)addSection:(OWSTableSection *)section
{
OWSAssert(section);
[_sections addObject:section];
@ -45,28 +45,26 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSTableSection
+ (OWSTableSection *)sectionWithTitle:(NSString *)title
items:(NSArray *)items {
+ (OWSTableSection *)sectionWithTitle:(NSString *)title items:(NSArray<OWSTableItem *> *)items
{
OWSTableSection *section = [OWSTableSection new];
section.title = title;
section.items = [items mutableCopy];
return section;
}
-(instancetype)init {
- (instancetype)init
{
if (self = [super init]) {
_items = [NSMutableArray new];
}
return self;
}
- (void)addItem:(OWSTableItem *)item {
- (void)addItem:(OWSTableItem *)item
{
OWSAssert(item);
if (!_items) {
_items = [NSMutableArray new];
}
[_items addObject:item];
}
@ -77,8 +75,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSTableItem ()
@property (nonatomic) OWSTableItemType itemType;
@property (nonatomic) NSString *title;
@property (nonatomic) OWSTableActionBlock actionBlock;
@property (nonatomic, nullable) NSString *title;
@property (nonatomic, nullable) OWSTableActionBlock actionBlock;
@end
@ -86,8 +84,8 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSTableItem
+ (OWSTableItem *)actionWithTitle:(NSString *)title
actionBlock:(OWSTableActionBlock)actionBlock {
+ (OWSTableItem *)actionWithTitle:(NSString *)title actionBlock:(OWSTableActionBlock)actionBlock
{
OWSAssert(title.length > 0);
OWSTableItem *item = [OWSTableItem new];
@ -105,7 +103,8 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
@implementation OWSTableViewController
- (void)viewDidLoad {
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController.navigationBar setTranslucent:NO];
}
@ -150,14 +149,16 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
OWSAssert(self.contents);
OWSAssert(self.contents.sections.count > 0);
return (NSInteger) self.contents.sections.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sectionIndex {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sectionIndex
{
OWSTableSection *section = [self sectionForIndex:sectionIndex];
OWSAssert(section.items.count > 0);
return (NSInteger) section.items.count;
@ -180,7 +181,8 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
OWSTableItem *item = [self itemForIndexPath:indexPath];
@ -204,7 +206,8 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
#pragma mark - Presentation
- (void)presentFromViewController:(UIViewController *)fromViewController {
- (void)presentFromViewController:(UIViewController *)fromViewController
{
OWSAssert(fromViewController);
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self];
@ -217,7 +220,8 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
completion:nil];
}
- (void)donePressed:(id)sender {
- (void)donePressed:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}

View file

@ -35,11 +35,14 @@ static NSString *const kCodeSentSegue = @"codeSent";
[[Environment getCurrent] setSignUpFlowNavigationController:self.navigationController];
_titleLabel.text = NSLocalizedString(@"REGISTRATION_TITLE_LABEL", @"");
[_countryNameButton setTitle:NSLocalizedString(@"REGISTRATION_DEFAULT_COUNTRY_NAME", @"")
forState:UIControlStateNormal];
_phoneNumberTextField.placeholder = NSLocalizedString(@"REGISTRATION_ENTERNUMBER_DEFAULT_TEXT", @"");
[_phoneNumberButton setTitle:NSLocalizedString(@"REGISTRATION_PHONENUMBER_BUTTON", @"")
forState:UIControlStateNormal];
[_countryNameButton
setTitle:NSLocalizedString(@"REGISTRATION_DEFAULT_COUNTRY_NAME", @"Label for the country code field")
forState:UIControlStateNormal];
_phoneNumberTextField.placeholder = NSLocalizedString(
@"REGISTRATION_ENTERNUMBER_DEFAULT_TEXT", @"Placeholder text for the phone number textfield");
[_phoneNumberButton
setTitle:NSLocalizedString(@"REGISTRATION_PHONENUMBER_BUTTON", @"Label for the phone number textfield")
forState:UIControlStateNormal];
[_phoneNumberButton.titleLabel setAdjustsFontSizeToFitWidth:YES];
[_sendCodeButton setTitle:NSLocalizedString(@"REGISTRATION_VERIFY_DEVICE", @"") forState:UIControlStateNormal];
[_existingUserButton setTitle:NSLocalizedString(@"ALREADY_HAVE_ACCOUNT_BUTTON", @"registration button text")

View file

@ -1,9 +1,5 @@
//
// SettingsTableViewController.h
// Signal
//
// Created by Dylan Bourgeois on 03/11/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import <UIKit/UIKit.h>
@ -19,7 +15,7 @@
@property (strong, nonatomic) IBOutlet UILabel *linkedDevicesLabel;
@property (strong, nonatomic) IBOutlet UILabel *advancedLabel;
@property (strong, nonatomic) IBOutlet UILabel *aboutLabel;
@property (strong, nonatomic) IBOutlet UILabel *blocklistLabel;
@property (strong, nonatomic) IBOutlet UILabel *blockListLabel;
@property (strong, nonatomic) IBOutlet UILabel *inviteLabel;
@property (strong, nonatomic) IBOutlet UIButton *destroyAccountButton;

View file

@ -107,7 +107,8 @@ typedef enum {
self.linkedDevicesLabel.text
= NSLocalizedString(@"LINKED_DEVICES_TITLE", @"Menu item and navbar title for the device manager");
self.inviteLabel.text = NSLocalizedString(@"SETTINGS_INVITE_TITLE", @"Settings table view cell label");
self.blocklistLabel.text = NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE", @"Label for the block list row of the settings view");
self.blockListLabel.text
= NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE", @"Label for the block list section of the settings view");
[self.destroyAccountButton setTitle:NSLocalizedString(@"SETTINGS_DELETE_ACCOUNT_BUTTON", @"")
forState:UIControlStateNormal];

View file

@ -8,8 +8,9 @@
- (instancetype)init NS_UNAVAILABLE;
// This convenience function can be used to reformat a phone number
// text field as the types, pastes, etc.
// This convenience function can be used to reformat the contents of
// a phone number text field as the user modifies its text by typing,
// pasting, etc.
+ (void)phoneNumberTextField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)insertionText