phone_number icon indicating copy to clipboard operation
phone_number copied to clipboard

Implementing Web support

Open Faendis opened this issue 3 years ago • 6 comments

This pull request is linked to issue #44. Here you can find, an implementation of your plugin for web using google libphonenumber js library using https://github.com/natintosh/plugin_libphonenumber/tree/develop/libphonenumber_web as a starting point.

There is a deprecated call on MethodChannel constructor with Registrar.messenger, but I failed to get the plugin to work without using it.

Faendis avatar Jun 03 '21 15:06 Faendis

Hi there! Sorry for the late reply.. I've tried the code in this PR and unfortunately, I found an issue right from the start by trying to parse an international number, without providing a region code. it works with the native sdks, but the web sdk just fails. The libphonenumber's JS implementation might not be ready yet. Do you have the same results ?

nashfive avatar Jun 25 '21 16:06 nashfive

Hello, I don't remember if I had this results. I have made some tests and everything seemed to work fine. I will try to reproduce your issue and probably fix it.

Faendis avatar Jul 05 '21 12:07 Faendis

I find the problem and fix it (I was forcing regionCode to not be null when parsing international phone numbers). Tell me if you still encountered this issue or if you find another. If you can provide me any scenarios to test in order to correct the rest of my code, it will be nice.

I find two other issues :

  1. carrierRegionCode() : I can't get the carrier RegionCode with libphonenumber but I can try to get current browser region if you want
  2. getAllSupportedRegions() : I can't get the display names from RegionCode in dart or with libphonenumber. I can try to use some js code (using Intl.DisplayNames) or a flutter package (locale_names which is not null safe)

Faendis avatar Jul 05 '21 14:07 Faendis

Hey all, is this planned on being merged soon?

dorsamet avatar Apr 25 '22 08:04 dorsamet

Is there any update on this merge?

ghost avatar Oct 13 '22 07:10 ghost

Take a look on this @gabriel8belts https://github.com/flutter-form-builder-ecosystem/phone_number/issues/86

deandreamatias avatar Oct 13 '22 10:10 deandreamatias