Git Product home page Git Product logo

Comments (8)

kinosang avatar kinosang commented on July 28, 2024 1

use Dependency Injection with .AddSingleton<IPhoneNumberParser>(new PhoneNumberParser()) instead of use PhoneNumberUtil.GetInstance() directly.

FYI, this project does not provide the interface and service, you should create them by yourself.

from libphonenumber-csharp.

kinosang avatar kinosang commented on July 28, 2024 1

@twcclegg Thanks. I have noticed that while PhoneNumberUtil.GetInstance() takes long to initialize, another long runner is calling InputDigit() on the AsYouTypeFormatter for the first time. I wanted to use this library in Xamarin Forms to validate mobile numbers during account signup, but when the user hits a digit on the soft keyboard for the first time, there is a noticeable delay for that digit, especially on iOS.

Do you expect the porting to be done anytime soon? I saw #45 was opened in 2017.

@adrianknight89 I don't think validate user input on the client side is a good idea.

BTW, I'm waiting #45 to be done too, I use DI and singleton interface to "speed up" the library now, it speed time and grab memory when the application startup.

from libphonenumber-csharp.

AwsomeCode avatar AwsomeCode commented on July 28, 2024

Thanks I will tried it out.

from libphonenumber-csharp.

adrianknight89 avatar adrianknight89 commented on July 28, 2024

@AwsomeCode Did you figure this out? It's taking quite long for me as well.

from libphonenumber-csharp.

twcclegg avatar twcclegg commented on July 28, 2024

If I get the porting the binary serialization code working, it should speed up initialization time, and decrease package size, etc. #45

from libphonenumber-csharp.

adrianknight89 avatar adrianknight89 commented on July 28, 2024

@twcclegg Thanks. I have noticed that while PhoneNumberUtil.GetInstance() takes long to initialize, another long runner is calling InputDigit() on the AsYouTypeFormatter for the first time. I wanted to use this library in Xamarin Forms to validate mobile numbers during account signup, but when the user hits a digit on the soft keyboard for the first time, there is a noticeable delay for that digit, especially on iOS.

Do you expect the porting to be done anytime soon? I saw #45 was opened in 2017.

from libphonenumber-csharp.

adrianknight89 avatar adrianknight89 commented on July 28, 2024

@kinosang I do input validation on both client and server sides. I did try holding a reference to a PhoneNumberUtil after the application starts and using it on the input validation page. This helps reduce time, but it doesn't help with AsYouTypeFormatter, especially on iOS.

I then fed random digits into the type formatter again after app start so that the formatter doesn't need to be cold init on the validation page. This fixed lagging completely on Android, but it didn't improve anything on iOS.

from libphonenumber-csharp.

twcclegg avatar twcclegg commented on July 28, 2024

Yeah I'd like to figure out a way to split up #45, it been difficult to get all the data to serialized and deserialize correctly and is also implementing other missing features . As for AsYouTypeFormatter slow on iOS, I think that's just going to be the way things are since it lacks compiled regexs.

from libphonenumber-csharp.

Related Issues (20)

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.