From 4af760f29a42763992ec2e13902f9082bb450455 Mon Sep 17 00:00:00 2001 From: jayelzaghmoutt Date: Tue, 4 May 2021 19:24:19 +0300 Subject: [PATCH] - Fix Bug when the number is invalid - Update version to 1.0.16 --- JNPhoneNumberView.podspec | 2 +- .../PhoneNumberUtil/JNPhoneNumberUtil.swift | 41 +------------------ 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/JNPhoneNumberView.podspec b/JNPhoneNumberView.podspec index 82abbfb..947dc89 100644 --- a/JNPhoneNumberView.podspec +++ b/JNPhoneNumberView.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "JNPhoneNumberView" - s.version = "1.0.15" + s.version = "1.0.16" s.summary = "Phone Number Validation with country dial code picker" s.description = "A view to show the country dial code and the phone number, you can click on the dial code and select another country from the countries picker, this view has a delegate methods to pass the international number and validity of it." s.homepage = "https://github.com/JNDisrupter" diff --git a/JNPhoneNumberView/Classes/Utils/PhoneNumberUtil/JNPhoneNumberUtil.swift b/JNPhoneNumberView/Classes/Utils/PhoneNumberUtil/JNPhoneNumberUtil.swift index 8f3afff..7f0cb99 100644 --- a/JNPhoneNumberView/Classes/Utils/PhoneNumberUtil/JNPhoneNumberUtil.swift +++ b/JNPhoneNumberView/Classes/Utils/PhoneNumberUtil/JNPhoneNumberUtil.swift @@ -69,46 +69,7 @@ import libPhoneNumber_iOS return phoneNumber } catch { - // National number - var nationalNumber: NSString? = nil - - // Dial code - let dialCode = phoneNumberUtil.extractCountryCode(modifiedPhoneNumber, nationalNumber: &nationalNumber) - - // Check if dial code or national phone number not detected - if (dialCode?.description ?? "").isEmpty || nationalNumber == nil { - return nil - } - - // Create phone number object - let nbPhoneNumber = NBPhoneNumber() - - // Set dial code - nbPhoneNumber.countryCode = dialCode - - // Check if national number not empty - if nationalNumber!.length > 0 { - - // Convert NSString To String - let stringNationalNumber: String = nationalNumber! as String - - // National Phone Number - var nationalPhoneNumber: NSNumber - - if let integerValue = Int64(stringNationalNumber) { - // Convert national number from string to NSNumber - nationalPhoneNumber = NSNumber(value: integerValue) - }else{ - // Convert national number from NSString to NSNumber - nationalPhoneNumber = NSNumber(value: nationalNumber!.floatValue) - } - - - // set national number - nbPhoneNumber.nationalNumber = nationalPhoneNumber - } - - return nbPhoneNumber + return nil } } }