Swift get OneTimePassword (OTP) in class - ios

I’ve read about how to achieve this using Storyboards and UI text elements and it seems to be pretty straightforward, however, I am building a hybrid app so I need to intercept this OTP in the controller and feed it to another event listener which will pass it to my app, so in this scenario I cannot make use of ios text input fields etc but surely there is a way to hook into the devices capability to recieve and parse it’s value ?

You can't parse security code. It only works this way:
If the system can parse a security code from an SMS message, the
QuickType bar shows the code for up to three minutes after it has been
received. If a security code arrives while the text input view is
selected, the system pushes the incoming code to the QuickType bar.
Reference: Swift Docs
UPD: You can access code once it pasted in UITextField

Related

Setting autofill in Cordova for iOS

I'm pretty new to Cordova dev. and I'm trying to achieve the following.
We have an application, running both on Android and iPhone, written in AngularJS,
under the Cordova framework.
In order to use our application, we require the users to send their phone number,
receive an SMS containing an OTP, type the OTP into a shaped text field, and press
a button for sending the OTP (and receiving an authentication token).
I was asked to enable the simple feature of enabling the application to do that
automatically, meaning it would parse the SMS, feed that input field, and send
the OTP, without any user intervention.
This is pretty easily achieved on Android, using a specific SMS Receive plugin,
but cannot be done in iOS.
However, I saw that it can be achieved semi-automatically on the new iOS versions,
but I have to change the input field type to "one-time-code". I tried to do that
on my Cordova code, and I couldn't achieve that, no matter what I did. I would
like to know how to do it through Cordova, if this can be done, anyway.
You should be able to do this using purely HTML without needing a Cordova plugin or any native iOS code as described here. Just set the autocomplete attribute, not the type attribute, of the input element to one-time-code:
<input id="single-factor-code-text-field" autocomplete="one-time-code" />
In my case it had to contain the word 'code' in the message then space and then the code you want to show. I'm not sure but I think it gets the symbols till the next space because I had more symbols after.
ex: code 123456

How can I show a response from an api through Siri without opening the app?

I need to develop a Bot-like application with integration of Siri in iOS. By asking anything, Siri would accept my text and call an api by passing that text in as a parameter. To the response of that api, Siri should show me that text (or speak the responded text if possible), without opening the app.
Up to now, I am able to integrate Siri. Also I can get text from Siri and show it as an IntentUI. Now, if I call the api by passing that text and receive a response, how can I show the response (after I parse it) in Siri?
I use INSendMessageIntentHandling to handle messages. I found methods related to sending messages but I could not find any event that could process received responses (from anywhere).
Is it possible to show responses using Siri without opening the app?
Please let me know if more information is needed.
Yes you can using sirikit to make custom intents and get parameters from user in ios 13.1
See the demo apple showed at WWDC 2019
and This is the project for the application they are demoing

Objective C - Adding contacts to send SMS/Email

I'm trying to create a custom sms/email sending view (I don't think i can use the regular SMS/Email API's since i'm planning on calling a server to send these emails and sms messages - meaning no instant sending so apple's api won't do).
The issue i'm facing:
Using the contacts bar the way apple uses it - writing a list of all the contacts needed in a way which makes the bar a "dynamic" contacts bar, which allows the user to add with completion or a "+" button which opens a people image picker view, and change the size of the bar in a very unique and nice way for each contact added.
I saw this stackoverflow question, but the project is archived and not relevant any more i guess.
IS there any source which has already implemented this? or should i face the fact i will have to implement it from scratch?

SmsMessage length calculator for iOS

In Android there is a great method SmsMessage.calculateLength you can give a string to it and it will detect its encoding and return an array where you can find how many characters are left for 1 sms message, or how many sms messages are there in the string...
I wonder if there is such a method in iOS? Sorry if the question is too simple, I am not a iOS guy.
No. The way you send a text message on iOS is by using the MFMessageViewController class, which presents its own UI, kind of like an activity on Android. It also shows the length of the message for you.
As there is no way to send a text message without using this pre-built iOS component, something like what you're asking for does not exist.

How can I intercept text messages using cocoa

I intend on writing an app for iOS that would require me to monitor incoming texts from select contacts etc - in short, I need to somehow get the strings from a text message into my app directly. Is anyone able to point me in the right direction here?
Apple doesn't provides any SDK (and doesn't allows developers) to access on the messages.
You can just access to the screen New Message from the app.

Resources