Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTP Autofill #17

Closed
appcornerit opened this issue Oct 5, 2018 · 30 comments
Closed

OTP Autofill #17

appcornerit opened this issue Oct 5, 2018 · 30 comments
Assignees
Labels
enhancement New feature or request

Comments

@appcornerit
Copy link

appcornerit commented Oct 5, 2018

Hi,
SPView doesn't work with textContentType = .oneTimeCode (ex: add textContentType to the first SVPinField).
Any idea how to solve the issue?

@xornorik
Copy link
Owner

xornorik commented Oct 7, 2018

Hi, I have yet to add the changes to make it compatible with iOS 12. Will be doing it in the upcoming release.

@xornorik xornorik added the enhancement New feature or request label Oct 7, 2018
@xornorik xornorik self-assigned this Oct 7, 2018
@xornorik
Copy link
Owner

@appcornerit I've added an option isContentTypeOneTimeCode for setting the text content type of the first pinField to .oneTimeCode. However I haven't been able to test this on a device. If you happen to be using this, could you confirm if it's working?
Thanks.

@appcornerit
Copy link
Author

appcornerit commented Oct 30, 2018

thanks! There are some issues:

  • the first text field can't be prefilled with " " (otherwise the opt message doesn't appear)
  • in the textFieldDidChange the code that try to find next responder should not close the keyboard for the first text field (otherwise the opt copy doesn't work)

@xornorik
Copy link
Owner

Okay, I will investigate. Removing the pre-filled space might not work since we need it for detecting the backspace event.

@xornorik xornorik reopened this Oct 30, 2018
@appcornerit
Copy link
Author

As suggestion I applied the workaround (not prefilled) just for the first text field only, because I'm avoiding to close the keyboard on the first field for backspace.

@himanthmaddi
Copy link

Can you please help me out on this how to solve this issue

@jamesrv43
Copy link

just add condition

if(textField.tag != 101){
   textField.text = " "
}

(textField.tag == 101 is first textfield)

@sreekumar88
Copy link

It doesn't work even after setting isContentTypeOneTimeCode to true. Unable to fetch the OTP directly from messages.

@detectedstealth
Copy link

@sreekumar88 I was able to get this working by making two changes to the source code of this project.

First inside SVPinView collectionView(_,cellForItemAt:) the find the comment // setting up textField and change:

textField.text = " "

To this:

if textField.tag != 101 {
   textField.text = " "
} else {
   textField.text = nil
}

One more change is required inside textFieldDidBeginEditing change the:

textField.text = " "

To this:

if textField.tag != 101 {
  textField.text = " "
}

If you don't do this you will not see the code in the keyboard, but if you are in the first text field and hit the back space you will see it briefly then it will disappear as the empty string is added.

@dhaval00700
Copy link

isContentTypeOneTimeCode is not working.

@and1gio
Copy link

and1gio commented May 23, 2019

OTP Autofill still not working i'm testing it on IOS12

@singh-karan-7
Copy link

@sreekumar88 I was able to get this working by making two changes to the source code of this project.

First inside SVPinView collectionView(_,cellForItemAt:) the find the comment // setting up textField and change:

textField.text = " "

To this:

if textField.tag != 101 {
   textField.text = " "
} else {
   textField.text = nil
}

One more change is required inside textFieldDidBeginEditing change the:

textField.text = " "

To this:

if textField.tag != 101 {
  textField.text = " "
}

If you don't do this you will not see the code in the keyboard, but if you are in the first text field and hit the back space you will see it briefly then it will disappear as the empty string is added.

I tried this and also applied this code in textFieldDiDChange method, but, it is not working. It does show otp briefly when I hit back space, but, it disappears.

@bhardwajpankaj
Copy link

Not working I have tried this option as well

@NileshLanjewar
Copy link

Hi,
SPView doesn't work with auto read otp from message due to that space in initial first character. when should we get the solution please help above solution not working.

@detectedstealth
Copy link

I’ll look closer at all the changes I have made but I HAVE been using it for auto fill since my original message on how to fix it.

@DiptiRout
Copy link

There is a work around for this issue. We just need to change every
textField.text = " "

to

textField.tag == 101 ? "" : " "

@akku20080
Copy link

I am facing the same issue. Any resolution for this? Please help.

@DiptiRout
Copy link

DiptiRout commented Oct 22, 2019 via email

@akku20080
Copy link

Hi, I have done some modifications and it is working fine now. Logic was I removed the space for first cell only. Without it everything is working fine for me. If you want I can share the code file. Let me know.

On Tue, 22 Oct, 2019, 9:45 AM akku20080, @.***> wrote: I am facing the same issue. Any resolution for this? Please help. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#17?email_source=notifications&email_token=AHG2NO5E5KD72HTL7DGYU23QPZ447A5CNFSM4FZHGNY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB4POGQ#issuecomment-544798490>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHG2NOZEG377O4Y7YAQOGFDQPZ447ANCNFSM4FZHGNYQ .

Yes please.

@DiptiRout
Copy link

Hi, I have added the SVPinView.swift file with my modifications. Please go through this, I hope this will resolve the issue.
SVPinView.swift.zip

@akku20080
Copy link

Thanks, it worked for me.

@iPiyushBaranwal
Copy link

Hi, I have added the SVPinView.swift file with my modifications. Please go through this, I hope this will resolve the issue.
SVPinView.swift.zip

sorry to say , its not working for me ?? after replacing the SVPinView.swift. file in my code.. please suggest??

@detectedstealth
Copy link

Well it officially seems like the author of this library is MIA I have started on a new version with some additional features for a current client I’ll post it on github once it’s finished.

@DiptiRout
Copy link

DiptiRout commented Oct 25, 2019 via email

@iPiyushBaranwal
Copy link

Hi, Can you tell what kind of error it is giving? As far as I can tell, it should work.

On Thu, 24 Oct, 2019, 12:14 PM iPiyushBaranwal, @.***> wrote: Hi, I have added the SVPinView.swift file with my modifications. Please go through this, I hope this will resolve the issue. SVPinView.swift.zip https://github.com/xornorik/SVPinView/files/3753955/SVPinView.swift.zip sorry to say , its not working for me ?? after replacing the SVPinView.swift. file in my code.. please suggest?? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#17?email_source=notifications&email_token=AHG2NO6PVHG5PVTJGBCIN23QQE75XA5CNFSM4FZHGNY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECD4Z3Y#issuecomment-545770735>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHG2NO6UCSCIPGJHZ2UFY2DQQE75XANCNFSM4FZHGNYQ .

I have just replaced provided SVPinView.swift file and trying to implement the process of auto fill otp functionality.

let me know if you need more specification on it .. thanks

@ChetanRajagiri
Copy link

ChetanRajagiri commented Feb 10, 2020

GUYS CHECK THIS #35

@srikanthkumarmailid07
Copy link

srikanthkumarmailid07 commented Mar 9, 2020


Observe in Pod class 

if #available(iOS 12.0, *), , isContentTypeOneTimeCode {
            textField.textContentType = .oneTimeCode
        } {
            textField.textContentType = .oneTimeCode
        }

pinviewobj.isContentTypeOneTimeCode = true

@Sadmansamee
Copy link

so it working?

@praveenkumar927
Copy link

Hi, I have done some modifications and it is working fine now. Logic was I removed the space for first cell only. Without it everything is working fine for me. If you want I can share the code file. Let me know.

On Tue, 22 Oct, 2019, 9:45 AM akku20080, @.***> wrote: I am facing the same issue. Any resolution for this? Please help. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#17?email_s

Thanks, it worked for me.

Please help me. I am getting empty in first two text fields. Please send your code. praveenkumar.iosdeveloper@gmail.com

@xornorik
Copy link
Owner

Hey guys,
Apologies for the long delay. Thank you for your patience & for all your inputs!
Finally resolved this.

AutoFill Demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests