Comments (5)
Hi @ayyrickay ,
I'm looking into the issue and I can reproduce it. As I understand this issue should solve:
- Correct rendering of phone number when there is combination of dialpad and keyboard input (This one I understand)
- Validation of phone numbers based on the region? If so, can you please elaborate more on the last paragraph?
Thanks!
from dev-phone.
Hey @hatealgebra. The first is correct. I would reframe the second issue as: what is a valid phone number?
There's some amount of form validation we should do. For example, if there are letters or special characters, we shouldn't risk breaking the SDK. But once we get past the basic validation, I think it becomes hard to be very clear about what constitutes a phone number.
We could try and make the Dev Phone very paranoid about phone numbers and reject calls to numbers that don't seem valid. This is the more pessimistic design (e.g., if the input doesn't look valid, we won't bother making a call.) But because there's a lot of variation in the length of phone numbers, maybe it's better to design optimistically, and just assume that users will put in valid numbers.
Still, there could be some cool opportunities if we used a number validator. One fun example might be identifying the country code and rendering it out to the user to show what country that number belongs to in an emoji, for example.
from dev-phone.
Hi @ayyrickay ,
I think the first issue is fixed and I've tested it.
About the second issue/problem, here are some points that I thought/came up with, let me know what you think about it:
Masking the input/validation
I've tried to sort of "mask" the input within the reducer and it's specific action. This way user can only type digits and special chars such as [*#+]:
case SET_DESTINATION_NUMBER:
const regex = /[*#+\d]/i;
const numberLength = action.number.length;
const lastAddedChar = action.number[numberLength -1];
if(!regex.test(lastAddedChar) && numberLength !== 0) return state;
return { ...state, destinationNumber: action.number }
Optimistic approach & flag API
I thought about the optimistic approach and suggestion with the country code recognition and did a bit of exploring. Actually, I've started with Twilio resources, where I've actually stumbled on the solution with int-tel-input plugin, which is also mentioned in this Twilio labs template.
I tried to work it out, but is kind of hacky to set it up in the react and this package would provide easier usage.
Conclusion
I hope that I've actually comprehended your original thought on the topic of the optimistic approach and did not tweak it that much.
My idea is kinda guide the user with entering the phone number, where we would not to worry about the letters in the input the user would just pick up the states code, and then it would be up to him what he types.
Looking forward to hearing your feedback and wish you a nice start to the week.
from dev-phone.
Hi @ayyrickay,
Did you have time to check my last comment? I'm waiting for you (dis)approval. Looking forward for your feedback.
from dev-phone.
@ayyrickay Sending a reminder about the next steps, thanks.
from dev-phone.
Related Issues (20)
- Push notifications for incoming SMS and phone calls
- UI doesn't reflect local backend shut down
- Newlines in messages bodies not rendered HOT 1
- Changeset command typo in Development.md
- Message Log should always be on most recent message
- Update Paste to v19
- Services are limited to less than or equal to 50 HOT 3
- Receiving SMS on dev-phone is not working HOT 7
- Update Babel Loader to v9.0
- Default proxy target for dev server in webpack.config.js HOT 5
- Improve SelectedPn variable usage in PhoneNumberPicker component HOT 1
- Use twilio dev-phone on ec2 HOT 3
- Add Styling and Scroll Ref to ChatComposer #186
- Admin Numbers are displayed instead of Subaccount Phone Numbers HOT 2
- twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio-labs/dev-phone/issues" HOT 1
- Twilio Dev Phone Plugin Issues during installation HOT 2
- Add --env option
- "services is deprecated" warnings in version 1.0.0-beta.3
- Services are limited to less than or equal to 50 HOT 3
- dev-phone: Failed to upload Function Sync Call History 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 dev-phone.