Sketch out the 'onboarding phone number' view.

pull/2/head
Matthew Chen 6 years ago
parent 2a4b9426c3
commit b658866319

@ -21,25 +21,6 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
private let phoneNumberTextField = UITextField()
private var nextButton: OWSFlatButton?
// - (void)didTapLegalTerms:(UIButton *)sender
//{
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kLegalTermsUrlString]];
// }
//#pragma mark - Keyboard notifications
//
//- (void)initializeKeyboardHandlers
//{
// UITapGestureRecognizer *outsideTabRecognizer =
// [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboardFromAppropriateSubView)];
// [self.view addGestureRecognizer:outsideTabRecognizer];
// }
//
// - (void)dismissKeyboardFromAppropriateSubView
// {
// [self.view endEditing:NO];
//}
//
override public func loadView() {
super.loadView()
@ -62,8 +43,6 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
// Country
// TODO: dynamic
let fontSizePoints: CGFloat = ScaleFromIPhone5To7Plus(16, 20)
let rowHeight: CGFloat = 40
countryNameLabel.textColor = Theme.primaryColor
@ -74,9 +53,6 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
let countryIcon = UIImage(named: (CurrentAppContext().isRTL
? "small_chevron_left"
: "small_chevron_right"))
// NavBarBackRTL
// small_chevron_right
// system_disclosure_indicator_rtl
let countryImageView = UIImageView(image: countryIcon?.withRenderingMode(.alwaysTemplate))
countryImageView.tintColor = Theme.placeholderColor
countryImageView.setContentHuggingHigh()
@ -472,11 +448,8 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
extension OnboardingPhoneNumberViewController: UITextFieldDelegate {
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
var prefix = self.callingCode
if prefix.hasPrefix(COUNTRY_CODE_PREFIX) {
prefix = prefix.substring(from: COUNTRY_CODE_PREFIX.count)
}
ViewControllerUtils.phoneNumber(textField, shouldChangeCharactersIn: range, replacementString: string, countryCode: countryCode, prefix: prefix)
// TODO: Fix auto-format of phone numbers.
ViewControllerUtils.phoneNumber(textField, shouldChangeCharactersIn: range, replacementString: string, countryCode: countryCode)
// Inform our caller that we took care of performing the change.
return false

@ -80,7 +80,11 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
guard sender.state == .recognized else {
return
}
// TODO:
guard let url = URL(string: kLegalTermsUrlString) else {
owsFailDebug("Invalid URL.")
return
}
UIApplication.shared.openURL(url)
}
@objc func continuePressed() {

@ -22,13 +22,6 @@ extern NSString *const TappedStatusBarNotification;
replacementString:(NSString *)insertionText
countryCode:(NSString *)countryCode;
// The same method, but it temporarily adds a prefix during the formatting process.
+ (void)phoneNumberTextField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)insertionText
countryCode:(NSString *)countryCode
prefix:(nullable NSString *)prefix;
+ (void)ows2FAPINTextField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)insertionText;

@ -90,11 +90,6 @@ const NSUInteger kMax2FAPinLength = 16;
// reformat the phone number, trying to keep the cursor beside the inserted or deleted digit
NSUInteger cursorPositionAfterChange = MIN(left.length + center.length, textAfterChange.length);
// if (prefix.length > 0) {
// textAfterChange = [prefix stringByAppendingString:textAfterChange];
// cursorPositionAfterChange += prefix.length;
// }
NSString *textAfterReformat =
[PhoneNumber bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:textAfterChange
withSpecifiedCountryCodeString:countryCode];
@ -103,22 +98,6 @@ const NSUInteger kMax2FAPinLength = 16;
to:textAfterReformat
stickingRightward:isJustDeletion];
// if (prefix.length > 0) {
// OWSAssertDebug([textAfterReformat hasPrefix:prefix]);
// if ([textAfterReformat hasPrefix:prefix]) {
// textAfterReformat = [textAfterReformat substringFromIndex:prefix.length];
// cursorPositionAfterReformat -= prefix.length;
//
// NSRange trimRange = [textAfterReformat
// rangeOfCharacterFromSet:NSCharacterSet.whitespaceCharacterSet.invertedSet]; if (trimRange.location >
// 0) {
// textAfterReformat = [textAfterReformat
// stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet];
// cursorPositionAfterReformat -= trimRange.location;
// }
// }
// }
textField.text = textAfterReformat;
UITextPosition *pos =
[textField positionFromPosition:textField.beginningOfDocument offset:(NSInteger)cursorPositionAfterReformat];

Loading…
Cancel
Save