Tkko / Flutter_Pinput

Flutter package to create Pin code input text field with every pixel customization possibility 🎨 with beautiful animations, iOS autofill, Android autofill
https://pub.dev/packages/pinput
MIT License
768 stars 176 forks source link

iOS sms auto fill not working #137

Open Ibrokihimbek opened 1 year ago

Ibrokihimbek commented 1 year ago

Hello, I have a problem

that is, sms autofill is not working, there is no problem on android, on android, sms is coming and it asks for permission to enter the code in the sms, but on iOS, sms is coming, but it doesn't ask for permission to write, and it doesn't write the code automatically

Tkko commented 1 year ago

Hey, that's how iOS auto fill works by default (by tapping sms code on top of the keyboard). But you can also configure a trusted domain and enter code automatically.

https://github.com/Tkko/Flutter_Pinput/issues/132

janlektonen commented 1 year ago

On iOS 16 the sms autofill is not showing on top of keyboard. It used to work. But not anymore. The sms-code is received but pinput does not display it to choose.

Tkko commented 1 year ago

@janlektonen Have you changed anything on your side? Is sms content same?

janlektonen commented 1 year ago

@Tkko No nothing changed, same sms content with 6 digits to input from sms. But it's strange it's stopped working. As I understand I don't need to change/do anything on iOS, only on Adroid right?

Tkko commented 1 year ago

Yeah, iOS autofill works fine out of the box, standard TextField has autofill too, speaking of which, can you replace Pinput with TextField and check if it's working properly?

janlektonen commented 1 year ago

I have tried again also with TextField on iOS 16.5.1. It can't get it to work and show sms code when clicking in the input field. I also see there is a new_pinput package in pub.dev: https://pub.dev/packages/new_pinput Something you know about @Tkko ?

Tkko commented 1 year ago

Hey @janlektonen, could you send me the example of SMS you are receiving? I'm not aware of new_pinput, I don't see any improvements an author made, it's just a clone so far.

janlektonen commented 1 year ago

Hey @Tkko, it is just a normal Firebase push notification. I don't have any data on it. But the keyboard input don't pick the FCM up. Maybe its because its from Firebase and not a normal sms.

Here is the documentation on what I receive: https://firebase.google.com/docs/cloud-messaging/concept-options

Tkko commented 1 year ago

Yeah, it should be an SMS but as a workaround you can read the push notification content in your app and set the code programmatically

controller.setText(codeFromPushNotification);

janlektonen commented 1 year ago

Thanks, I will do that then!

mobikodeStudio commented 1 year ago

@Tkko - sms autofill not working in ios with latest IOS its working in older version. any Idea what need to do this fix.

DeveloperEC1 commented 1 year ago

@janlektonen There are message patterns for autofill to work on iOS, such as:

Verification code: 123456

Please check this message pattern example and update us.

@Tkko Add this info to your documentation, please.

janlektonen commented 1 year ago

Hi @DeveloperEC1 @Tkko

Using Pinput() I cant get it working. I have tried this:

autofillHints: [AutofillHints.oneTimeCode], // ios autofill on push

But it is not working. Should it not support autofillHints on ios?

DeveloperEC1 commented 1 year ago

@janlektonen You need to press on the top of your keyboard when the SMS is received if you use the SMS format for iOS, this is the Autofill in iOS.

janlektonen commented 1 year ago

@DeveloperEC1 Yes I know that there is shown a line on top of keyboard with the code and you should click there to get it into pinput.

BUT - that line is not shown anymore. It stopped working some version-updates ago. I pointed that out earlier this year. So something changed in your code/package I guess or iOS 16 changed something or maybe Flutter SDK?

But the the OTP code is not shown anymore on top of keyboard for Firebase Push one time code notifications. It used to work earlier this year in your package.. but stopped. I think this is what people are pointing out here.

abdullahonus commented 7 months ago

Any update about line under keyboard? Because still doesn't work. Should I change any perm or stuf in iOS or Xcode or in project. @janlektonen @Tkko @Ibrokihimbek

Android is working.

janlektonen commented 7 months ago

@abdullahonus I have tried and just tested again on real ios 17 device. It's not working on ios...

abdullahonus commented 7 months ago

@janlektonen thank you for feed back. Can @Tkko do anything about that pleas?

abdullahonus commented 7 months ago

@janlektonen or any suggest from you I can try

janlektonen commented 7 months ago

@abdullahonus as long as you followed the guidelines here I'm not sure we can do anything else? https://pub.dev/packages/pinput#sms-autofill

The documentation says it should be working - but I just can't get it working on a real ios device for months now...

abdullahonus commented 7 months ago

@janlektonen got it . So still not working we should wait for refactoring the code :/ Also thank you for ur information Mr. Jan

Tkko commented 7 months ago

Hey guys, I've just checked autofill on iOS 17.3.1 with Flutter 3.19.3 and when I send this SMS to my phone number the code is showing up on a keyboard.

My SMS looks like this "Hey, your sms code ie 4432"

If you are sending SMS in different language iOS might not be able to read the OTP so try to send it in English.

Please tell me, If there is anything you are doing differently.

janlektonen commented 7 months ago

@Tkko i can inform you that I use the Danish language template in Firebase for the sms message. Is there a way for the code to pick up the Danish language?

Tkko commented 7 months ago

I can't really find an exact SMS guidelines for iOS and it is a common issue but if you include the word "code" in your SMS it seems to be working fine.

We had a same issue before so I recommend to read it as well https://github.com/Tkko/Flutter_Pinput/issues/85

Again, the issue isn't related to Flutter, that's how it works on iOS.