parent
ea9dc3fe77
commit
867eb7d741
|
@ -233,7 +233,6 @@
|
|||
A1C32D5017A06538000A904E /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4F17A06537000A904E /* AddressBookUI.framework */; };
|
||||
A1C32D5117A06544000A904E /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4D17A0652C000A904E /* AddressBook.framework */; };
|
||||
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 */; };
|
||||
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 */; };
|
||||
|
@ -650,8 +649,6 @@
|
|||
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; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -1328,8 +1325,6 @@
|
|||
451764281DE939FD00EDB8B9 /* ContactCell.xib */,
|
||||
76EB052E18170B33006006FC /* ContactTableViewCell.h */,
|
||||
76EB052F18170B33006006FC /* ContactTableViewCell.m */,
|
||||
A5509ECB1A69B1D600ABA4BC /* CountryCodeTableViewCell.h */,
|
||||
A5509ECC1A69B1D600ABA4BC /* CountryCodeTableViewCell.m */,
|
||||
45B201751DAECBFE00C461E0 /* HighlightableLabel.swift */,
|
||||
4531C9C21DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.h */,
|
||||
4531C9C31DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.m */,
|
||||
|
@ -2038,7 +2033,6 @@
|
|||
34B3F8761E8DF1700035BE1A /* CodeVerificationViewController.m in Sources */,
|
||||
76EB063E18170B33006006FC /* Operation.m in Sources */,
|
||||
34B3F8741E8DF1700035BE1A /* AttachmentSharing.m in Sources */,
|
||||
A5509ECD1A69B1D600ABA4BC /* CountryCodeTableViewCell.m in Sources */,
|
||||
34D8C02B1ED3685800188D7C /* DebugUIContacts.m in Sources */,
|
||||
45C9DEB81DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift in Sources */,
|
||||
34B3F88E1E8DF1700035BE1A /* PrivacySettingsTableViewController.m in Sources */,
|
||||
|
|
|
@ -239,112 +239,6 @@
|
|||
</objects>
|
||||
<point key="canvasLocation" x="-4663.125" y="-735.21126760563379"/>
|
||||
</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.5"/>
|
||||
<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-->
|
||||
<scene sceneID="9FI-Mi-3YV">
|
||||
<objects>
|
||||
|
@ -391,7 +285,6 @@
|
|||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="btnCancel--white" width="44" height="44"/>
|
||||
<image name="logoSignal" width="138" height="139"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "OWSTableViewController.h"
|
||||
|
||||
@class CountryCodeViewController;
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
|||
|
||||
#pragma mark -
|
||||
|
||||
@interface CountryCodeViewController : UIViewController
|
||||
@interface CountryCodeViewController : OWSTableViewController
|
||||
|
||||
@property (nonatomic, weak) id<CountryCodeViewControllerDelegate> delegate;
|
||||
@property (nonatomic, weak) id<CountryCodeViewControllerDelegate> countryCodeDelegate;
|
||||
|
||||
@end
|
||||
|
|
|
@ -3,80 +3,108 @@
|
|||
//
|
||||
|
||||
#import "CountryCodeViewController.h"
|
||||
#import "CountryCodeTableViewCell.h"
|
||||
#import "FunctionalUtil.h"
|
||||
#import "PhoneNumberUtil.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>
|
||||
|
||||
@interface CountryCodeViewController () <UITableViewDelegate,
|
||||
UITableViewDataSource,
|
||||
UISearchBarDelegate,
|
||||
UISearchDisplayDelegate> {
|
||||
NSArray *_countryCodes;
|
||||
}
|
||||
@property (nonatomic, readonly) UISearchBar *searchBar;
|
||||
|
||||
@property (nonatomic) IBOutlet UITableView *countryCodeTableView;
|
||||
@property (nonatomic) IBOutlet UISearchBar *searchBar;
|
||||
|
||||
@property (nonatomic) NSString *countryCodeSelected;
|
||||
@property (nonatomic) NSString *callingCodeSelected;
|
||||
@property (nonatomic) NSString *countryNameSelected;
|
||||
@property (nonatomic) NSArray<NSString *> *countryCodes;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation CountryCodeViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
[self.view addRedBorder];
|
||||
[self.navigationController.navigationBar setTranslucent:NO];
|
||||
_countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:nil];
|
||||
self.title = NSLocalizedString(@"COUNTRYCODE_SELECT_TITLE", @"");
|
||||
self.searchBar.delegate = self;
|
||||
self.title = NSLocalizedString(@"COUNTRYCODE_SELECT_TITLE", @"");
|
||||
|
||||
self.countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:nil];
|
||||
|
||||
self.navigationItem.leftBarButtonItem =
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
|
||||
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];
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return (NSInteger)_countryCodes.count;
|
||||
self.tableView.tableHeaderView = searchBar;
|
||||
|
||||
[self updateTableContents];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
CountryCodeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CONTRY_CODE_TABLE_CELL_IDENTIFIER];
|
||||
if (!cell) {
|
||||
cell = [[CountryCodeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:CONTRY_CODE_TABLE_CELL_IDENTIFIER];
|
||||
#pragma mark - Table Contents
|
||||
|
||||
- (void)updateTableContents
|
||||
{
|
||||
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];
|
||||
OWSAssert(countryCode.length > 0);
|
||||
OWSAssert([PhoneNumberUtil countryNameFromCountryCode:countryCode].length > 0);
|
||||
OWSAssert([PhoneNumberUtil callingCodeFromCountryCode:countryCode].length > 0);
|
||||
OWSAssert(![[PhoneNumberUtil callingCodeFromCountryCode:countryCode] isEqualToString:@"+0"]);
|
||||
[contents addSection:section];
|
||||
|
||||
[cell configureWithCountryCode:[PhoneNumberUtil callingCodeFromCountryCode:countryCode]
|
||||
andCountryName:[PhoneNumberUtil countryNameFromCountryCode:countryCode]];
|
||||
|
||||
return cell;
|
||||
self.contents = contents;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
NSString *countryCode = _countryCodes[(NSUInteger)indexPath.row];
|
||||
_callingCodeSelected = [PhoneNumberUtil callingCodeFromCountryCode:countryCode];
|
||||
_countryNameSelected = [PhoneNumberUtil countryNameFromCountryCode:countryCode];
|
||||
_countryCodeSelected = countryCode;
|
||||
[self.delegate countryCodeViewController:self
|
||||
didSelectCountryCode:_countryCodeSelected
|
||||
countryName:_countryNameSelected
|
||||
callingCode:_callingCodeSelected];
|
||||
- (void)countryCodeWasSelected:(NSString *)countryCode
|
||||
{
|
||||
OWSAssert(countryCode.length > 0);
|
||||
|
||||
NSString *callingCodeSelected = [PhoneNumberUtil callingCodeFromCountryCode:countryCode];
|
||||
NSString *countryNameSelected = [PhoneNumberUtil countryNameFromCountryCode:countryCode];
|
||||
NSString *countryCodeSelected = countryCode;
|
||||
[self.countryCodeDelegate countryCodeViewController:self
|
||||
didSelectCountryCode:countryCodeSelected
|
||||
countryName:countryNameSelected
|
||||
callingCode:callingCodeSelected];
|
||||
[self.searchBar resignFirstResponder];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
@ -85,24 +113,48 @@ static NSString *const CONTRY_CODE_TABLE_CELL_IDENTIFIER = @"CountryCodeTable
|
|||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 44.0f;
|
||||
}
|
||||
|
||||
#pragma mark - UISearchBarDelegate
|
||||
|
||||
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
|
||||
_countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:searchText];
|
||||
[self.countryCodeTableView reloadData];
|
||||
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
|
||||
{
|
||||
[self searchTextDidChange];
|
||||
}
|
||||
|
||||
- (void)filterContentForSearchText:(NSString *)searchText scope:(NSString *)scope {
|
||||
_countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:searchText];
|
||||
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
|
||||
{
|
||||
[self searchTextDidChange];
|
||||
}
|
||||
|
||||
#pragma mark - UIScrollViewDelegate
|
||||
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
|
||||
{
|
||||
[self searchTextDidChange];
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
- (void)searchBarResultsListButtonClicked:(UISearchBar *)searchBar
|
||||
{
|
||||
[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 - OWSTableViewControllerDelegate
|
||||
|
||||
- (void)tableViewDidScroll
|
||||
{
|
||||
[self.searchBar resignFirstResponder];
|
||||
}
|
||||
|
||||
|
|
|
@ -194,9 +194,8 @@ static NSString *const kCodeSentSegue = @"codeSent";
|
|||
|
||||
- (void)changeCountryCodeTapped
|
||||
{
|
||||
CountryCodeViewController *countryCodeController = [[UIStoryboard storyboardWithName:@"Registration" bundle:NULL]
|
||||
instantiateViewControllerWithIdentifier:@"CountryCodeViewController"];
|
||||
countryCodeController.delegate = self;
|
||||
CountryCodeViewController *countryCodeController = [CountryCodeViewController new];
|
||||
countryCodeController.countryCodeDelegate = self;
|
||||
UINavigationController *navigationController =
|
||||
[[UINavigationController alloc] initWithRootViewController:countryCodeController];
|
||||
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]];
|
||||
|
|
|
@ -284,9 +284,8 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
|
|||
|
||||
- (void)showCountryCodeView:(nullable id)sender
|
||||
{
|
||||
CountryCodeViewController *countryCodeController = [[UIStoryboard storyboardWithName:@"Registration" bundle:NULL]
|
||||
instantiateViewControllerWithIdentifier:@"CountryCodeViewController"];
|
||||
countryCodeController.delegate = self;
|
||||
CountryCodeViewController *countryCodeController = [CountryCodeViewController new];
|
||||
countryCodeController.countryCodeDelegate = self;
|
||||
UINavigationController *navigationController =
|
||||
[[UINavigationController alloc] initWithRootViewController:countryCodeController];
|
||||
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]];
|
||||
|
|
|
@ -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…
Reference in New Issue