Is it possible to pop up a dialog from a plugin?

Posted on
Thu Jan 02, 2020 9:45 pm
ZachBenz offline
Posts: 163
Joined: Feb 08, 2014

Is it possible to pop up a dialog from a plugin?

In supporting two-factor authentication in the RingForIndigo plugin, I need a mechanism to prompt the user to enter a verification code when requested by the Ring.com API. Currently I do this in the plugin's preferences configuration via some special fields in PluginConfig.xml and use of an errorDict in validatePrefsConfigUi to do this prompting. The upside is that this fits in cleanly with the Indigo Plugin SDK... the downside is that on the backend I end up making multiple failed calls to the Ring.com API because I can't react immediately to the missing verification code, but instead have to fail out of validatePrefsConfigUi, prompting the user with a newly unhidden verification code field, and then try again (it's actually slightly more complicated than that in practice)

There are two problems with this:
  • From the user's perspective, they get multiple (up to 5 per attempted login) texts with a verification code from Ring due to all the API calls I need to make before finally letting them enter the verification code
  • From a Ring.com API perspective, there is a risk of making too many requests in a short period of time, locking the user out for minutes up to days

Ideally I would simply use the callback that is provided in the python Ring API library I am using to prompt the user for the verification code as soon as it is needed. However, this would require me to pop up a dialog box to have them enter it. Is this possible? If it was, I could only see it making sense to do this while the user has the plugin preferences configuration window open (i.e. wouldn't want to pop up a dialog at seemingly random times).

ZachBenz's Plugins: RingForIndigo

Posted on
Fri Jan 03, 2020 3:16 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Is it possible to pop up a dialog from a plugin?

Unfortunately no.

What sounds like it might work is this:

In plugin config, you can add buttons that do custom things, not just the ok/cancel.

Have a “request 2FA text” button that does whatever it needs to, AND a disabled textfield called “2FA code”.

When user presses button, you send 2FA code to user and enable the textfield for them to enter it.

They can then hit another button of your choice, to login, before you get anywhere near the ok/cancel validation.


Sent from my iPhone using Tapatalk Pro

Posted on
Fri Jan 03, 2020 8:39 am
ZachBenz offline
Posts: 163
Joined: Feb 08, 2014

Re: Is it possible to pop up a dialog from a plugin?

Ah, thanks - didn’t realize custom buttons were an option. I’ll give that a try.

ZachBenz's Plugins: RingForIndigo

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests

cron