Merge branch 'charlesmchen/registrationView'

pull/1/head
Matthew Chen 9 years ago
commit ed0340fe66

@ -233,7 +233,6 @@
A1C32D5017A06538000A904E /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4F17A06537000A904E /* AddressBookUI.framework */; }; A1C32D5017A06538000A904E /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4F17A06537000A904E /* AddressBookUI.framework */; };
A1C32D5117A06544000A904E /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4D17A0652C000A904E /* AddressBook.framework */; }; A1C32D5117A06544000A904E /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4D17A0652C000A904E /* AddressBook.framework */; };
A5509ECA1A69AB8B00ABA4BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A5509EC91A69AB8B00ABA4BC /* Main.storyboard */; }; A5509ECA1A69AB8B00ABA4BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A5509EC91A69AB8B00ABA4BC /* Main.storyboard */; };
A5509ECD1A69B1D600ABA4BC /* CountryCodeTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A5509ECC1A69B1D600ABA4BC /* CountryCodeTableViewCell.m */; };
A5E9D4BB1A65FAD800E4481C /* TSVideoAttachmentAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = A5E9D4B91A65FAD800E4481C /* TSVideoAttachmentAdapter.m */; }; A5E9D4BB1A65FAD800E4481C /* TSVideoAttachmentAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = A5E9D4B91A65FAD800E4481C /* TSVideoAttachmentAdapter.m */; };
AD41D7B51A6F6F0600241130 /* play_button.png in Resources */ = {isa = PBXBuildFile; fileRef = AD41D7B31A6F6F0600241130 /* play_button.png */; }; AD41D7B51A6F6F0600241130 /* play_button.png in Resources */ = {isa = PBXBuildFile; fileRef = AD41D7B31A6F6F0600241130 /* play_button.png */; };
AD41D7B61A6F6F0600241130 /* play_button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AD41D7B41A6F6F0600241130 /* play_button@2x.png */; }; AD41D7B61A6F6F0600241130 /* play_button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AD41D7B41A6F6F0600241130 /* play_button@2x.png */; };
@ -650,8 +649,6 @@
A1C32D4F17A06537000A904E /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; A1C32D4F17A06537000A904E /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
A1FDCBEE16DAA6C300868894 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; A1FDCBEE16DAA6C300868894 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
A5509EC91A69AB8B00ABA4BC /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Storyboard/Main.storyboard; sourceTree = "<group>"; }; A5509EC91A69AB8B00ABA4BC /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Storyboard/Main.storyboard; sourceTree = "<group>"; };
A5509ECB1A69B1D600ABA4BC /* CountryCodeTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountryCodeTableViewCell.h; sourceTree = "<group>"; };
A5509ECC1A69B1D600ABA4BC /* CountryCodeTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountryCodeTableViewCell.m; sourceTree = "<group>"; };
A5E9D4B91A65FAD800E4481C /* TSVideoAttachmentAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSVideoAttachmentAdapter.m; sourceTree = "<group>"; }; A5E9D4B91A65FAD800E4481C /* TSVideoAttachmentAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSVideoAttachmentAdapter.m; sourceTree = "<group>"; };
A5E9D4BA1A65FAD800E4481C /* TSVideoAttachmentAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSVideoAttachmentAdapter.h; sourceTree = "<group>"; }; A5E9D4BA1A65FAD800E4481C /* TSVideoAttachmentAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSVideoAttachmentAdapter.h; sourceTree = "<group>"; };
AD2AB1207E8888E4262D781B /* Pods-SignalTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SignalTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SignalTests/Pods-SignalTests.debug.xcconfig"; sourceTree = "<group>"; }; AD2AB1207E8888E4262D781B /* Pods-SignalTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SignalTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SignalTests/Pods-SignalTests.debug.xcconfig"; sourceTree = "<group>"; };
@ -1328,8 +1325,6 @@
451764281DE939FD00EDB8B9 /* ContactCell.xib */, 451764281DE939FD00EDB8B9 /* ContactCell.xib */,
76EB052E18170B33006006FC /* ContactTableViewCell.h */, 76EB052E18170B33006006FC /* ContactTableViewCell.h */,
76EB052F18170B33006006FC /* ContactTableViewCell.m */, 76EB052F18170B33006006FC /* ContactTableViewCell.m */,
A5509ECB1A69B1D600ABA4BC /* CountryCodeTableViewCell.h */,
A5509ECC1A69B1D600ABA4BC /* CountryCodeTableViewCell.m */,
45B201751DAECBFE00C461E0 /* HighlightableLabel.swift */, 45B201751DAECBFE00C461E0 /* HighlightableLabel.swift */,
4531C9C21DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.h */, 4531C9C21DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.h */,
4531C9C31DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.m */, 4531C9C31DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.m */,
@ -2038,7 +2033,6 @@
34B3F8761E8DF1700035BE1A /* CodeVerificationViewController.m in Sources */, 34B3F8761E8DF1700035BE1A /* CodeVerificationViewController.m in Sources */,
76EB063E18170B33006006FC /* Operation.m in Sources */, 76EB063E18170B33006006FC /* Operation.m in Sources */,
34B3F8741E8DF1700035BE1A /* AttachmentSharing.m in Sources */, 34B3F8741E8DF1700035BE1A /* AttachmentSharing.m in Sources */,
A5509ECD1A69B1D600ABA4BC /* CountryCodeTableViewCell.m in Sources */,
34D8C02B1ED3685800188D7C /* DebugUIContacts.m in Sources */, 34D8C02B1ED3685800188D7C /* DebugUIContacts.m in Sources */,
45C9DEB81DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift in Sources */, 45C9DEB81DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift in Sources */,
34B3F88E1E8DF1700035BE1A /* PrivacySettingsTableViewController.m in Sources */, 34B3F88E1E8DF1700035BE1A /* PrivacySettingsTableViewController.m in Sources */,

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="zqr-Ab-axp"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="zqr-Ab-axp">
<device id="retina4_0" orientation="portrait"> <device id="retina4_0" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/> <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
@ -75,9 +75,6 @@
<color key="titleColor" red="0.054103322330000002" green="0.45790460710000003" blue="0.9261735082" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="titleColor" red="0.054103322330000002" green="0.45790460710000003" blue="0.9261735082" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state> </state>
<connections>
<segue destination="CCL-Zs-hfU" kind="presentation" id="foJ-CL-5wr"/>
</connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pu7-Ia-adg"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pu7-Ia-adg">
<rect key="frame" x="20" y="0.0" width="195" height="60"/> <rect key="frame" x="20" y="0.0" width="195" height="60"/>
@ -89,9 +86,6 @@
<state key="normal" title="Country Code"> <state key="normal" title="Country Code">
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state> </state>
<connections>
<segue destination="CCL-Zs-hfU" kind="presentation" id="uxC-Up-OyM"/>
</connections>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -228,6 +222,7 @@
<nil key="simulatedTopBarMetrics"/> <nil key="simulatedTopBarMetrics"/>
<connections> <connections>
<outlet property="countryCodeButton" destination="aSz-jb-g2o" id="HAe-2D-BxF"/> <outlet property="countryCodeButton" destination="aSz-jb-g2o" id="HAe-2D-BxF"/>
<outlet property="countryCodeRow" destination="ogW-8F-AvT" id="5uE-tH-utQ"/>
<outlet property="countryNameButton" destination="Pu7-Ia-adg" id="PFU-m2-gzV"/> <outlet property="countryNameButton" destination="Pu7-Ia-adg" id="PFU-m2-gzV"/>
<outlet property="existingUserButton" destination="AqN-gc-h3O" id="XQz-rJ-HOP"/> <outlet property="existingUserButton" destination="AqN-gc-h3O" id="XQz-rJ-HOP"/>
<outlet property="headerHeightConstraint" destination="EX0-kF-4ZZ" id="e8J-On-rOg"/> <outlet property="headerHeightConstraint" destination="EX0-kF-4ZZ" id="e8J-On-rOg"/>
@ -244,112 +239,6 @@
</objects> </objects>
<point key="canvasLocation" x="-4663.125" y="-735.21126760563379"/> <point key="canvasLocation" x="-4663.125" y="-735.21126760563379"/>
</scene> </scene>
<!--Navigation Controller-->
<scene sceneID="CXh-B2-B5s">
<objects>
<navigationController id="CCL-Zs-hfU" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="cF0-06-4sO">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.08213712275" green="0.4684380293" blue="0.91112053390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</navigationBar>
<connections>
<segue destination="Z2i-u6-bhY" kind="relationship" relationship="rootViewController" id="MJ5-IX-jSb"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="m2Q-Yk-UFa" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-4663" y="118"/>
</scene>
<!--_2.0_1.0__1 Country Code Modal-->
<scene sceneID="kX2-KQ-Haq">
<objects>
<tableViewController storyboardIdentifier="CountryCodeViewController" id="Z2i-u6-bhY" userLabel="_2.0_1.0__1 Country Code Modal" customClass="CountryCodeViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="HIm-Hc-yjX" userLabel="_1.0__1 Country Code Table">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<searchBar key="tableHeaderView" contentMode="redraw" id="CMs-3a-1tn" userLabel="__1a Search Bar">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<textInputTraits key="textInputTraits"/>
<connections>
<outlet property="delegate" destination="Z2i-u6-bhY" id="vEf-Fh-V9X"/>
</connections>
</searchBar>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CountryCodeTableViewCell" id="LFg-KJ-GnQ" userLabel="__1b Country Code Table" customClass="CountryCodeTableViewCell">
<rect key="frame" x="0.0" y="66" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="LFg-KJ-GnQ" id="o6y-AP-QLT" userLabel="Country Code Table Row">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" tag="1" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="United states" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eyx-0e-8jI">
<rect key="frame" x="20" y="11" width="244" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="244" id="n1j-cy-UCc"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" tag="2" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="+1" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EEE-5L-cqs">
<rect key="frame" x="237" y="12" width="64" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="64" id="Esx-e5-KEm"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<color key="textColor" red="0.4266758859" green="0.42666310070000002" blue="0.42667034269999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="eyx-0e-8jI" firstAttribute="leading" secondItem="o6y-AP-QLT" secondAttribute="leadingMargin" constant="12" id="3e1-Ho-Lkh"/>
<constraint firstAttribute="centerY" secondItem="eyx-0e-8jI" secondAttribute="centerY" id="9tf-zE-uTh"/>
<constraint firstAttribute="trailingMargin" secondItem="EEE-5L-cqs" secondAttribute="trailing" constant="11" id="VWY-K4-mnQ"/>
<constraint firstAttribute="centerY" secondItem="EEE-5L-cqs" secondAttribute="centerY" id="xkZ-7a-4si"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="countryCodeLabel" destination="EEE-5L-cqs" id="l5s-J2-hEb"/>
<outlet property="countryNameLabel" destination="eyx-0e-8jI" id="FVB-VB-L0Y"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="Z2i-u6-bhY" id="rHA-cX-cjx"/>
<outlet property="delegate" destination="Z2i-u6-bhY" id="XPn-SJ-wjB"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Select Country Code" id="Q6t-Dx-qGA" userLabel="_1.0__1c Navigation Bar">
<barButtonItem key="leftBarButtonItem" image="btnCancel--white" id="upu-bg-cQC">
<connections>
<segue destination="dCz-q4-kx5" kind="unwind" unwindAction="unwindToCountryCodeSelectionCancelled:" id="rAG-7g-91h"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="countryCodeTableView" destination="HIm-Hc-yjX" id="SJ0-1f-5bx"/>
<outlet property="searchBar" destination="CMs-3a-1tn" id="OZf-gj-MFu"/>
<outlet property="searchDisplayController" destination="b82-X1-yzZ" id="tc5-Ii-aAN"/>
<segue destination="dCz-q4-kx5" kind="unwind" identifier="UnwindToCountryCodeWasSelectedSegue" unwindAction="unwindToCountryCodeWasSelected:" id="grw-Tg-ALb"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eQ6-CW-FOy" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="dCz-q4-kx5" userLabel="Exit" sceneMemberID="exit"/>
<searchDisplayController id="b82-X1-yzZ">
<connections>
<outlet property="delegate" destination="Z2i-u6-bhY" id="rO2-da-1gE"/>
<outlet property="searchContentsController" destination="Z2i-u6-bhY" id="m7R-H5-bMY"/>
<outlet property="searchResultsDataSource" destination="Z2i-u6-bhY" id="JmH-Rd-hgI"/>
<outlet property="searchResultsDelegate" destination="Z2i-u6-bhY" id="kmD-Pu-fbT"/>
</connections>
</searchDisplayController>
<navigationItem title="Title" id="DLP-7z-aG1"/>
</objects>
<point key="canvasLocation" x="-3780" y="118"/>
</scene>
<!--_1.1 Verification Screen--> <!--_1.1 Verification Screen-->
<scene sceneID="9FI-Mi-3YV"> <scene sceneID="9FI-Mi-3YV">
<objects> <objects>
@ -396,10 +285,6 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="btnCancel--white" width="44" height="44"/>
<image name="logoSignal" width="138" height="139"/> <image name="logoSignal" width="138" height="139"/>
</resources> </resources>
<inferredMetricsTieBreakers>
<segue reference="uxC-Up-OyM"/>
</inferredMetricsTieBreakers>
</document> </document>

@ -2,7 +2,7 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// //
#import <UIKit/UIKit.h> #import "OWSTableViewController.h"
@class CountryCodeViewController; @class CountryCodeViewController;
@ -15,15 +15,10 @@
@end @end
@interface CountryCodeViewController #pragma mark -
: UIViewController <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, UISearchDisplayDelegate>
@property (nonatomic) IBOutlet UITableView *countryCodeTableView; @interface CountryCodeViewController : OWSTableViewController
@property (nonatomic) IBOutlet UISearchBar *searchBar;
@property (nonatomic, weak) id<CountryCodeViewControllerDelegate> delegate; @property (nonatomic, weak) id<CountryCodeViewControllerDelegate> countryCodeDelegate;
@property (nonatomic) NSString *countryCodeSelected;
@property (nonatomic) NSString *callingCodeSelected;
@property (nonatomic) NSString *countryNameSelected;
@property (nonatomic) BOOL shouldDismissWithoutSegue;
@end @end

@ -2,99 +2,159 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// //
#import "CountryCodeTableViewCell.h"
#import "CountryCodeViewController.h" #import "CountryCodeViewController.h"
#import "PhoneNumberUtil.h" #import "PhoneNumberUtil.h"
#import "FunctionalUtil.h" #import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIView+OWS.h"
static NSString *const CONTRY_CODE_TABLE_CELL_IDENTIFIER = @"CountryCodeTableViewCell"; @interface CountryCodeViewController () <OWSTableViewControllerDelegate, UISearchBarDelegate>
static NSString *const kUnwindToCountryCodeWasSelectedSegue = @"UnwindToCountryCodeWasSelectedSegue";
@interface CountryCodeViewController () { @property (nonatomic, readonly) UISearchBar *searchBar;
NSArray *_countryCodes;
} @property (nonatomic) NSArray<NSString *> *countryCodes;
@end @end
#pragma mark -
@implementation CountryCodeViewController @implementation CountryCodeViewController
- (void)viewDidLoad { - (void)loadView
[super viewDidLoad]; {
[super loadView];
self.view.backgroundColor = [UIColor whiteColor];
[self.navigationController.navigationBar setTranslucent:NO]; [self.navigationController.navigationBar setTranslucent:NO];
_countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:nil]; self.title = NSLocalizedString(@"COUNTRYCODE_SELECT_TITLE", @"");
self.title = NSLocalizedString(@"COUNTRYCODE_SELECT_TITLE", @"");
self.searchBar.delegate = self; self.countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:nil];
if (self.shouldDismissWithoutSegue) {
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop self.navigationItem.leftBarButtonItem =
target:self [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
action:@selector(dismissWasPressed:)]; target:self
} action:@selector(dismissWasPressed:)];
[self createViews];
} }
#pragma mark - UITableViewDelegate - (void)createViews
{
// Search
UISearchBar *searchBar = [UISearchBar new];
_searchBar = searchBar;
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = [UIColor whiteColor];
[searchBar sizeToFit];
self.tableView.tableHeaderView = searchBar;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { [self updateTableContents];
return (NSInteger)_countryCodes.count;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { #pragma mark - Table Contents
CountryCodeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CONTRY_CODE_TABLE_CELL_IDENTIFIER];
if (!cell) { - (void)updateTableContents
cell = [[CountryCodeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault {
reuseIdentifier:CONTRY_CODE_TABLE_CELL_IDENTIFIER]; OWSTableContents *contents = [OWSTableContents new];
__weak CountryCodeViewController *weakSelf = self;
OWSTableSection *section = [OWSTableSection new];
for (NSString *countryCode in self.countryCodes) {
OWSAssert(countryCode.length > 0);
OWSAssert([PhoneNumberUtil countryNameFromCountryCode:countryCode].length > 0);
OWSAssert([PhoneNumberUtil callingCodeFromCountryCode:countryCode].length > 0);
OWSAssert(![[PhoneNumberUtil callingCodeFromCountryCode:countryCode] isEqualToString:@"+0"]);
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new];
cell.textLabel.text = [PhoneNumberUtil countryNameFromCountryCode:countryCode];
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.textLabel.textColor = [UIColor blackColor];
UILabel *countryCodeLabel = [UILabel new];
countryCodeLabel.text = [PhoneNumberUtil callingCodeFromCountryCode:countryCode];
countryCodeLabel.font = [UIFont ows_regularFontWithSize:16.f];
countryCodeLabel.textColor = [UIColor ows_darkGrayColor];
[countryCodeLabel sizeToFit];
cell.accessoryView = countryCodeLabel;
return cell;
}
actionBlock:^{
[weakSelf countryCodeWasSelected:countryCode];
}]];
} }
NSString *countryCode = _countryCodes[(NSUInteger)indexPath.row]; [contents addSection:section];
OWSAssert(countryCode.length > 0);
OWSAssert([PhoneNumberUtil countryNameFromCountryCode:countryCode].length > 0);
OWSAssert([PhoneNumberUtil callingCodeFromCountryCode:countryCode].length > 0);
OWSAssert(![[PhoneNumberUtil callingCodeFromCountryCode:countryCode] isEqualToString:@"+0"]);
[cell configureWithCountryCode:[PhoneNumberUtil callingCodeFromCountryCode:countryCode]
andCountryName:[PhoneNumberUtil countryNameFromCountryCode:countryCode]];
return cell; self.contents = contents;
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)countryCodeWasSelected:(NSString *)countryCode
NSString *countryCode = _countryCodes[(NSUInteger)indexPath.row]; {
_callingCodeSelected = [PhoneNumberUtil callingCodeFromCountryCode:countryCode]; OWSAssert(countryCode.length > 0);
_countryNameSelected = [PhoneNumberUtil countryNameFromCountryCode:countryCode];
_countryCodeSelected = countryCode; NSString *callingCodeSelected = [PhoneNumberUtil callingCodeFromCountryCode:countryCode];
[self.delegate countryCodeViewController:self NSString *countryNameSelected = [PhoneNumberUtil countryNameFromCountryCode:countryCode];
didSelectCountryCode:_countryCodeSelected NSString *countryCodeSelected = countryCode;
countryName:_countryNameSelected [self.countryCodeDelegate countryCodeViewController:self
callingCode:_callingCodeSelected]; didSelectCountryCode:countryCodeSelected
countryName:countryNameSelected
callingCode:callingCodeSelected];
[self.searchBar resignFirstResponder]; [self.searchBar resignFirstResponder];
if (self.shouldDismissWithoutSegue) { [self dismissViewControllerAnimated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];
} else {
[self performSegueWithIdentifier:kUnwindToCountryCodeWasSelectedSegue sender:self];
}
} }
- (void)dismissWasPressed:(id)sender { - (void)dismissWasPressed:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44.0f;
}
#pragma mark - UISearchBarDelegate #pragma mark - UISearchBarDelegate
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
_countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:searchText]; {
[self.countryCodeTableView reloadData]; [self searchTextDidChange];
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
[self searchTextDidChange];
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
[self searchTextDidChange];
} }
- (void)filterContentForSearchText:(NSString *)searchText scope:(NSString *)scope { - (void)searchBarResultsListButtonClicked:(UISearchBar *)searchBar
_countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:searchText]; {
[self searchTextDidChange];
}
- (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope
{
[self searchTextDidChange];
}
- (void)searchTextDidChange
{
NSString *searchText =
[self.searchBar.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
self.countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:searchText];
[self updateTableContents];
} }
#pragma mark - UIScrollViewDelegate #pragma mark - OWSTableViewControllerDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - (void)tableViewDidScroll
{
[self.searchBar resignFirstResponder]; [self.searchBar resignFirstResponder];
} }

@ -1,9 +1,5 @@
// //
// RegistrationViewController.h // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Signal
//
// Created by Dylan Bourgeois on 13/11/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@ -13,24 +9,22 @@
@interface RegistrationViewController : UIViewController <UITextFieldDelegate> @interface RegistrationViewController : UIViewController <UITextFieldDelegate>
// Country code // Country code
@property (nonatomic, strong) IBOutlet UIButton *countryNameButton; @property (nonatomic) IBOutlet UIButton *countryNameButton;
@property (nonatomic, strong) IBOutlet UIButton *countryCodeButton; @property (nonatomic) IBOutlet UIButton *countryCodeButton;
@property (nonatomic) IBOutlet UIView *countryCodeRow;
// Phone number // Phone number
@property (nonatomic, strong) IBOutlet UITextField *phoneNumberTextField; @property (nonatomic) IBOutlet UITextField *phoneNumberTextField;
@property (nonatomic, strong) IBOutlet UIButton *phoneNumberButton; @property (nonatomic) IBOutlet UIButton *phoneNumberButton;
@property (nonatomic, strong) IBOutlet UILabel *titleLabel; @property (nonatomic) IBOutlet UILabel *titleLabel;
// Button // Button
@property (nonatomic, strong) IBOutlet UIButton *sendCodeButton; @property (nonatomic) IBOutlet UIButton *sendCodeButton;
@property (nonatomic, strong) IBOutlet UIButton *existingUserButton; @property (nonatomic) IBOutlet UIButton *existingUserButton;
@property (nonatomic, strong) IBOutlet UIActivityIndicatorView *spinnerView; @property (nonatomic) IBOutlet UIActivityIndicatorView *spinnerView;
@property (nonatomic) IBOutlet UIImageView *signalLogo; @property (nonatomic) IBOutlet UIImageView *signalLogo;
@property (nonatomic) IBOutlet UIView *registrationHeader; @property (nonatomic) IBOutlet UIView *registrationHeader;
@property (nonatomic) IBOutlet NSLayoutConstraint *headerHeightConstraint; @property (nonatomic) IBOutlet NSLayoutConstraint *headerHeightConstraint;
- (IBAction)unwindToCountryCodeWasSelected:(UIStoryboardSegue *)segue;
- (IBAction)unwindToCountryCodeSelectionCancelled:(UIStoryboardSegue *)segue;
@end @end

@ -16,7 +16,7 @@
static NSString *const kCodeSentSegue = @"codeSent"; static NSString *const kCodeSentSegue = @"codeSent";
@interface RegistrationViewController () @interface RegistrationViewController () <CountryCodeViewControllerDelegate>
@property (nonatomic) NSString *callingCode; @property (nonatomic) NSString *callingCode;
@ -48,6 +48,16 @@ static NSString *const kCodeSentSegue = @"codeSent";
[_sendCodeButton setTitle:NSLocalizedString(@"REGISTRATION_VERIFY_DEVICE", @"") forState:UIControlStateNormal]; [_sendCodeButton setTitle:NSLocalizedString(@"REGISTRATION_VERIFY_DEVICE", @"") forState:UIControlStateNormal];
[_existingUserButton setTitle:NSLocalizedString(@"ALREADY_HAVE_ACCOUNT_BUTTON", @"registration button text") [_existingUserButton setTitle:NSLocalizedString(@"ALREADY_HAVE_ACCOUNT_BUTTON", @"registration button text")
forState:UIControlStateNormal]; forState:UIControlStateNormal];
[self.countryNameButton addTarget:self
action:@selector(changeCountryCodeTapped)
forControlEvents:UIControlEventTouchUpInside];
[self.countryCodeButton addTarget:self
action:@selector(changeCountryCodeTapped)
forControlEvents:UIControlEventTouchUpInside];
[self.countryCodeRow
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(countryCodeRowWasTapped:)]];
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
@ -175,9 +185,20 @@ static NSString *const kCodeSentSegue = @"codeSent";
smsVerification:YES]; smsVerification:YES];
} }
- (IBAction)changeCountryCodeTapped { - (void)countryCodeRowWasTapped:(UIGestureRecognizer *)sender
{
if (sender.state == UIGestureRecognizerStateRecognized) {
[self changeCountryCodeTapped];
}
}
- (void)changeCountryCodeTapped
{
CountryCodeViewController *countryCodeController = [CountryCodeViewController new]; CountryCodeViewController *countryCodeController = [CountryCodeViewController new];
[self presentViewController:countryCodeController animated:YES completion:[UIUtil modalCompletionBlock]]; countryCodeController.countryCodeDelegate = self;
UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:countryCodeController];
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]];
} }
- (void)presentInvalidCountryCodeError { - (void)presentInvalidCountryCodeError {
@ -187,6 +208,23 @@ static NSString *const kCodeSentSegue = @"codeSent";
@"DISMISS_BUTTON_TEXT", @"Generic short text for button to dismiss a dialog")]; @"DISMISS_BUTTON_TEXT", @"Generic short text for button to dismiss a dialog")];
} }
#pragma mark - CountryCodeViewControllerDelegate
- (void)countryCodeViewController:(CountryCodeViewController *)vc
didSelectCountryCode:(NSString *)countryCode
countryName:(NSString *)countryName
callingCode:(NSString *)callingCode
{
OWSAssert(countryCode.length > 0);
OWSAssert(countryName.length > 0);
OWSAssert(callingCode.length > 0);
[self updateCountryWithName:countryName callingCode:callingCode countryCode:countryCode];
// Trigger the formatting logic with a no-op edit.
[self textField:self.phoneNumberTextField shouldChangeCharactersInRange:NSMakeRange(0, 0) replacementString:@""];
}
#pragma mark - Keyboard notifications #pragma mark - Keyboard notifications
- (void)initializeKeyboardHandlers { - (void)initializeKeyboardHandlers {
@ -224,19 +262,6 @@ static NSString *const kCodeSentSegue = @"codeSent";
- (IBAction)unwindToChangeNumber:(UIStoryboardSegue *)sender { - (IBAction)unwindToChangeNumber:(UIStoryboardSegue *)sender {
} }
- (IBAction)unwindToCountryCodeSelectionCancelled:(UIStoryboardSegue *)segue {
}
- (IBAction)unwindToCountryCodeWasSelected:(UIStoryboardSegue *)segue {
CountryCodeViewController *vc = [segue sourceViewController];
[self updateCountryWithName:vc.countryNameSelected
callingCode:vc.callingCodeSelected
countryCode:vc.countryCodeSelected];
// Reformat phone number
[self textField:_phoneNumberTextField shouldChangeCharactersInRange:NSMakeRange(0, 0) replacementString:@""];
}
#pragma mark iPhone 5s or shorter #pragma mark iPhone 5s or shorter
- (void)adjustScreenSizes - (void)adjustScreenSizes

@ -284,10 +284,8 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
- (void)showCountryCodeView:(nullable id)sender - (void)showCountryCodeView:(nullable id)sender
{ {
CountryCodeViewController *countryCodeController = [[UIStoryboard storyboardWithName:@"Registration" bundle:NULL] CountryCodeViewController *countryCodeController = [CountryCodeViewController new];
instantiateViewControllerWithIdentifier:@"CountryCodeViewController"]; countryCodeController.countryCodeDelegate = self;
countryCodeController.delegate = self;
countryCodeController.shouldDismissWithoutSegue = YES;
UINavigationController *navigationController = UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:countryCodeController]; [[UINavigationController alloc] initWithRootViewController:countryCodeController];
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]]; [self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]];
@ -416,6 +414,9 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
countryName:(NSString *)countryName countryName:(NSString *)countryName
callingCode:(NSString *)callingCode callingCode:(NSString *)callingCode
{ {
OWSAssert(countryCode.length > 0);
OWSAssert(countryName.length > 0);
OWSAssert(callingCode.length > 0);
[self updateCountryWithName:countryName callingCode:callingCode countryCode:countryCode]; [self updateCountryWithName:countryName callingCode:callingCode countryCode:countryCode];

@ -1,10 +0,0 @@
#import <UIKit/UIKit.h>
@interface CountryCodeTableViewCell : UITableViewCell
@property (nonatomic, strong) IBOutlet UILabel *countryCodeLabel;
@property (nonatomic, strong) IBOutlet UILabel *countryNameLabel;
- (void)configureWithCountryCode:(NSString *)code andCountryName:(NSString *)name;
@end

@ -1,19 +0,0 @@
#import "CountryCodeTableViewCell.h"
@implementation CountryCodeTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
return self;
}
- (NSString *)reuseIdentifier {
return NSStringFromClass(self.class);
}
- (void)configureWithCountryCode:(NSString *)code andCountryName:(NSString *)name {
_countryCodeLabel.text = code;
_countryNameLabel.text = name;
}
@end
Loading…
Cancel
Save