bitfireAT / davx5-ose

DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android. You can also access your online files (WebDAV) with it.
https://www.davx5.com
GNU General Public License v3.0
1.3k stars 70 forks source link

Fix setup through nextcloud app (intent) not working #782

Closed sunkup closed 1 month ago

sunkup commented 1 month ago

Purpose

The nextcloud login/setup flow could not be started via intent. This fixes it.

Short description

LoginActivity:

LoginScreenModel:

See also: Creation of intent in nextcloud app.

Testing

Intent for testing:

adb shell am start -e url "https://davtest.dev001.net/nextcloud" -e loginFlow 1  at.bitfire.davdroid/at.bitfire.davdroid.ui.setup.LoginActivity

Checklist

sunkup commented 1 month ago

We could use the initial data approach here too:

* pass `initialLoginType` & `initialloginInfo` to the `LoginScreen`

* `LoginScreen` injects/creates the model with the initial data in the constructor

Then we could get rid of the if (savedInstanceState == null) and have better separation of concerns (no direct model access from outside).

While it would have been possible (and shorter in code) I have added an extra startPage parameter as well. The alternative is to infer the starting page from the login type inside the model, which is shorter, but less flexible. I can change that back if you prefer :)

The advantage would be that future intents could start the correct login page more easily.