buttercup / buttercup-mobile

:iphone: React-Native mobile application for Buttercup
https://buttercup.pw
GNU General Public License v3.0
399 stars 71 forks source link

Android Autofill service #126

Closed jokeyrhyme closed 5 years ago

jokeyrhyme commented 5 years ago

https://developer.android.com/guide/topics/text/autofill-services

This is the Android equivalent of #125

It would be awesome for Buttercup to register with the Android OS to be able to:

Really excited about Buttercup, keep up the awesome work!

perry-mitchell commented 5 years ago

We'd love that! Definitely something that we want.

And thank you for the kind words 🙏

se1exin commented 5 years ago

FYI I've started working on implementing this. I've researched what needs to happen and have a implementation plan. Good news is we can re-use a lot of the iOS autocomplete stuff, which is great, but it might take me at least week or two to turn around with real life commitments etc.

perry-mitchell commented 5 years ago

@se1exin Hey this is great news! I've no idea what the autofill service on android even looks like, so this'll be an interesting feature addition. We've had a couple of people on twitter bring this up so it's nice to see that there's immediate interest.

Please handle it at your leisure of course! 🙏

BTW I use the ios autofill feature daily now and it's the best thing since sliced bread. Whole new world for mobile browsing.. 👍

se1exin commented 5 years ago

Sorry for the long wait, but I've made some promising progress on Android autofill over the last few weeks. I've submitted a WIP PR (#141) that details the progress so far.

screenshot from 2019-02-09 21-49-25

In the PR I have raised the question around how, where, and when the app should request the user to enable AutoFill on Android and iOS. To me the answer is not immediately obvious (for the reasons further below), and I don't want to just jump in and make large changes to the UX without first consulting the team and community.

I have not yet implemented a request mechanism to prompt users to enable autofill yet due to the following considerations:

Whatever the outcome I'm keen to finish this feature off, I'm looking forward to everyone's feedback and ideas about the above.

jokeyrhyme commented 5 years ago

@se1exin extremely promising, yay!

Can a single Android app register multiple separate Autofill services? If so, then it might be appropriate to register one for each archive. I'm not sure yet if this buys as a better UX, but just something to consider.

Even if we did have a global settings screen, I think it makes sense that some archives are not enabled for Autofill, and some others are. So, enabling/disabling Autofill from within the settings of each archive is probably a good place to start, maybe even asking during archive creation.

It would be good to see what the iOS folks are doing in this regard. The approach over their might have completely different contraints, but maybe it doesn't and the design there works over on Android just as well?

If I reboot my phone, my archives are locked, but is Buttercup still registered for Autofill? Is there a way to show something to the user in the Autofill popup that gets them to unlock one or more archives?

se1exin commented 5 years ago

@jokeyrhyme You make some really good points here.

Can a single Android app register multiple separate Autofill services

Only one Autofill service can be enabled at a time, however there is nothing stopping us from limiting on the app-side what is available in Autofill. So we could indeed implement per-archive autofill. I also think that it would be good to let the user choose which archives go into Autofill, which would also remove the need for an app-wide menu and let use just use the existing archive-level menu.

It would be good to see what the iOS folks are doing in this regard. The approach over their might have completely different contraints

Fortunately the constraints on iOS are quite similar (and for the most part is a shared codebase), so whatever we do here should also work in iOS with minimal work.

If I reboot my phone, my archives are locked, but is Buttercup still registered for Autofill?

Yep Buttercup will still be registered for Autofill after reboots without re-opening the Buttercup app first. Autofill on Android is achieved via an Android service, the Android OS takes care of most of the work in making sure things are available after reboots etc.

I'll start working on implementing the above and let you know how it looks. @perry-mitchell would be interesting to hear your feedback on the discussion so far as well.

perry-mitchell commented 5 years ago

With regards to #141:

I would like to formally request for feedback on how, where, and when the app should ask the user if they would like to enable AutoFill

That's a good question, maybe @sallar would want to weigh in on this too. I would think that it could happen in either of the following places:

This is from the cuff of course.. I'm not sure what would work best. It should obviously not prompt them again. The prompt (or the link to the settings page) should be reachable from a menu item, perhaps in the root of the unlocked vault?

perry-mitchell commented 5 years ago

I also think that it would be good to let the user choose which archives go into Autofill

I suppose this could be somewhat easily done by using a Enable/Disable menu option like for touch unlocking?

se1exin commented 5 years ago

I suppose this could be somewhat easily done by using a Enable/Disable menu option like for touch unlocking?

Yeh that's what I was thinking as well, just continue to use ActionSheet and pretty much replicate the TouchID enable/disable UX.

se1exin commented 5 years ago

Thanks for all the feedback @jokeyrhyme and @perry-mitchell

Android Autofill (#141) is now ready for review!

Note that the updates contain enabling/disabling autofill on a per-archive level, including on iOS, with backwards compatibility for the current iOS version that does not have archive-level control for autofill. In this case all archives are toggled as enabled as they will already have been put into autofill.

Let me know if anyone has any questions about the updates.