Repository navigation
refactor: migrate app passcode flows to SwiftUI - #4419
Open
marinofaggiana wants to merge 17 commits into
Open
marinofaggiana wants to merge 17 commits into
marinofaggiana wants to merge 17 commits into
Conversation
Support passcode authentication, creation, changes and removal with biometrics and shared lockout protection. Keep the existing passcode flow active until callers are migrated. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
Update lock settings after passcode completion and handle reset results. Add toolbar dismissal and require the current passcode when changing it. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
Require authentication in Debug builds and verify the account before executing E2EE actions. Present cancellable passcode flows as sheets and handle completion during dismissal. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
Use the shared passcode view for app unlock and enforced setup. Scope lifecycle handling to the presenting window scene and cancel optional operations when backgrounded. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
marinofaggiana
marked this pull request as draft
October 23, 2026 07:42
Replace TOPasscode in the main app and Share Extension, remove the legacy implementation, and add passcode UI tests. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
marinofaggiana
marked this pull request as ready for review
October 23, 2026 08:56
marinofaggiana
marked this pull request as draft
October 23, 2026 09:08
Clear only the retry counter and lockout deadline when the delay expires. Add UI coverage verifying app reset after ten failures across lockouts. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
marinofaggiana
marked this pull request as ready for review
October 23, 2026 09:26
Present the mandatory lock in a dedicated window per scene and preserve underlying UI after unlocking. Add UI regression coverage, improve authentication test handling, and enforce CI test timeouts with retained diagnostics. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
Allow the initial HTTPS request to time out before expecting the localhost authentication page, and skip UI queries against authentication services that are not running. Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com> Assisted-by: Codex:GPT-6
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.
Replace the legacy passcode implementation in the main app and Share Extension with shared SwiftUI components for app unlocking, passcode creation, change and removal, and E2EE authentication. Remove TOPasscodeViewController and its obsolete wrappers, and update third-party acknowledgements.
The implementation keeps the existing Keychain credentials and preferences, supports Face ID and Touch ID, and shares failed-attempt counters and lockout deadlines across passcode operations. Optional requests cancel when their scene enters the background; mandatory app unlocking remains non-dismissible. A dedicated window per scene presents the mandatory lock independently of existing sheets and alerts.
Fix the cumulative failed-attempt counter being cleared when the temporary lockout expires: the 60-second delay after three incorrect attempts now preserves the total used by the optional reset-after-ten-attempts policy. Successful authentication still clears both counters.
Local UI tests
The seven XCUITests in
PasscodeUITestsare intended to run locally. The CI test command explicitly excludes this suite with-skip-testing:NextcloudUITests/PasscodeUITests; it still compiles the tests and runs the remaining enabled tests. A green CI run therefore does not validate these seven scenarios.Setup and execution
http://localhost:8080, with credentialsadmin/admin. The repository providesTests/Server.sh. Keep the server running throughout the tests.docker exec --user www-data xcode-test-server php /var/www/html/occ config:system:set force_language --value=en curl --fail --show-error http://localhost:8080/status.phpinstalled: true,maintenance: falseandneedsDbUpgrade: false.Nextcloud.xcodeproj, select the Nextcloud scheme and the dedicated simulator, then open the Test navigator (⌘6). Run NextcloudUITests → PasscodeUITests, or run individual methods while investigating a failure.The Debug-only setup guarded by
UI_TESTINGandUI_TESTING_PASSCODEresets the passcode, counters and related lock settings before each test. The login helper reuses an existing signed-in account or performs the real web login when needed, including dismissal of the password-saving prompt. Persistence checks relaunch without the setup flags so stored credentials, counters and deadlines are preserved.Scenarios covered
testCreateChangeAndDisablePasscodetestDisableLockoutSurvivesReopeningBackgroundAndRelaunchtestChangePasscodeCannotResetFailedAttemptsByReopeningtestBackgroundCannotBypassMandatoryAppLocktestAppLockAppearsAbovePresentedSheettestAppLockAppearsAbovePresentedAlerttestAppResetAfterTenFailuresAcrossLockoutsAdditional manual verification
🤖 AI (if applicable)