Comments (8)
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.
@twcclegg Thanks. I have noticed that while
PhoneNumberUtil.GetInstance()
takes long to initialize, another long runner is callingInputDigit()
on theAsYouTypeFormatter
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.
Thanks I will tried it out.
from libphonenumber-csharp.
@AwsomeCode Did you figure this out? It's taking quite long for me as well.
from libphonenumber-csharp.
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.
@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.
@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.
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)
- How to parse without getting exception for wrong format? HOT 10
- Country Code is added to NationalNumber in PhoneNumber Object if Number is too short HOT 1
- Could not load file or assembly 'System.IO.Compression HOT 6
- Document how changes in Google's base library are included or not HOT 2
- Strong named assemblies HOT 2
- Make metadata update and publish new version fully automatically HOT 1
- New Kazakhstan country code. HOT 1
- Could not interpret numbers after plus-sign when parsing +00000000000000 HOT 3
- Missing or invalid default region. HOT 2
- IsPossibleNumberForTypeWithReason returns valid mobile when IsValidNumber returns invalid HOT 1
- Valid US number is resulting in IsValid to false HOT 4
- Parsing phone number as valid when it starts with _ HOT 9
- GetNumberType always returns UNKNOWN HOT 2
- Breaking change in PhoneNumberUtil.Normalize HOT 2
- Enable nullable reference types
- American phone not correctly parsed? HOT 2
- Version 8.13.26 causes IndexOutOfRangeException HOT 3
- Vietnamese phone number does not validate HOT 1
- French mobile numbers with prefix "07" are not detected as mobile numbers HOT 2
- docs: codecov badge on README leads to old trunk branch "master" instead of the new "main" branch HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libphonenumber-csharp.