Repository navigation
feat(ui): Compose login screen for Login Flow v2 and account chooser - #1143
Draft
tobiasKaminsky wants to merge 2 commits into
Draft
tobiasKaminsky wants to merge 2 commits into
tobiasKaminsky wants to merge 2 commits into
Conversation
Every Nextcloud app implements server address entry and Login Flow v2 on its own, with diverging URL handling and polling behaviour. Sharing the UI and its state handling here lets new Compose apps such as Photos reuse it. The network part stays in the app (e.g. on top of android-library) behind LoginFlowV2Client, so android-common does not depend on android-library. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z
Apps with several accounts need the same switcher: account list with the current account marked, Files app (SSO) accounts badged, and entries to add or manage accounts. The app provides the avatars, so the component stays independent of how they are loaded. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Documentation | 23 minor |
| CodeStyle | 1 minor |
| Complexity | 7 medium |
🟢 Metrics 170 complexity · 2 duplication
Metric Results Complexity 170 Duplication 2
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two Compose building blocks for Nextcloud apps, starting with the new Photos app:
ui.login): server address entry, opening the login page in a Custom Tab, polling while the user logs in, and error states with retry. A statelessLoginFlowScreen(state, onEvent)plusLoginFlowViewModelthat the app hosts.ui.account): account list with an avatar slot, server host, a "Files app" badge for SSO accounts, a check mark for the current account, and "Add account" / "Manage accounts". Usable asAccountChooser(a lazy list),accountChooserItemsinside another lazy list, orAccountChooserBottomSheet.android-common must not depend on android-library, so the network part sits behind a small interface the app implements, for example on top of android-library's Login Flow v2 operations (PR in progress there):
The QR code scanner stays in the app. The screen only shows a "Scan QR code" button, and the app passes the scanned text back as
LoginFlowEvent.QrCodeScanned, whichLoginQrCodeParserturns into credentials.Behaviour compared with Files and Talk
https://addedhttps://addedhttp:///index.php,/index.php/apps/…,/remote.php/dav//index.php,/remote.phpor/status.php, plus query, fragment and trailing/ACTION_VIEWON_RESUMESavedStateHandlenc://login/&or/separators; server normalizednc://onetime-login/I could not find the
/user://password:separator in the current Files parser (it splits on&only). The parser still accepts it, because it costs nothing and keeps older codes working.Also:
androidx.browser:browser:1.10.0. New test dependency:kotlinx-coroutines-test:1.10.2, matching the coroutines version already on the classpath.verification-metadata.xmlupdated through--write-verification-metadata.LoginFlowCredentialsandLoginFlowStartmask the app password and poll token intoString().LoginFlowViewModelhas no Hilt dependency. Apps useLoginFlowViewModelFactory { client }or construct it themselves.Not validated on a live Nextcloud instance yet: the network adapter lives in the app and android-library, and isn't done. To test once the Photos app or the sample uses it: enter a server address without a scheme, log in through the browser, come back to the app (it should finish within a second), then try an
http://address, a wrong address, cancel while waiting, and a QR code from Personal settings > Security.🖼️ Screenshots
LoginFlowScreenPreview,AccountChooserPreview)🏁 Checklist
🤖 AI (if applicable)
Written with Claude Code (Claude Opus 5.5). The commits carry an
Assisted-bytrailer. They are not signed off yet: the contributor needs to review the code and add the DCO sign-off (git rebase --signoff mainand force-push) before this leaves draft.Agent notes
Local runs on ac5bb89:
./gradlew test lint assembleDebug spotlessKotlinCheck detektpassed. The 40:uiunit tests (including 36 new ones) pass. Lint reports nothing new exceptNewerVersionAvailablefor kotlinx-coroutines-test 1.11.0, kept at 1.10.2 to match coroutines-core.🤖 Generated with Claude Code
https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z