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

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

Merged

Conversation

sunkup
Copy link
Member

@sunkup sunkup commented May 6, 2024

Purpose

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

Short description

LoginActivity:

  • Now using previously unused intentToInitialLoginType() to determine login type from intent.
  • Use selectLoginType() to change the login type accordingly

LoginScreenModel:

  • Alter selectLoginType() to also update the ui state of the login details page. Previously it only updated the ui state of the login type page.
  • Small lint fix

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

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@sunkup sunkup added the bug Something isn't working label May 6, 2024
@sunkup sunkup linked an issue May 6, 2024 that may be closed by this pull request
@sunkup sunkup requested a review from rfc2822 May 6, 2024 13:51
@sunkup sunkup marked this pull request as ready for review May 6, 2024 13:51
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@sunkup
Copy link
Member Author

sunkup commented May 9, 2024

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.

@sunkup sunkup requested a review from rfc2822 May 9, 2024 09:50
@rfc2822 rfc2822 force-pushed the 773-setup-through-the-nextcloud-app-intent-not-working branch from 2f75db0 to f4e2dd4 Compare May 17, 2024 08:53
@sunkup sunkup force-pushed the 773-setup-through-the-nextcloud-app-intent-not-working branch from f4e2dd4 to 488642a Compare May 17, 2024 10:32
@sunkup sunkup requested a review from rfc2822 May 17, 2024 10:43
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@rfc2822 rfc2822 force-pushed the 773-setup-through-the-nextcloud-app-intent-not-working branch from 161a7be to 8b81a02 Compare May 17, 2024 11:47
@rfc2822 rfc2822 force-pushed the 773-setup-through-the-nextcloud-app-intent-not-working branch from 8b81a02 to 2f9fdee Compare May 17, 2024 11:48
@rfc2822 rfc2822 merged commit f95b853 into main-ose May 17, 2024
7 checks passed
@rfc2822 rfc2822 deleted the 773-setup-through-the-nextcloud-app-intent-not-working branch May 17, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup through the Nextcloud app (intent) not working
2 participants