Code Monkey home page Code Monkey logo

flagphonenumber's People

Contributors

akilanarasu1994 avatar dimitris-c avatar fvolchyok avatar gadaxara avatar grifas avatar jmartinesp avatar lsamaria avatar nickenchev avatar tsomaev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flagphonenumber's Issues

Add support for objc!

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Ability to disable flag button

Hi @grifas ! Love this project!
In my current app, I'd like to freeze the flag to the US one.
I took a look at the code (PhoneNumberTextField.swift) and figured out that the flag button's user interaction needs to be disabled for this task.

So basically, I'll have to change

private var flagButton: UIButton!

to

public var flagButton: UIButton!

or
create a method to update the button's characteristics.

Which approach do you recommend, and is it alright if I submit a PR with this enhancement?

Not able to set CTKFlagPhoneNumberTextField in storyBoard

Expected behavior

I want to create CTKFlagPhoneNumberFields in storyboard itself.

Actual behavior

Now its throwing error while setting textfield in storyBoard.

Steps to reproduce the problem.

  1. Create an outlet of CTKFlagPhoneNumbertextField
  2. Set the initial setUp Codes.

Specifications

Flag is no updated after changing phone with set(phoneNumber: String)

By default I have American flag set, but when I change phone to my Belarussian phone with set(phoneNumber: String), flag doesn't changes (though phone changes properly and code accepted fine):

image

Fortunately, it is easy to fix - seems like all one need to do is to add setFlag(with: phoneUtil.getRegionCode(for: parsedPhoneNumber)) to CTKFlagPhoneNumberTextField.swift around 142 line. If required, I can make a fork and submit possible fixes via pull requests.

Cannot assign value of type 'ViewController' to type 'UITextFieldDelegate?'

Describe the bug
Delegate method is not getting called, Insert ' as! UITextFieldDelegate'
To Reproduce
class ViewController: UIViewController, FPNTextFieldDelegate {
In viewDidLoad
phoneNumberTextField.delegate = self

Expected behavior
The delegate should be set and methods may get called.
Screenshots
If applicable, add screenshots to help explain your problem.
image

Smartphone (please complete the following information):

  • Device: [Simulator]
  • OS: [e.g. Xcode 10 iOS 12.1]
  • Version [Swift 4.2]

FlagPhoneNumber (please complete the following information):

  • Version [Master]

Additional context
N/A

CTKFlagPhoneNumberTextField's init?(coder aDecoder: NSCoder) not implemented.

Is there any reason to not do something like this:?

    required public init?(coder aDecoder: NSCoder) {
            super.init(coder: aDecoder)
            setup()
    }

Right now due to current implementation it is impossible to create CTKFlagPhoneNumberTextField in .xib file or storyboard. If there are no reasons to disallow creation from xibs it would be awesome to implement initWithCoder.

Swift 4.2 and Xcode 10 support

Expected behavior

Library compiling and working with Swift 4.2 and Xcode 10

Actual behavior

It doesn't compile with 4.2

Issue while setting phone number using phoneNumberTextField.set

While we set number to CTKFlagPhoneNumberTextField it was reflecting with proper country flag

After your last committed changes number is not getting set to textfield.

I have installed pods, changed Class of UITextfield to CTKFlagPhoneNumberTextField
and just used your given method
phoneNumberTextField.set(phoneNumber: "some number with country code")

This was working fine before your last commit, now I am facing problems

what happens is textfield gets set to empty and and when I try to set it manually I am not able to see flags of desired countries?

This issue I was facing on pod version (0.4.6)

Custmise

can you customise in the table view

pod install error with newest pod

@maffpool I ran the newest pod and when I run getphonenumber it just gives me the phone number set in viewdidload, it doesn't give me the actual phone number in the textfield. Can you fix this issue. Run pod install again on this project, then press ok button when you enter invalid phone and you will see my point.

Customize the country code (ie: +1)

I'd like to change the color of the country code, and also the font family and font size.
Maybe by default it can take the text color and font properties that you set to the UITextField.
Thanks!

Flags won't appear sometimes

Hi,

I'm running into flags no load issue - the same as described in

When first time, app is launched, it loads Flags bundle and shows all the flags. But when I logout, and then open country picker, it doesn't show any flag. It's exactly same issue as commented on above links.

Did you find any solution to this problem. I tried latest code, but the issue seems to persist there too.

Thanks,
Abdul

stop editing countryTextField

when touch country text field at any place i expected to got countrypicker opened directly ,but i found that text field can be editing and i want to stop text field editing and make action not on flag only on text and flag image

Phone number validation

Expected behavior

Just like Android setPhoneNumberValidityChangeListener, there should be a callback or delegate method

Actual behavior

There is no way to validate entered phone number

Steps to reproduce the problem.

Simple to enter any phone number but you will not notify on your ViewController

Specifications

I am using one which you suggested into Github

Keyboard type changes after country selection when used in tableview

Describe the bug
Number keyboard pad lost after country selection when used in tableview (static)

To Reproduce
Steps to reproduce the behavior:
use it in a tableview (static)
change country
keyboard type is not the number pad

Expected behavior
Keyboard type should stay in the number pad

Smartphone (please complete the following information):

  • Device: iphone x
  • OS: ios 12

FlagPhoneNumber (please complete the following information):

  • Version: 0.7.1

Remove Flag

Do not want to show flag how can I do that?

I want to show only number with Country.

phoneNumberTextField.set not working after recent commit..?

Hi There,

I have integrated "CTKFlagPhoneNumber" in my project

phoneNumberTextField.set(phoneNumber: "0600000001")
is not working in my case. I am not getting pre populated number and flag and In some cases it gets crashed.

I have Integrated it a day before and it was working fine, I think this issues are due to latest update , could please help me on same.

Thanks in Advance

Flag is not visible on iPad only

Describe the bug
Flag is not visible on iPad - both landscape and portrait mode

To Reproduce
Steps to reproduce the behavior:

  1. Run the universal app on iPad

Expected behavior
App should show the flag as it does on iPhone

Screenshots
iPad - Landscape
simulator screen shot - ipad air - 2018-12-25 at 14 50 05

iPad - Portrait
simulator screen shot - ipad air - 2018-12-25 at 14 50 03

iPhone
simulator screen shot - iphone xr - 2018-12-25 at 14 53 35

Smartphone:

  • Device: iPad Air
  • OS: iOS 12.1
  • Version: 0.7.1

FlagPhoneNumber :

  • Version : 0.7.1

Additional context
Issue only on iPad, working fine on iPhone.

Retrieve 2-letter country code

I'm not sure if I'm overlooking something, but I can't seem to find a way to retrieve the country code. I tried extending the CTKFlagPhoneNumberTextField class and overriding the country picker delegate but I can't, since its not marked "open".

Please advise, thank you.

Library not support some functions

I am using this framework,
But, it's not support some methods.
print(phoneNumberTextField.getFormattedPhoneNumber())
print(phoneNumberTextField.getCountryPhoneCode())
print(phoneNumberTextField.getRawPhoneNumber())
I also cannot insert the search button like you.
How to fix it?
Please help me!

Thanks and Regard.

Can't type / select flag

Can't type / select flag with latest pod. Reverted to 'improvement-2' branch and renaming classes to old convention removed the issue.

Flags won't appear sometimes

Hi @grifas

I'm running into flags no load issue - the same as described in

When first time, app is launched, it loads Flags bundle and shows all the flags. But when I logout, and then open country picker, it doesn't show any flag. It's exactly same issue as commented on above links.

Did you find any solution to this problem. I tried latest code, but the issue seems to persist there too.

Thanks,
Abdul

Bring up the country picker by tapping the country code.

Is your feature request related to a problem? Please describe.
Hello! A nice improvement would be the ability to tap the country code to bring up the country code picker. Currently, only tapping the flag brings up the country picker.

Describe the solution you'd like
Tapping the country code e.g. "+00" will bring up the country picker to allow selecting another country.

Describe alternatives you've considered
I tried to make another invisible button centred on the country code to get it to trigger the country picker, but I couldn't get it working.

Additional context
I was trying to hide flags while still allowing the changing of the country codes but I couldn't quite create a fix. Thanks for making this library, it's really useful.

CTKFlagTextField in storyBoard

Hi,

I am not able to set the textfield in storyboard, it crashes when we set it via storyboard(not programatically). Could you please suggest any solutions for the error?

Flags not showing

I was using the library and suddenly when I change the view controller to another part of the app, the flags are not visible now.

I tried with the default textfield without much configuration and is still not working.

screen shot 2018-06-19 at 4 46 31 pm

Phone number formatting.

I want to format the phone number. but I haven't seen an option.If you will add this feature.it will be better.

How to get Country Phone Code

Hi,
Could you please help, how to get current Country Phone Code?
I am trying something like:
number.getCountryPhoneCode()
But get error:
Value of type 'FPNTextField?' has no member 'getCountryPhoneCode'

i would like to use india number 10 digits, without spaceing

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Version [e.g. 0.6.0]

FlagPhoneNumber (please complete the following information):

  • Version [e.g. 0.6.0]

Additional context
Add any other context about the problem here.

tfField.getPhoneNumber() returning nil

I have my TextField in Storyboard. I changed the class name CTKFlagPhoneNumberTextField and module as CTKFlagPhoneNumber. Now while validating the number getPhoneNumber() is returning me nil but when I am printing text I can see the country code and number I entered. Is there any property I need to set. Need help. Thanks in advance.

get the country name

HI,
thanks for the awesome library. Just wanted to know if there is any way to get the name of the country.
For eg. if I want to get the country code, I will select the particular country from the list. But if I want the country name of the selected country code , how can I get it?

Thanks in advcance

Country Code and Raw Number

Currently we are only able to get complete number through:
print(phoneNumberTextField.getPhoneNumber())

// Output: +33600000001

Sometime country code and raw phone number is required rather than complete number, There must be 2 more methods.

print(phoneNumberTextField.getCountryCode())

// Output: +33

print(phoneNumberTextField.getRawPhoneNumber())

600000001

Disable Phone Number Format.

Hi There,

First of all thank you for your great library. :)

I am implementing Country code picker into one of my app but i have one concern that i dont want to implement phone number formatting. But in your code formatting is by default. So is there any way to disable it?

Thank You!!

Support phone number extension

Are there any plans to support phone numbers with extensions? For example, 613-555-0415, Ext. 126 . This would be a nice feature to have.

Carthage support

The project is cool, thanks! Is there any plan to support Carthage?

Thanks

US phone code is deletable

Hi @grifas , the US phone code (+1) is deletable.

It seems that something is wrong with the UITextField delegate and the way it processes the input.

Flag is not visible on iPad only

Describe the bug
Flag is not visible on iPad - both landscape and portrait mode

To Reproduce
Steps to reproduce the behavior:

  1. Run the universal app on iPad

Expected behavior
App should show the flag as it does on iPhone

Screenshots
iPad - Landscape
simulator screen shot - ipad air - 2018-12-25 at 14 50 05

iPad - Portrait
simulator screen shot - ipad air - 2018-12-25 at 14 50 03

iPhone
simulator screen shot - iphone xr - 2018-12-25 at 14 53 35

Smartphone:

  • Device: iPad Air
  • OS: iOS 12.1
  • Version: 0.7.1

FlagPhoneNumber :

  • Version : 0.7.1

Additional context
Issue only on iPad, working fine on iPhone.

facing issue when use it in scroll view

when i have add CTKFlagPhoneNumber text field in scroll scroll then i am unable to edit it. its always show me country picker and m unable to enter phone number . but when i add it outside main view then it works perfect

Ability to restrict set of phone numbers & flags

Hi @grifas .
It would be really great if the library allows the developer to restrict the flags & formats shown in the CTKFlagPhoneNumberTextField.
Some apps are only released in certain countries, hence it makes sense to restrict the phone numbers allowed to be entered into the text field.

Library Crash

App crash due to this function, mostly first time when its loads.

func setCountryByRow(row: Int) {
		self.selectRow(row, inComponent: 0, animated: true)
		let country = countries[row]
		if let countryPickerDelegate = countryPickerDelegate {
			countryPickerDelegate.countryPhoneCodePicker(self, didSelectCountryWithName: country.name!, countryCode: country.code!, phoneCode: country.phoneCode!, flag: country.flag!)
		}
	}

Crash: _T018CTKFlagPhoneNumber15MRCountryPickerC15setCountryByRowySi3row_tF

Please take a look:

OS version: 9.0.0

Logs:

Crashed: com.apple.main-thread
0 CTKFlagPhoneNumber 0x100b34b64 _T018CTKFlagPhoneNumber15MRCountryPickerC15setCountryByRowySi3row_tF + 948
1 CTKFlagPhoneNumber 0x100b314fc _T018CTKFlagPhoneNumber0abC9TextFieldC5setup33_D5149F41D855A9C52E54B091304B013ELLyyF + 1148
2 CTKFlagPhoneNumber 0x100b32d4c _T018CTKFlagPhoneNumber0abC9TextFieldCACSgSo7NSCoderC5coder_tcfcTf4gn_n + 248
3 CTKFlagPhoneNumber 0x100b30fb0 _T018CTKFlagPhoneNumber0abC9TextFieldCACSgSo7NSCoderC5coder_tcfcTo + 36
4 UIKit 0x18962ecb8 -[UIClassSwapper initWithCoder:] + 248
5 UIKit 0x189743bf0 UINibDecoderDecodeObjectForValue + 672
6 UIKit 0x189743d68 UINibDecoderDecodeObjectForValue + 1048
7 UIKit 0x189743938 -[UINibDecoder decodeObjectForKey:] + 336
8 UIKit 0x18947bfb4 -[UIView initWithCoder:] + 608
9 UIKit 0x189743bf0 UINibDecoderDecodeObjectForValue + 672
10 UIKit 0x189743938 -[UINibDecoder decodeObjectForKey:] + 336
11 UIKit 0x18962e95c -[UIRuntimeConnection initWithCoder:] + 188
12 UIKit 0x189743bf0 UINibDecoderDecodeObjectForValue + 672
13 UIKit 0x189743d68 UINibDecoderDecodeObjectForValue + 1048
14 UIKit 0x189743938 -[UINibDecoder decodeObjectForKey:] + 336
15 UIKit 0x18962dc90 -[UINib instantiateWithOwner:options:] + 1220
16 UIKit 0x1894e6cfc -[UIViewController _loadViewFromNibNamed:bundle:] + 376
17 UIKit 0x1892bbea8 -[UIViewController loadView] + 176
18 UIKit 0x189183258 -[UIViewController loadViewIfRequired] + 144
19 UIKit 0x1891831b0 -[UIViewController view] + 28
20 UIKit 0x1894f5c18 -[UIViewController _setPresentationController:] + 108
21 UIKit 0x1894eee74 -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1328
22 UIKit 0x1894f085c -[UIViewController _presentViewController:withAnimationController:completion:] + 4428
23 UIKit 0x1894f3294 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 472
24 UIKit 0x18927a0c0 -[UIViewController presentViewController:animated:completion:] + 184
25 PrintOSMobile 0x1000a2894 +[Navigator presentPhoneNumberViewControllerOnAViewController:andDelegate:] (Navigator.m:625)
26 PrintOSMobile 0x1000b3cd8 -[SetPhoneNumberPopupBuilder presentDialog:withCompletionBlock:] (SetPhoneNumberPopupBuilder.m:68)
27 PrintOSMobile 0x10006d42c __47-[PopupsManager shouldShowSetPhoneNumberPopup:]_block_invoke (PopupsManager.m:297)
28 PrintOSMobileLibCore 0x1012e45a4 -[ResponseSerializer executeBlock:withResult:] + 48
29 PrintOSMobileLibCore 0x1012e4190 __60-[ResponseSerializer parseJSON:resultClass:success:failure:]_block_invoke + 84
30 libdispatch.dylib 0x1999017b0 _dispatch_call_block_and_release + 24
31 libdispatch.dylib 0x199901770 _dispatch_client_callout + 16
32 libdispatch.dylib 0x199906e20 _dispatch_main_queue_callback_4CF + 1844
33 CoreFoundation 0x183be4258 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
34 CoreFoundation 0x183be20c0 __CFRunLoopRun + 1628
35 CoreFoundation 0x183b10dc0 CFRunLoopRunSpecific + 384
36 GraphicsServices 0x18efac088 GSEventRunModal + 180
37 UIKit 0x1891eaf60 UIApplicationMain + 204
38 PrintOSMobile 0x10013c12c main (main.m:14)
39 libdyld.dylib 0x1999328b8 start + 4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.