Repository navigation
feat: account setup in SwiftUI with the shared NextcloudKitUI onboarding and login - #4493
Merged
Merged
Conversation
Temporary: points NextcloudKit and NextcloudKitUI at the sibling worktree. Swap back to a tagged NextcloudKit release before merging. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
NCLoginHostingController shows NextcloudKitUI's ServerAddressView. Its NCLoginCoordinator maps the brand and MDM options to the login configuration, offers the untrusted-certificate and http fallback prompts, runs the managed-configuration auto-login, lists accounts of other Nextcloud apps and creates the account. NCProviderSignUp handles signing up with a provider through the login callback URL. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Add the login sources to the Nextcloud target and Login group, and the tests to NextcloudUnitTests, instead of Action Assistant and NextcloudUITests. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Every login entry point (window root, add-account modal, Intro push) now shows NCLoginHostingController. NCAccount.createAccount throws instead of presenting its own alert, so the login view can show the error and stay usable. Remove the old login screens (NCLogin, NCLoginProvider, NCLoginQRCode, NCShareAccounts), the QRCodeReader package, the unused client certificate delegate, the login-flow v2 state in AppDelegate and the English strings only they used. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Accounts of other apps are not suggested while the managed configuration logs in by itself, because their sheet would keep the login screen from closing. Managed server and user values are trimmed, and an invalid server address shows an error instead of doing nothing. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
The shared accounts file kept a removed account until the next export, so the login shown right after removing it offered that account again. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
The override only applied when the login was pushed from the intro, as the embedded navigation stack decides otherwise. The old login used the default style too. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signing up with a provider ended on the provider's web home screen. The sign-up page only returns the app login URL to page loads that carry the OCS API header, which a browser session cannot send. Show the sign-up in a web view that sends the header and the app user agent, as before the browser session, and add the account from the nc://login/ URL it ends on. nextcloud.com caches the sign-up page without regard to the header, so the first load adds a query to get a fresh page. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
The sign-up web view stayed blank when the page failed to load, for example while nextcloud.com is unreachable. It now shows the error with Retry and Close. Loads the web view replaces itself are not reported. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
The QR code scanner now stays open while its code logs in. The login is dismissed from its presenter so the scanner sheet closes with it, and a login replaced as the window root dismisses what it still shows. Only a sheet that is already closing is waited for before adding the account. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
The sign-up page could end on a blank screen without an error: a dead server only showed a spinner for a minute, the spinner vanished after the first redirect, HTTP error pages loaded as if they were fine, and a connection refused while the screen slid in dropped its alert. The first load now starts once the screen is shown, loads give up after 20 seconds without data, error responses and empty or unshowable pages show NextcloudKit's readable message, and the screen keeps its own spinner while loading. Retry loads the page that failed, a redirect loop ends in an error, a crashed web content process reloads once, and errors after the sign-up completes show in the sign-up's own window. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
…nother page A reply that is no profile, such as the login page of a proxy, has no error kind, so the sign-up and managed configuration banners showed nothing. It is now reported as an invalid response. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
…or the host is unknown Without a network or with a mistyped host name, the login offered to retry over insecure http, saying a secure connection had failed. Plain http can't help in those cases, so NextcloudKit's readable message is shown instead. Other https failures still offer the fallback, which is how http-only servers are reached. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
The managed configuration and provider sign-up banners said "The file or folder could not be found on the server." for a 404 while adding the account. A new login error context titles them "Couldn't log in" and words a 404 as "No server was found at this address."; other errors keep NextcloudKit's readable message. A kind-less reply to the app password request is reported as an invalid response instead of nothing. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
…edentials Providers running the current preferred_providers app hand over a temporary session token after the sign-up, which Nextcloud 33 refuses, so adding the account failed with 401. The sign-up now opens the login for the provider's server and starts it right away, so the user logs in to the new account in the browser and the app gets a lasting app password. The managed configuration auto-login doesn't run there. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
…he intro The override applies to the whole app, so it lives with the other navigation controller extensions before the intro goes away. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
NextcloudKitUI's onboarding replaces the intro carousel, and its login offers signing up with a provider and hosting a server, unless the brand disables the intro. One SwiftUI view and its model replace the intro, the login hosting controller, the login coordinator and the UIKit sign-up page. The certificate and insecure connection prompts are SwiftUI alerts. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
The app delegate allows only portrait while the account setup is shown, including the pages it presents, and the Info.plist orientations otherwise. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Continuing the onboarding is remembered in the preferences, so later launches without an account open the login directly. UI tests accept either screen. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com> # Conflicts: # Nextcloud.xcodeproj/project.pbxproj # Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Replaces the local package reference with the branch of nextcloud/NextcloudKit#278, so CI can build this. Switch to a release once that is merged. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
1 task done
Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Fold the managed auto-login error banners into one do/catch, set onCancel only when the cancel button should show (NextcloudKit drops showsCancelButton), replace the certificate details delegate and coordinator with an onClose closure, drop the unused intro selector constants and NCAccount.appDelegate, fix the stale transition comment and merge the cancelled classifier test into the unreachable cases. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Adding an account copied the last certificate the server presented into the trusted ones. A second QR code scan for a server with an untrusted certificate was therefore trusted without asking. Certificates are now trusted only from the certificate prompt. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
…ogins Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
7.7.0 contains the shared onboarding, login and provider sign-up of nextcloud/NextcloudKit#278. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com> # Conflicts: # Nextcloud.xcodeproj/project.pbxproj
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Account setup can disclose an existing account’s client certificate and proof of possession to unrelated servers, while missing certificate-import and password handling blocks fresh installs from adding certificate-protected servers.
2 open issues
What changed in this PR
Migrates account setup to SwiftUI using NextcloudKitUI’s shared onboarding and login, replacing the app’s UIKit implementation.
Changes:
- Adds a setup view and model for branding, managed login, certificate prompts and account creation.
- Updates account-entry points, onboarding persistence, login errors and tests.
- Pins NextcloudKit to 7.7.0 and removes obsolete screens, assets and QRCodeReader dependencies.
| File | Description |
|---|---|
| Tests/NextcloudUnitTests/NKErrorUserFriendlyMessageTests.swift | Tests login-specific error messages. |
| Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift | Tests certificate and HTTP recovery classification. |
| Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift | Tests managed login configuration. |
| Tests/NextcloudUnitTests/NCAccountSetupModelTests.swift | Tests certificate prompt handling. |
| Tests/NextcloudUITests/PasscodeUITests.swift | Accepts the new setup screens after reset. |
| Tests/NextcloudUITests/BaseUIXCTestCase.swift | Updates onboarding and login detection. |
| Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved | Pins NextcloudKit and removes QRCodeReader. |
| Nextcloud.xcodeproj/project.pbxproj | Registers new sources and removes legacy dependencies. |
| iOSClient/Supporting Files/en.lproj/Localizable.strings | Adds setup messages and removes unused strings. |
| iOSClient/Settings/NCPreferences.swift | Stores onboarding completion. |
| iOSClient/Settings/Acknowledgements.rtf | Removes QRCodeReader acknowledgement. |
| iOSClient/SceneDelegate.swift | Launches the SwiftUI setup. |
| iOSClient/Networking/NKError+UserFriendlyMessage.swift | Adds login-specific 404 wording. |
| iOSClient/Networking/NCNetworking.swift | Removes client-certificate UI callbacks. |
| iOSClient/Networking/NCErrorContext.swift | Adds login error context. |
| iOSClient/NCGlobal.swift | Removes obsolete intro selectors. |
| iOSClient/Login/NCViewCertificateDetails.swift | Replaces dismissal delegate with a closure. |
| iOSClient/Login/NCLoginServerErrorClassifier.swift | Classifies login recovery options. |
| iOSClient/Login/NCLoginQRCode.swift | Removes the legacy QR scanner. |
| iOSClient/Login/NCLoginProvider.swift | Removes the legacy browser login implementation. |
| iOSClient/Login/NCLoginAppConfig.swift | Extracts managed configuration parsing. |
| iOSClient/Login/NCLogin.swift | Removes the UIKit login controller. |
| iOSClient/Login/NCLogin.storyboard | Removes the UIKit login layout. |
| iOSClient/Login/NCAccountSetupView.swift | Hosts shared onboarding, login and prompts. |
| iOSClient/Login/NCAccountSetupModel.swift | Coordinates setup configuration and account creation. |
| iOSClient/Images.xcassets/certificate.imageset/Contents.json | Removes unused certificate asset metadata. |
| iOSClient/Images.xcassets/certificate.imageset/certificate.svg | Removes the unused certificate icon. |
| iOSClient/GUI/Lucid Banner/AlertActionBannerView.swift | Removes the obsolete account-discovery banner. |
| iOSClient/Files/NCFilesNavigationController.swift | Presents SwiftUI setup when adding accounts. |
| iOSClient/Files/NCFiles.swift | Shows setup when no accounts remain. |
| iOSClient/Extensions/UINavigationController+Extension.swift | Relocates existing status-bar forwarding. |
| iOSClient/Extensions/UIButton+Extension.swift | Removes obsolete login spinner helpers. |
| iOSClient/AppDelegate.swift | Updates certificate callbacks and setup orientation handling. |
| iOSClient/Account/NCAccount.swift | Propagates creation errors and updates setup transitions. |
| iOSClient/Account/Account Request/NCShareAccounts.swift | Removes the legacy shared-account picker. |
| iOSClient/Account/Account Request/NCShareAccounts.storyboard | Removes the shared-account picker layout. |
| Brand/Intro/NCIntroViewController.swift | Removes the UIKit intro carousel. |
| Brand/Intro/NCIntroCollectionViewCell.xib | Removes the intro cell layout. |
| Brand/Intro/NCIntroCollectionViewCell.swift | Removes the intro cell implementation. |
| Brand/Intro/NCIntro.storyboard | Removes the intro screen layout. |
| Brand/Custom.xcassets/intro4.imageset/Contents.json | Removes intro asset metadata. |
| Brand/Custom.xcassets/intro3.imageset/Contents.json | Removes intro asset metadata. |
| Brand/Custom.xcassets/intro2.imageset/Contents.json | Removes intro asset metadata. |
| Brand/Custom.xcassets/intro1.imageset/intro1.svg | Removes the legacy intro illustration. |
| Brand/Custom.xcassets/intro1.imageset/Contents.json | Removes intro asset metadata. |
| AGENTS.md | Updates the branding directory description. |
Review effort: Balanced
| func loginDidAppear() { | ||
| guard !hasLoginAppeared else { return } | ||
|
|
||
| hasLoginAppeared = true |
| let cert = (p12Data, self.p12Password) as? UserCertificate, | ||
| let pkcs12 = try? PKCS12(pkcs12Data: cert.data, password: cert.password, onIncorrectPassword: { | ||
| self.certificateDelegate?.onIncorrectPassword() | ||
| nkLog(error: "The client certificate password is incorrect.") |
# Conflicts: # Nextcloud.xcodeproj/project.pbxproj
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.


Replaces the UIKit login, intro and provider sign-up with NextcloudKitUI's shared onboarding and login, so the whole account setup is SwiftUI.
Uses NextcloudKit 7.7.0, which contains nextcloud/NextcloudKit#278.
What changes
OnboardingViewreplaces theBrand/Introcarousel. It shows once, before the first login, unlessdisable_introis set.ServerAddressViewwith the brand colors, QR code login, accounts from other apps, and — unlessdisable_introis set — "Sign up with a provider" and "Host your own server".NCAccountSetupView+NCAccountSetupModel(@Observable) in a plainUIHostingController. They handle branding, the managed configuration (including auto-login), the certificate trust and http prompts, and account creation.NCLogin,NCLoginProvider,NCLoginQRCode,NCShareAccounts,Brand/Intro, the intro images and their unused strings. The QRCodeReader package goes too; NextcloudKitUI scans with CodeScanner.Unchanged behavior
NCBrandOptions),enforce_servers,disable_request_login_url,loginBaseUrl.Tests
NCAccountSetupModelTests; UI tests use thecontinueOnboardingidentifier and accept the login without the onboarding.🤖 AI (if applicable)
🤖 Generated with Claude Code