From f858313870355441a5e63e2fe32895661f466f9a Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 19 Nov 2026 16:59:12 +0100 Subject: [PATCH 01/30] chore: use local NextcloudKit-shared-login package 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 Signed-off-by: Milen Pivchev --- Nextcloud.xcodeproj/project.pbxproj | 28 ++++++------------- .../xcshareddata/swiftpm/Package.resolved | 9 ------ 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 581547461f..0ff8f0cc72 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -4361,7 +4361,7 @@ F76DA967277B77E90082465B /* XCRemoteSwiftPackageReference "DropDown" */, F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */, F753BA91281FD8010015BFB6 /* XCRemoteSwiftPackageReference "EasyTipView" */, - F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */, + A1B2C3D4E5F6A7B8C9D0E1F2 /* XCLocalSwiftPackageReference "../NextcloudKit-shared-login" */, F734B06428E75C0100E180D5 /* XCRemoteSwiftPackageReference "TLPhotoPicker" */, F77333862927A72100466E35 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */, F77BC3E9293E5268005F2B08 /* XCRemoteSwiftPackageReference "swifter" */, @@ -6958,6 +6958,13 @@ }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + A1B2C3D4E5F6A7B8C9D0E1F2 /* XCLocalSwiftPackageReference "../NextcloudKit-shared-login" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = "../NextcloudKit-shared-login"; + }; +/* End XCLocalSwiftPackageReference section */ + /* Begin XCRemoteSwiftPackageReference section */ F3374AEE2D78B01B002A38F9 /* XCRemoteSwiftPackageReference "swift-collections" */ = { isa = XCRemoteSwiftPackageReference; @@ -7063,14 +7070,6 @@ kind = branch; }; }; - F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/nextcloud/NextcloudKit"; - requirement = { - branch = main; - kind = branch; - }; - }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/bmoliveira/MarkdownKit"; @@ -7184,7 +7183,6 @@ }; F37208B72BAB63EF006B5430 /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F37208B92BAB63EF006B5430 /* TLPhotoPicker */ = { @@ -7259,7 +7257,6 @@ }; F70CAC7C30408F2600CCCB7F /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F70CAC7E30408F3100CCCB7F /* KeychainAccess */ = { @@ -7314,22 +7311,18 @@ }; F72AD70C28C24B93006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72AD70E28C24BA1006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72AD71028C24BBB006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72AD71228C24BCC006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72DA9B325F53E4E00B87DB1 /* SwiftRichString */ = { @@ -7349,7 +7342,6 @@ }; F7490E8A29882CE4009DCE94 /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F753BA92281FD8020015BFB6 /* EasyTipView */ = { @@ -7424,7 +7416,6 @@ }; F783034328B5142B00B84583 /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F788ECC6263AAAFA00ADC67F /* MarkdownKit */ = { @@ -7439,12 +7430,10 @@ }; F7A27B2C3053007C00EF02C7 /* NextcloudKitUI */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKitUI; }; F7A8D72328F1771B008BBE1C /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F7A8D72728F17728008BBE1C /* RealmSwift */ = { @@ -7454,7 +7443,6 @@ }; F7C55C9E2FB5B83A004A974F /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F7D4BF532CA2ED9D00A5E746 /* VLCKitSPM */ = { diff --git a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4eb75c43d5..7cb7678f06 100644 --- a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -199,15 +199,6 @@ "version" : "2.30910.1" } }, - { - "identity" : "nextcloudkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/nextcloud/NextcloudKit", - "state" : { - "branch" : "main", - "revision" : "b1bbf831daca1cca49a7b5637e3cf290b7a9393e" - } - }, { "identity" : "openssl-package", "kind" : "remoteSourceControl", From c48328cd75d3355747b8e944b4e48b286265edc7 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 19 Nov 2026 17:14:03 +0100 Subject: [PATCH 02/30] feat: host the shared NextcloudKitUI login 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 Signed-off-by: Milen Pivchev --- Nextcloud.xcodeproj/project.pbxproj | 28 ++ .../NCLoginAppConfigTests.swift | 61 ++++ .../NCLoginServerErrorClassifierTests.swift | 44 +++ iOSClient/Login/NCLoginAppConfig.swift | 47 ++++ iOSClient/Login/NCLoginCoordinator.swift | 264 ++++++++++++++++++ .../Login/NCLoginHostingController.swift | 62 ++++ .../Login/NCLoginServerErrorClassifier.swift | 41 +++ iOSClient/Login/NCProviderSignUp.swift | 67 +++++ 8 files changed, 614 insertions(+) create mode 100644 Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift create mode 100644 Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift create mode 100644 iOSClient/Login/NCLoginAppConfig.swift create mode 100644 iOSClient/Login/NCLoginCoordinator.swift create mode 100644 iOSClient/Login/NCLoginHostingController.swift create mode 100644 iOSClient/Login/NCLoginServerErrorClassifier.swift create mode 100644 iOSClient/Login/NCProviderSignUp.swift diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 0ff8f0cc72..51a3be4e21 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 22BA14432CF44BDBA2E6C291 /* NCDocumentEditorSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B74B947E07444CC9CFE0A6C /* NCDocumentEditorSupportTests.swift */; }; + 2A3D983FCEC820C453EDD1CC /* NCLoginHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */; }; 2C1D5D7623E2DE3300334ABB /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; }; 2C1D5D7923E2DE9100334ABB /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; }; 2C33C48223E2C475005F963B /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C33C48123E2C475005F963B /* NotificationService.swift */; }; @@ -15,6 +16,7 @@ 2EF7D3FD0885CE182717578E /* NKError+UserFriendlyMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DFE0BDF3898A66910E67CA /* NKError+UserFriendlyMessage.swift */; }; 370D26AF248A3D7A00121797 /* NCCellMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 370D26AE248A3D7A00121797 /* NCCellMain.swift */; }; 63563FE53573412998852DD3 /* NCAlbumsPersistenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 439616AAA50F4360A761E5EF /* NCAlbumsPersistenceTests.swift */; }; + 729609D38218F8A21700723C /* NCLoginAppConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCCD8BFC693B6BB556D97C47 /* NCLoginAppConfigTests.swift */; }; 7670DABED44E4D56AD99E6DC /* NCPasscodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F902B24E44354B6D9F329F12 /* NCPasscodeView.swift */; }; 822D68B06B101563A759AD59 /* NKError+UserFriendlyMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DFE0BDF3898A66910E67CA /* NKError+UserFriendlyMessage.swift */; }; 87768C6AB8E040219DF85898 /* NCPasscodeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 131F8E2F43AD414E9DB53019 /* NCPasscodeModel.swift */; }; @@ -75,6 +77,7 @@ AAFC0D062F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D032F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift */; }; AAFC0D092F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D082F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift */; }; AAFC0D0B2F9AA10000F0A001 /* NCAutoUploadCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D0A2F9AA10000F0A001 /* NCAutoUploadCounter.swift */; }; + AB0BFE5B60D759FFBDEE99FF /* NCLoginCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */; }; AB1028260000000000030000 /* NCShareEntryController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1028260000000000020000 /* NCShareEntryController.swift */; }; AB1028260000000000030002 /* NCShareViewModel+Accounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1028260000000000020002 /* NCShareViewModel+Accounts.swift */; }; AB1028260000000000030003 /* NCShareViewModel+Folders.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1028260000000000020003 /* NCShareViewModel+Folders.swift */; }; @@ -142,6 +145,7 @@ AFCE353527E4ED5900FEA6C2 /* DateFormatter+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */; }; AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; }; AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* Shareable.swift */; }; + B5E6D3241C08B33DD08B09FE /* NCLoginAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */; }; B601AA012F10000100C0D3E5 /* NCLogFilesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B601AA002F10000100C0D3E5 /* NCLogFilesView.swift */; }; BAF64949B487A080A98F83F2 /* NKErrorUserFriendlyMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320C20803A58DAF7575440A8 /* NKErrorUserFriendlyMessageTests.swift */; }; C0DEA070306D000100000005 /* NCLocalDatabase+AutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEA070306D000100000004 /* NCLocalDatabase+AutoUpload.swift */; }; @@ -149,9 +153,12 @@ C0DEA070306D000100000008 /* NCAutoUploadAssetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEA070306D000100000007 /* NCAutoUploadAssetTests.swift */; }; C0DECA022F65000100C0D001 /* NCCameraRollTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DECA012F65000100C0D001 /* NCCameraRollTests.swift */; }; C0DEDA7E30C1000100A00002 /* NCAutoUploadDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEDA7E30C1000100A00001 /* NCAutoUploadDateTests.swift */; }; + C27C31EC91411047C288D266 /* NCProviderSignUp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */; }; + C7724CB38D2A7B4B98CA1AFA /* NCLoginServerErrorClassifierTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */; }; CB3666201AF7550816B5CD6A /* NCContextMenuComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8932E90EC4278026D86CCCC9 /* NCContextMenuComment.swift */; }; D56DFFE5D5014F66A7C9FED0 /* PasscodeUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC6C501EF1104A6A8569D9C1 /* PasscodeUITests.swift */; }; D5B6AA7827200C7200D49C24 /* NCActivityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */; }; + DE4831E27DECD1D32A381E00 /* NCLoginServerErrorClassifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */; }; EB511D22564B7B9A605E70AE /* NCErrorContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0CD9A00D74B01055F238E9 /* NCErrorContext.swift */; }; F0A1B2C430B5000100D4E5F6 /* NCMediaViewerFloatingTitleViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A1B2C330B5000100D4E5F6 /* NCMediaViewerFloatingTitleViewTests.swift */; }; F0A1B2C630B6000100D4E5F6 /* NCImageZoomViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A1B2C530B6000100D4E5F6 /* NCImageZoomViewTests.swift */; }; @@ -1286,10 +1293,14 @@ 2C33C48A23E2CC26005F963B /* Notification_Service_Extension-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Notification_Service_Extension-Bridging-Header.h"; sourceTree = ""; }; 320C20803A58DAF7575440A8 /* NKErrorUserFriendlyMessageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NKErrorUserFriendlyMessageTests.swift; sourceTree = ""; }; 370D26AE248A3D7A00121797 /* NCCellMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCellMain.swift; sourceTree = ""; }; + 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCProviderSignUp.swift; sourceTree = ""; }; 439616AAA50F4360A761E5EF /* NCAlbumsPersistenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAlbumsPersistenceTests.swift; sourceTree = ""; }; 4B74B947E07444CC9CFE0A6C /* NCDocumentEditorSupportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCDocumentEditorSupportTests.swift; sourceTree = ""; }; + 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginServerErrorClassifier.swift; sourceTree = ""; }; + 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginAppConfig.swift; sourceTree = ""; }; 79DFE0BDF3898A66910E67CA /* NKError+UserFriendlyMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NKError+UserFriendlyMessage.swift"; sourceTree = ""; }; 8932E90EC4278026D86CCCC9 /* NCContextMenuComment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuComment.swift; sourceTree = ""; }; + 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginHostingController.swift; sourceTree = ""; }; A0C0DE0130E0000100C0D001 /* NCPasscodeWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCPasscodeWindow.swift; sourceTree = ""; }; A1E2EE010000000000000001 /* NCEndToEndKeySet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndKeySet.swift; sourceTree = ""; }; A1E2EE010000000000000009 /* NCEndToEndKeySetArchiveTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndKeySetArchiveTests.swift; sourceTree = ""; }; @@ -1440,6 +1451,7 @@ B601AA002F10000100C0D3E5 /* NCLogFilesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCLogFilesView.swift; sourceTree = ""; }; BB7697C94BA14450A0867940 /* NCContextMenuProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuProfile.swift; sourceTree = ""; }; BC6C501EF1104A6A8569D9C1 /* PasscodeUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasscodeUITests.swift; sourceTree = ""; }; + BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginCoordinator.swift; sourceTree = ""; }; C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C04E2F202A17BB4D001BAD85 /* NextcloudIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C0DEA070306D000100000004 /* NCLocalDatabase+AutoUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCLocalDatabase+AutoUpload.swift"; sourceTree = ""; }; @@ -1447,7 +1459,9 @@ C0DECA012F65000100C0D001 /* NCCameraRollTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCameraRollTests.swift; sourceTree = ""; }; C0DEDA7E30C1000100A00001 /* NCAutoUploadDateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAutoUploadDateTests.swift; sourceTree = ""; }; CE0CD9A00D74B01055F238E9 /* NCErrorContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCErrorContext.swift; sourceTree = ""; }; + CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginServerErrorClassifierTests.swift; sourceTree = ""; }; D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = ""; }; + DCCD8BFC693B6BB556D97C47 /* NCLoginAppConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginAppConfigTests.swift; sourceTree = ""; }; F0A1B2C330B5000100D4E5F6 /* NCMediaViewerFloatingTitleViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMediaViewerFloatingTitleViewTests.swift; sourceTree = ""; }; F0A1B2C530B6000100D4E5F6 /* NCImageZoomViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCImageZoomViewTests.swift; sourceTree = ""; }; F31165012F9674A1009A1E37 /* AppIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = AppIcon.icon; sourceTree = ""; }; @@ -2331,6 +2345,8 @@ AA8D31692D4123B200FE2775 /* DownloadLimitViewModel.swift */, AA8D316A2D4123B200FE2775 /* NCShareDownloadLimitTableViewController.swift */, AA8D316B2D4123B200FE2775 /* NCShareDownloadLimitTableViewControllerDelegate.swift */, + DCCD8BFC693B6BB556D97C47 /* NCLoginAppConfigTests.swift */, + CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */, AA8D316C2D4123B200FE2775 /* NCShareDownloadLimitViewController.swift */, ); path = DownloadLimit; @@ -3562,6 +3578,11 @@ B6DE60601BB3410D92EB99EC /* Passcode */, F39170A82CB8201B006127BC /* FileAutoRenamer+Extensions.swift */, F33918C32C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift */, + 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */, + BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */, + 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */, + 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */, + 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */, F752BA042E58C05200616A26 /* Maintenance.swift */, F7F562FF2E15761500631A11 /* MigrationMultiDomains.swift */, F76D364528A4F8BF00214537 /* NCActivityIndicator.swift */, @@ -4715,6 +4736,8 @@ AAA7BC302D3E3B88008F1A22 /* CapabilityResponse.swift in Sources */, F3374A942D674454002A38F9 /* AssistantUITests.swift in Sources */, AA3C85EB2D36BBFB00F74F12 /* OCSResponse.swift in Sources */, + 729609D38218F8A21700723C /* NCLoginAppConfigTests.swift in Sources */, + C7724CB38D2A7B4B98CA1AFA /* NCLoginServerErrorClassifierTests.swift in Sources */, AA74AA972D3172D100BE3458 /* UITestError.swift in Sources */, AA3C85E82D36B08C00F74F12 /* UITestBackend.swift in Sources */, AA8E03DC2D2FBAC200E7E89C /* DownloadLimitUITests.swift in Sources */, @@ -5469,6 +5492,11 @@ F7C55C8F2FB5B045004A974F /* NCBrand.swift in Sources */, F72A493A306AA8B600A49375 /* NCPreferences.swift in Sources */, F7C55C8E2FB5B03D004A974F /* NCGlobal.swift in Sources */, + B5E6D3241C08B33DD08B09FE /* NCLoginAppConfig.swift in Sources */, + AB0BFE5B60D759FFBDEE99FF /* NCLoginCoordinator.swift in Sources */, + 2A3D983FCEC820C453EDD1CC /* NCLoginHostingController.swift in Sources */, + DE4831E27DECD1D32A381E00 /* NCLoginServerErrorClassifier.swift in Sources */, + C27C31EC91411047C288D266 /* NCProviderSignUp.swift in Sources */, F72A493B306AA8DC00A49375 /* AwakeMode.swift in Sources */, F7C55CC92FB5CE74004A974F /* ActionViewController.swift in Sources */, F7C55C9B2FB5B1A7004A974F /* UIColor+Extension.swift in Sources */, diff --git a/Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift b/Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift new file mode 100644 index 0000000000..78e321380f --- /dev/null +++ b/Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift @@ -0,0 +1,61 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import Testing +@testable import Nextcloud + +@Suite("Login managed configuration") +struct NCLoginAppConfigTests { + private let server = "https://cloud.example.com" + + private func action(_ managed: [String: Any]?, useAppConfig: Bool = true, disableMultiaccount: Bool = false, accountCount: Int = 0) -> NCLoginAppConfig.Action? { + NCLoginAppConfig.action(managed: managed, useAppConfig: useAppConfig, disableMultiaccount: disableMultiaccount, accountCount: accountCount) + } + + @Test("Nothing without a managed configuration or server") + func noAction() { + #expect(action(nil) == nil) + #expect(action([:]) == nil) + #expect(action(["serverUrl": ""]) == nil) + #expect(action(["username": "jane", "apppassword": "secret"]) == nil) + } + + @Test("Server alone prefills the address") + func prefill() { + #expect(action(["serverUrl": server]) == .prefill(serverURL: server)) + } + + @Test("Server, user and app password create the account") + func createAccount() { + let managed = ["serverUrl": server, "username": "jane", "apppassword": "secret", "password": "plain"] + + #expect(action(managed) == .createAccount(serverURL: server, user: "jane", appPassword: "secret")) + } + + @Test("Server, user and password request an app password") + func requestAppPassword() { + let managed = ["serverUrl": server, "username": "jane", "password": "plain"] + + #expect(action(managed) == .requestAppPassword(serverURL: server, user: "jane", password: "plain")) + } + + @Test("Template placeholder values are ignored") + func placeholders() { + let managed = ["serverUrl": server, "username": "Username", "password": "password", "apppassword": "AppPassword"] + + #expect(action(managed) == .prefill(serverURL: server)) + } + + @Test("Ignored unless the brand enables the managed configuration") + func disabled() { + #expect(action(["serverUrl": server], useAppConfig: false) == nil) + } + + @Test("A single-account brand only uses it for the first account") + func singleAccount() { + #expect(action(["serverUrl": server], disableMultiaccount: true, accountCount: 1) == nil) + #expect(action(["serverUrl": server], disableMultiaccount: true, accountCount: 0) == .prefill(serverURL: server)) + #expect(action(["serverUrl": server], disableMultiaccount: false, accountCount: 1) == .prefill(serverURL: server)) + } +} diff --git a/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift b/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift new file mode 100644 index 0000000000..a8d85f578e --- /dev/null +++ b/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import Foundation +import NextcloudKit +import Testing +@testable import Nextcloud + +@Suite("Login server error classification") +struct NCLoginServerErrorClassifierTests { + private let httpsURL = URL(string: "https://cloud.example.com:8443/nextcloud/")! + + @Test("Certificate errors ask to trust the certificate", arguments: [ + NSURLErrorServerCertificateUntrusted, + NSURLErrorServerCertificateHasBadDate, + NSURLErrorServerCertificateHasUnknownRoot, + NSURLErrorServerCertificateNotYetValid + ]) + func untrustedCertificate(errorCode: Int) { + let resolution = NCLoginServerErrorClassifier.classify(NKError(errorCode: errorCode), serverURL: httpsURL) + + #expect(resolution == .untrustedCertificate(host: "cloud.example.com")) + } + + @Test("Other https failures offer http with the same port and path", arguments: [NSURLErrorCannotConnectToHost, NSURLErrorSecureConnectionFailed, 404]) + func insecureFallback(errorCode: Int) { + let resolution = NCLoginServerErrorClassifier.classify(NKError(errorCode: errorCode), serverURL: httpsURL) + + #expect(resolution == .insecureFallback(URL(string: "http://cloud.example.com:8443/nextcloud/")!)) + } + + @Test("Failures over http are shown") + func httpFailure() { + let httpURL = URL(string: "http://cloud.example.com/")! + + #expect(NCLoginServerErrorClassifier.classify(NKError(errorCode: NSURLErrorCannotConnectToHost), serverURL: httpURL) == .generic) + } + + @Test("Cancelled requests are shown") + func cancelled() { + #expect(NCLoginServerErrorClassifier.classify(NKError(errorCode: NSURLErrorCancelled), serverURL: httpsURL) == .generic) + } +} diff --git a/iOSClient/Login/NCLoginAppConfig.swift b/iOSClient/Login/NCLoginAppConfig.swift new file mode 100644 index 0000000000..0649a63e36 --- /dev/null +++ b/iOSClient/Login/NCLoginAppConfig.swift @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import Foundation + +/// Login values from the managed app configuration (MDM). +enum NCLoginAppConfig { + enum Action: Equatable { + case createAccount(serverURL: String, user: String, appPassword: String) + case requestAppPassword(serverURL: String, user: String, password: String) + case prefill(serverURL: String) + } + + static func action(managed: [String: Any]?, useAppConfig: Bool, disableMultiaccount: Bool, accountCount: Int) -> Action? { + guard useAppConfig, + let managed, + disableMultiaccount == false || accountCount == 0 else { + return nil + } + + let global = NCGlobal.shared + + guard let serverURL = value(in: managed, for: global.configuration_serverUrl, placeholder: nil) else { return nil } + + let user = value(in: managed, for: global.configuration_username, placeholder: "username") + let password = value(in: managed, for: global.configuration_password, placeholder: "password") + let appPassword = value(in: managed, for: global.configuration_apppassword, placeholder: "apppassword") + + if let user, let appPassword { + return .createAccount(serverURL: serverURL, user: user, appPassword: appPassword) + } + + if let user, let password { + return .requestAppPassword(serverURL: serverURL, user: user, password: password) + } + + return .prefill(serverURL: serverURL) + } + + /// MDM templates ship the key name as a placeholder value. + private static func value(in managed: [String: Any], for key: String, placeholder: String?) -> String? { + guard let value = managed[key] as? String, !value.isEmpty, value.lowercased() != placeholder else { return nil } + + return value + } +} diff --git a/iOSClient/Login/NCLoginCoordinator.swift b/iOSClient/Login/NCLoginCoordinator.swift new file mode 100644 index 0000000000..6954394ae8 --- /dev/null +++ b/iOSClient/Login/NCLoginCoordinator.swift @@ -0,0 +1,264 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import NextcloudKit +import NextcloudKitUI +import SwiftUI +import UIKit + +/// Connects the shared NextcloudKitUI login to the app: branding, managed configuration, certificate trust and account creation. +@MainActor +final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { + enum Presentation { + case windowRoot + case modal + case pushed + } + + weak var presenter: UIViewController? + + private let presentation: Presentation + private let controller: NCMainTabBarController? + private var certificateDetailsContinuation: CheckedContinuation? + + init(controller: NCMainTabBarController?, presentation: Presentation) { + self.controller = controller + self.presentation = presentation + } + + // MARK: - Configuration + + /// Built from the brand options at presentation time, so values overridden by the managed configuration apply. + func makeConfiguration() -> LoginFlowConfiguration { + let brandOptions = NCBrandOptions.shared + var configuration = LoginFlowConfiguration() + + configuration.foregroundColor = NCBrandColor.shared.customer.isTooLight() ? .black : .white + configuration.serverAddressDescription = String.localizedStringWithFormat(NSLocalizedString("_login_address_detail_", comment: ""), brandOptions.brand) + configuration.enforcedServersPrompt = NSLocalizedString("_select_server_", comment: "") + + if case .prefill(let serverURL) = appConfigAction { + configuration.initialServerAddress = serverURL + } else if !brandOptions.loginBaseUrl.isEmpty { + configuration.initialServerAddress = brandOptions.loginBaseUrl + } + + configuration.isServerAddressEditable = !brandOptions.disable_request_login_url + configuration.enforcedServers = brandOptions.enforce_servers.compactMap { server in + URL(string: server.url).map { LoginFlowConfiguration.Server(name: server.name, url: $0) } + } + configuration.upgradesInsecureHTTP = true + configuration.loginURLScheme = brandOptions.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "") + configuration.embedsNavigationStack = presentation != .pushed + configuration.showsCancelButton = presentation == .modal && !NCManageDatabase.shared.getAllTableAccount().isEmpty + + configuration.onCancel = { [weak self] in + self?.presenter?.dismiss(animated: true) + } + + configuration.onServerError = { [weak self] error, serverURL in + await self?.recover(from: error, serverURL: serverURL) ?? .presentError + } + + return configuration + } + + /// Accounts of other Nextcloud apps on this device which are not added here yet. + func loadSharedAccounts() -> [SharedAccount] { + guard let directory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps), + let shareAccounts = NKShareAccounts().getShareAccount(at: directory, application: UIApplication.shared) else { + return [] + } + + return shareAccounts.compactMap { shareAccount in + let predicate = NSPredicate(format: "urlBase == %@ AND user == %@", shareAccount.url, shareAccount.user) + + guard NCManageDatabase.shared.getTableAccount(predicate: predicate) == nil, + let host = URL(string: shareAccount.url) else { + return nil + } + + let name = shareAccount.name.flatMap { $0.isEmpty ? nil : $0 } ?? shareAccount.user + let image = shareAccount.image.map { Image(uiImage: $0) } ?? Image(systemName: "person.crop.circle") + + return SharedAccount(name, user: shareAccount.user, on: host, with: image) + } + } + + // MARK: - Account + + func addAccount(host: URL, user: String, password: String) async throws { + guard let presenter else { return } + + // A closing QR scanner or shared accounts sheet would otherwise receive the dismissal below. + await waitForPresentedViewControllerDismissal() + + let controller = self.controller ?? SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) + + if let host = host.host { + NCNetworking.shared.writeCertificate(host: host) + } + + try await NCAccount().createAccount(viewController: presenter, urlBase: host.absoluteString, user: user, password: password, controller: controller) + } + + // MARK: - Managed configuration + + private var appConfigAction: NCLoginAppConfig.Action? { +#if DEBUG + // Passcode UI tests provision an account through the same path as the managed configuration. + let process = ProcessInfo.processInfo + let environment = process.environment + + if process.arguments.contains("UI_TESTING"), process.arguments.contains("UI_TESTING_PASSCODE"), + let server = environment["UI_TESTING_PASSCODE_SERVER"], + let username = environment["UI_TESTING_PASSCODE_USERNAME"], + let password = environment["UI_TESTING_PASSCODE_PASSWORD"] { + return .requestAppPassword(serverURL: server, user: username, password: password) + } +#endif + return NCLoginAppConfig.action(managed: UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"), + useAppConfig: NCBrandOptions.shared.use_AppConfig, + disableMultiaccount: NCBrandOptions.shared.disable_multiaccount, + accountCount: NCManageDatabase.shared.getAccounts()?.count ?? 0) + } + + func runAppConfigAutoLoginIfNeeded() async { + let serverURL: String + let user: String + let password: String + + switch appConfigAction { + case .createAccount(let url, let name, let appPassword): + serverURL = url + user = name + password = appPassword + case .requestAppPassword(let url, let name, let userPassword): + let results = await NextcloudKit.shared.getAppPasswordAsync(url: url, user: name, password: userPassword) + + guard results.error == .success, let token = results.token else { + await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: results.error == .success ? .invalidData : results.error) + return + } + + serverURL = url + user = name + password = token + case .prefill, nil: + return + } + + guard let host = URL(string: serverURL) else { return } + + do { + try await addAccount(host: host, user: user, password: password) + } catch { + await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: error as? NKError ?? NKError(error: error)) + } + } + + // MARK: - Server errors + + private func recover(from error: NKError, serverURL: URL) async -> LoginFlowConfiguration.Recovery { + switch NCLoginServerErrorClassifier.classify(error, serverURL: serverURL) { + case .untrustedCertificate(let host): + return await resolveUntrustedCertificate(host: host, serverURL: serverURL) + case .insecureFallback(let httpURL): +#if DEBUG + return .retry(httpURL) +#else + let choice = await presentChoice(title: NSLocalizedString("_warning_", comment: ""), + message: NSLocalizedString("_https_failed_try_http_", comment: ""), + actions: [(NSLocalizedString("_cancel_", comment: ""), .cancel), + (NSLocalizedString("_continue_", comment: ""), .destructive)]) + + return choice == 1 ? .retry(httpURL) : .cancel +#endif + case .generic: + return .presentError + } + } + + private func resolveUntrustedCertificate(host: String, serverURL: URL) async -> LoginFlowConfiguration.Recovery { + while true { + let choice = await presentChoice(title: NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), + message: NSLocalizedString("_connect_server_anyway_", comment: ""), + actions: [(NSLocalizedString("_yes_", comment: ""), .default), + (NSLocalizedString("_no_", comment: ""), .default), + (NSLocalizedString("_certificate_details_", comment: ""), .default)]) + + switch choice { + case 0: + NCNetworking.shared.writeCertificate(host: host) + return .retry(serverURL) + case 2: + await presentCertificateDetails(host: host) + default: + return .cancel + } + } + } + + // MARK: - Presentation + + private var topViewController: UIViewController? { + var top = presenter + + while let presented = top?.presentedViewController, !presented.isBeingDismissed { + top = presented + } + + return top + } + + /// - Returns: The index of the chosen action, or `nil` when nothing could present the alert. + private func presentChoice(title: String, message: String, actions: [(title: String, style: UIAlertAction.Style)]) async -> Int? { + await waitForPresentedViewControllerDismissal() + + guard let topViewController else { return nil } + + return await withCheckedContinuation { continuation in + let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) + + for (index, action) in actions.enumerated() { + alertController.addAction(UIAlertAction(title: action.title, style: action.style) { _ in + continuation.resume(returning: index) + }) + } + + topViewController.present(alertController, animated: true) + } + } + + private func presentCertificateDetails(host: String) async { + guard let topViewController, + let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() as? UINavigationController, + let viewController = navigationController.topViewController as? NCViewCertificateDetails else { + return + } + + viewController.host = host + viewController.delegate = self + + await withCheckedContinuation { continuation in + certificateDetailsContinuation = continuation + topViewController.present(navigationController, animated: true) + } + } + + nonisolated func viewCertificateDetailsDismiss(host: String) { + MainActor.assumeIsolated { + certificateDetailsContinuation?.resume() + certificateDetailsContinuation = nil + } + } + + private func waitForPresentedViewControllerDismissal() async { + let deadline = ContinuousClock.now + .seconds(2) + + while presenter?.presentedViewController != nil, ContinuousClock.now < deadline { + try? await Task.sleep(for: .milliseconds(50)) + } + } +} diff --git a/iOSClient/Login/NCLoginHostingController.swift b/iOSClient/Login/NCLoginHostingController.swift new file mode 100644 index 0000000000..a7bb984930 --- /dev/null +++ b/iOSClient/Login/NCLoginHostingController.swift @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import NextcloudKitUI +import SwiftUI +import UIKit + +/// Hosts the shared NextcloudKitUI login for every place the app shows its login screen. +final class NCLoginHostingController: UIHostingController { + private let coordinator: NCLoginCoordinator + private var hasAppeared = false + + init(controller: NCMainTabBarController?, presentation: NCLoginCoordinator.Presentation) { + let coordinator = NCLoginCoordinator(controller: controller, presentation: presentation) + + let rootView = ServerAddressView(backgroundColor: .constant(Color(uiColor: NCBrandColor.shared.customer)), + brandImage: Image("logo"), + sharedAccounts: coordinator.loadSharedAccounts(), + userAgent: userAgent, + configuration: coordinator.makeConfiguration()) { host, name, password in + try await coordinator.addAccount(host: host, user: name, password: password) + } + + self.coordinator = coordinator + + super.init(rootView: rootView) + + coordinator.presenter = self + } + + @available(*, unavailable) + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override var preferredStatusBarStyle: UIStatusBarStyle { + NCBrandColor.shared.customer.isTooLight() ? .darkContent : .lightContent + } + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = NCBrandColor.shared.customer + + Task { + _ = await NCAccount().updateAppsShareAccounts() + } + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + guard !hasAppeared else { return } + + hasAppeared = true + + Task { + await coordinator.runAppConfigAutoLoginIfNeeded() + } + } +} diff --git a/iOSClient/Login/NCLoginServerErrorClassifier.swift b/iOSClient/Login/NCLoginServerErrorClassifier.swift new file mode 100644 index 0000000000..ca90372602 --- /dev/null +++ b/iOSClient/Login/NCLoginServerErrorClassifier.swift @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import Foundation +import NextcloudKit + +/// Decides how the login reacts to a failed server status check. +enum NCLoginServerErrorClassifier { + enum Resolution: Equatable { + case untrustedCertificate(host: String) + case insecureFallback(URL) + case generic + } + + private static let certificateErrorCodes = [ + NSURLErrorServerCertificateUntrusted, + NSURLErrorServerCertificateHasBadDate, + NSURLErrorServerCertificateHasUnknownRoot, + NSURLErrorServerCertificateNotYetValid + ] + + static func classify(_ error: NKError, serverURL: URL) -> Resolution { + if certificateErrorCodes.contains(error.errorCode), let host = serverURL.host { + return .untrustedCertificate(host: host) + } + + // Any other failed https attempt may fall back to plain http. + guard error.kind != .cancelled, + serverURL.scheme?.lowercased() == "https", + var components = URLComponents(url: serverURL, resolvingAgainstBaseURL: false) else { + return .generic + } + + components.scheme = "http" + + guard let httpURL = components.url else { return .generic } + + return .insecureFallback(httpURL) + } +} diff --git a/iOSClient/Login/NCProviderSignUp.swift b/iOSClient/Login/NCProviderSignUp.swift new file mode 100644 index 0000000000..e1696349e5 --- /dev/null +++ b/iOSClient/Login/NCProviderSignUp.swift @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import AuthenticationServices +import NextcloudKit +import NextcloudKitUI +import UIKit + +/// Signs up with a provider in the browser, which redirects to the login callback URL with the new account's credentials. +@MainActor +final class NCProviderSignUp: NSObject, ASWebAuthenticationPresentationContextProviding { + private let coordinator: NCLoginCoordinator + private var session: ASWebAuthenticationSession? + + init(coordinator: NCLoginCoordinator) { + self.coordinator = coordinator + } + + func start(url: URL) { + let scheme = NCBrandOptions.shared.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "") + + let session = ASWebAuthenticationSession(url: url, callbackURLScheme: scheme) { [weak self] callbackURL, error in + Task { @MainActor in + await self?.finish(callbackURL: callbackURL, error: error, scheme: scheme) + } + } + + session.presentationContextProvider = self + session.prefersEphemeralWebBrowserSession = true + self.session = session + + session.start() + } + + private func finish(callbackURL: URL?, error: Error?, scheme: String) async { + session = nil + + let windowScene = coordinator.presenter?.view.window?.windowScene + + if let error { + if (error as? ASWebAuthenticationSessionError)?.code != .canceledLogin { + await showErrorBanner(windowScene: windowScene, error: NKError(error: error)) + } + + return + } + + guard let callbackURL else { return } + + do { + let credentials = try LoginCallbackParser.parse(callbackURL, scheme: scheme) + + try await coordinator.addAccount(host: credentials.host, user: credentials.user, password: credentials.password) + } catch let error as NKError { + await showErrorBanner(windowScene: windowScene, error: error) + } catch { + await showErrorBanner(windowScene: windowScene, text: error.localizedDescription) + } + } + + nonisolated func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { + MainActor.assumeIsolated { + coordinator.presenter?.view.window ?? UIApplication.shared.mainAppWindow ?? ASPresentationAnchor() + } + } +} From 6c9e2227b218935eec4494f168fad47243b536d0 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 19 Nov 2026 19:08:35 +0100 Subject: [PATCH 03/30] fixup! feat: host the shared NextcloudKitUI login 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 Signed-off-by: Milen Pivchev --- Nextcloud.xcodeproj/project.pbxproj | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 51a3be4e21..378af8ede4 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -2316,6 +2316,8 @@ AA52EB442D42AC500089C348 /* NextcloudUnitTests */ = { isa = PBXGroup; children = ( + DCCD8BFC693B6BB556D97C47 /* NCLoginAppConfigTests.swift */, + CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */, AC13ADAF2026101300000001 /* NCMediaAdaptiveLayoutViewTests.swift */, C0DEDA7E30C1000100A00001 /* NCAutoUploadDateTests.swift */, 320C20803A58DAF7575440A8 /* NKErrorUserFriendlyMessageTests.swift */, @@ -2345,8 +2347,6 @@ AA8D31692D4123B200FE2775 /* DownloadLimitViewModel.swift */, AA8D316A2D4123B200FE2775 /* NCShareDownloadLimitTableViewController.swift */, AA8D316B2D4123B200FE2775 /* NCShareDownloadLimitTableViewControllerDelegate.swift */, - DCCD8BFC693B6BB556D97C47 /* NCLoginAppConfigTests.swift */, - CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */, AA8D316C2D4123B200FE2775 /* NCShareDownloadLimitViewController.swift */, ); path = DownloadLimit; @@ -3562,6 +3562,11 @@ F7BFFA621A24D7300044ED85 /* Login */ = { isa = PBXGroup; children = ( + 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */, + BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */, + 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */, + 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */, + 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */, F702F2F025EE5CDA008F8E80 /* NCLogin.storyboard */, F702F2F625EE5CEC008F8E80 /* NCLogin.swift */, F745B252222D88AE00346520 /* NCLoginQRCode.swift */, @@ -3578,11 +3583,6 @@ B6DE60601BB3410D92EB99EC /* Passcode */, F39170A82CB8201B006127BC /* FileAutoRenamer+Extensions.swift */, F33918C32C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift */, - 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */, - BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */, - 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */, - 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */, - 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */, F752BA042E58C05200616A26 /* Maintenance.swift */, F7F562FF2E15761500631A11 /* MigrationMultiDomains.swift */, F76D364528A4F8BF00214537 /* NCActivityIndicator.swift */, @@ -4702,6 +4702,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 729609D38218F8A21700723C /* NCLoginAppConfigTests.swift in Sources */, + C7724CB38D2A7B4B98CA1AFA /* NCLoginServerErrorClassifierTests.swift in Sources */, AB1028260000000000090120 /* NCShareRecentFoldersStore.swift in Sources */, AB1028260000000000090121 /* NCShareRecentFoldersStoreTests.swift in Sources */, BAF64949B487A080A98F83F2 /* NKErrorUserFriendlyMessageTests.swift in Sources */, @@ -4736,8 +4738,6 @@ AAA7BC302D3E3B88008F1A22 /* CapabilityResponse.swift in Sources */, F3374A942D674454002A38F9 /* AssistantUITests.swift in Sources */, AA3C85EB2D36BBFB00F74F12 /* OCSResponse.swift in Sources */, - 729609D38218F8A21700723C /* NCLoginAppConfigTests.swift in Sources */, - C7724CB38D2A7B4B98CA1AFA /* NCLoginServerErrorClassifierTests.swift in Sources */, AA74AA972D3172D100BE3458 /* UITestError.swift in Sources */, AA3C85E82D36B08C00F74F12 /* UITestBackend.swift in Sources */, AA8E03DC2D2FBAC200E7E89C /* DownloadLimitUITests.swift in Sources */, @@ -5029,6 +5029,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B5E6D3241C08B33DD08B09FE /* NCLoginAppConfig.swift in Sources */, + AB0BFE5B60D759FFBDEE99FF /* NCLoginCoordinator.swift in Sources */, + 2A3D983FCEC820C453EDD1CC /* NCLoginHostingController.swift in Sources */, + DE4831E27DECD1D32A381E00 /* NCLoginServerErrorClassifier.swift in Sources */, + C27C31EC91411047C288D266 /* NCProviderSignUp.swift in Sources */, AB1028260000000000090110 /* NCShareRecentFoldersStore.swift in Sources */, AB1028260000000000080000 /* NCShareViewModel+Accounts.swift in Sources */, AB1028260000000000080001 /* NCShareViewModel+Folders.swift in Sources */, @@ -5492,11 +5497,6 @@ F7C55C8F2FB5B045004A974F /* NCBrand.swift in Sources */, F72A493A306AA8B600A49375 /* NCPreferences.swift in Sources */, F7C55C8E2FB5B03D004A974F /* NCGlobal.swift in Sources */, - B5E6D3241C08B33DD08B09FE /* NCLoginAppConfig.swift in Sources */, - AB0BFE5B60D759FFBDEE99FF /* NCLoginCoordinator.swift in Sources */, - 2A3D983FCEC820C453EDD1CC /* NCLoginHostingController.swift in Sources */, - DE4831E27DECD1D32A381E00 /* NCLoginServerErrorClassifier.swift in Sources */, - C27C31EC91411047C288D266 /* NCProviderSignUp.swift in Sources */, F72A493B306AA8DC00A49375 /* AwakeMode.swift in Sources */, F7C55CC92FB5CE74004A974F /* ActionViewController.swift in Sources */, F7C55C9B2FB5B1A7004A974F /* UIColor+Extension.swift in Sources */, From bc044bf76c672b3f9d0ad152c976b2f96210e818 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 19 Nov 2026 19:12:50 +0100 Subject: [PATCH 04/30] refactor: replace the UIKit login with the shared NextcloudKitUI login 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 Signed-off-by: Milen Pivchev --- Brand/Intro/NCIntroViewController.swift | 24 +- Nextcloud.xcodeproj/project.pbxproj | 57 -- .../xcshareddata/swiftpm/Package.resolved | 9 - .../NCShareAccounts.storyboard | 129 ---- .../Account Request/NCShareAccounts.swift | 99 --- iOSClient/Account/NCAccount.swift | 17 +- iOSClient/AppDelegate.swift | 4 - iOSClient/Extensions/UIButton+Extension.swift | 36 -- iOSClient/Files/NCFiles.swift | 10 +- .../Files/NCFilesNavigationController.swift | 9 +- .../Lucid Banner/AlertActionBannerView.swift | 189 ------ .../certificate.imageset/Contents.json | 15 - .../certificate.imageset/certificate.svg | 1 - iOSClient/Login/NCLogin.storyboard | 211 ------- iOSClient/Login/NCLogin.swift | 587 ------------------ iOSClient/Login/NCLoginProvider.swift | 401 ------------ iOSClient/Login/NCLoginQRCode.swift | 81 --- iOSClient/Networking/NCNetworking.swift | 9 +- iOSClient/SceneDelegate.swift | 7 +- iOSClient/Settings/Acknowledgements.rtf | 12 - .../en.lproj/Localizable.strings | 14 - 21 files changed, 27 insertions(+), 1894 deletions(-) delete mode 100644 iOSClient/Account/Account Request/NCShareAccounts.storyboard delete mode 100644 iOSClient/Account/Account Request/NCShareAccounts.swift delete mode 100644 iOSClient/Extensions/UIButton+Extension.swift delete mode 100644 iOSClient/GUI/Lucid Banner/AlertActionBannerView.swift delete mode 100644 iOSClient/Images.xcassets/certificate.imageset/Contents.json delete mode 100644 iOSClient/Images.xcassets/certificate.imageset/certificate.svg delete mode 100644 iOSClient/Login/NCLogin.storyboard delete mode 100644 iOSClient/Login/NCLogin.swift delete mode 100644 iOSClient/Login/NCLoginProvider.swift delete mode 100644 iOSClient/Login/NCLoginQRCode.swift diff --git a/Brand/Intro/NCIntroViewController.swift b/Brand/Intro/NCIntroViewController.swift index 7b5a63cdc8..f3f07cf459 100644 --- a/Brand/Intro/NCIntroViewController.swift +++ b/Brand/Intro/NCIntroViewController.swift @@ -12,17 +12,15 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol @IBOutlet weak var introCollectionView: UICollectionView! @IBOutlet weak var pageControl: UIPageControl! - weak var delegate: NCIntroViewController? // Controller var controller: NCMainTabBarController? - private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! private let titles = [NSLocalizedString("_intro_1_title_", comment: ""), NSLocalizedString("_intro_2_title_", comment: ""), NSLocalizedString("_intro_3_title_", comment: ""), NSLocalizedString("_intro_4_title_", comment: "")] private let images = [UIImage(named: "intro1"), UIImage(named: "intro2"), UIImage(named: "intro3"), UIImage(named: "intro4")] private var timer: Timer? private var textColor: UIColor = .white private var textColorOpponent: UIColor = .black - private var activeLoginProvider: NCLoginProvider? + private var providerSignUp: NCProviderSignUp? // MARK: - View Life Cycle @@ -158,19 +156,19 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol } @IBAction func login(_ sender: Any) { - if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin { - viewController.controller = self.controller - self.navigationController?.pushViewController(viewController, animated: true) - } + let viewController = NCLoginHostingController(controller: controller, presentation: .pushed) + navigationController?.pushViewController(viewController, animated: true) } @IBAction func signupWithProvider(_ sender: Any) { - let loginProvider = NCLoginProvider() - loginProvider.controller = self.controller - loginProvider.initialURLString = NCBrandOptions.shared.linkloginPreferredProviders - loginProvider.presentingViewController = self - loginProvider.startAuthentication() - self.activeLoginProvider = loginProvider + guard let url = URL(string: NCBrandOptions.shared.linkloginPreferredProviders) else { return } + + let coordinator = NCLoginCoordinator(controller: controller, presentation: .pushed) + coordinator.presenter = self + + let providerSignUp = NCProviderSignUp(coordinator: coordinator) + providerSignUp.start(url: url) + self.providerSignUp = providerSignUp } @IBAction func host(_ sender: Any) { diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 378af8ede4..ab1df0e3ef 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -165,7 +165,6 @@ F31165022F9674A1009A1E37 /* AppIcon.icon in Resources */ = {isa = PBXBuildFile; fileRef = F31165012F9674A1009A1E37 /* AppIcon.icon */; }; F317C82E2E844C5300761AEA /* ClientIntegrationUIViewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F317C82D2E844C5300761AEA /* ClientIntegrationUIViewer.swift */; }; F321DA8A2B71205A00DDA0E6 /* NCTrashSelectTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */; }; - F32FADA92D1176E3007035E2 /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32FADA82D1176DE007035E2 /* UIButton+Extension.swift */; }; F3374A812D64AB9F002A38F9 /* StatusInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3374A802D64AB9E002A38F9 /* StatusInfo.swift */; }; F3374A842D64AC31002A38F9 /* AssistantLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3374A832D64AC2C002A38F9 /* AssistantLabelStyle.swift */; }; F3374A942D674454002A38F9 /* AssistantUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3374A932D674454002A38F9 /* AssistantUITests.swift */; }; @@ -195,7 +194,6 @@ F372087D2BAB4C0F006B5430 /* TestConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F37208742BAB4AB0006B5430 /* TestConstants.swift */; }; F372087E2BAB4C0F006B5430 /* TestConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F37208742BAB4AB0006B5430 /* TestConstants.swift */; }; F37208812BAB5979006B5430 /* TestConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F37208742BAB4AB0006B5430 /* TestConstants.swift */; }; - F37208A42BAB63EE006B5430 /* QRCodeReader in Frameworks */ = {isa = PBXBuildFile; productRef = F37208A32BAB63EE006B5430 /* QRCodeReader */; }; F37208A62BAB63EE006B5430 /* SwiftRichString in Frameworks */ = {isa = PBXBuildFile; productRef = F37208A52BAB63EE006B5430 /* SwiftRichString */; }; F37208AA2BAB63EE006B5430 /* MarkdownKit in Frameworks */ = {isa = PBXBuildFile; productRef = F37208A92BAB63EE006B5430 /* MarkdownKit */; }; F37208B22BAB63EF006B5430 /* DropDown in Frameworks */ = {isa = PBXBuildFile; productRef = F37208B12BAB63EF006B5430 /* DropDown */; }; @@ -253,8 +251,6 @@ F702F2D025EE5B5C008F8E80 /* NCGlobal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */; }; F702F2D125EE5B5C008F8E80 /* NCGlobal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */; }; F702F2D225EE5B5C008F8E80 /* NCGlobal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */; }; - F702F2F125EE5CDB008F8E80 /* NCLogin.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F702F2F025EE5CDA008F8E80 /* NCLogin.storyboard */; }; - F702F2F725EE5CED008F8E80 /* NCLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F2F625EE5CEC008F8E80 /* NCLogin.swift */; }; F702F30125EE5D2C008F8E80 /* NYMnemonic.m in Sources */ = {isa = PBXBuildFile; fileRef = F702F2FD25EE5D2C008F8E80 /* NYMnemonic.m */; }; F702F30225EE5D2C008F8E80 /* english.txt in Resources */ = {isa = PBXBuildFile; fileRef = F702F2FF25EE5D2C008F8E80 /* english.txt */; }; F702F30825EE5D47008F8E80 /* NCPopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F30725EE5D47008F8E80 /* NCPopupViewController.swift */; }; @@ -360,7 +356,6 @@ F72AD71128C24BBB006CB92D /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72AD71028C24BBB006CB92D /* NextcloudKit */; }; F72AD71328C24BCC006CB92D /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72AD71228C24BCC006CB92D /* NextcloudKit */; }; F72CA0572F5048C3002E2F06 /* UIApplication+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72CA0562F5048C3002E2F06 /* UIApplication+Extension.swift */; }; - F72CA05C2F5051DB002E2F06 /* AlertActionBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72CA05B2F5051DB002E2F06 /* AlertActionBannerView.swift */; }; F72CD63A25C19EBF00F46F9A /* NCAutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72CD63925C19EBF00F46F9A /* NCAutoUpload.swift */; }; F72D1007210B6882009C96B7 /* NCPushNotificationEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F72D1005210B6882009C96B7 /* NCPushNotificationEncryption.m */; }; F72D404923D2082500A97FD0 /* NCViewerDirectEditing.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72D404823D2082500A97FD0 /* NCViewerDirectEditing.swift */; }; @@ -425,7 +420,6 @@ F74230F32C79B57200CA1ACA /* NCNetworking+Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = F74230F22C79B57200CA1ACA /* NCNetworking+Task.swift */; }; F7434B3820E2400600417916 /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; }; F743C89E2E5B25A1000173A9 /* UIScene+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F743C89D2E5B2595000173A9 /* UIScene+Extension.swift */; }; - F745B253222D88AE00346520 /* NCLoginQRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F745B252222D88AE00346520 /* NCLoginQRCode.swift */; }; F746EC52273906C40052598D /* NCViewCertificateDetails.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7BC287D26663F6C004D46C5 /* NCViewCertificateDetails.storyboard */; }; F746EC53273906C50052598D /* NCViewCertificateDetails.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7BC287D26663F6C004D46C5 /* NCViewCertificateDetails.storyboard */; }; F747EB0D2C4AC1FF00F959A8 /* NCCollectionViewCommon+CollectionViewDelegateFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F747EB0C2C4AC1FF00F959A8 /* NCCollectionViewCommon+CollectionViewDelegateFlowLayout.swift */; }; @@ -874,7 +868,6 @@ F7A8D74428F1827B008BBE1C /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; }; F7AC1CB028AB94490032D99F /* Array+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AC1CAF28AB94490032D99F /* Array+Extension.swift */; }; F7AC934A296193050002BC0F /* Reasons to use Nextcloud.pdf in Resources */ = {isa = PBXBuildFile; fileRef = F7AC9349296193050002BC0F /* Reasons to use Nextcloud.pdf */; }; - F7AE00F5230D5F9E007ACF8A /* NCLoginProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AE00F4230D5F9E007ACF8A /* NCLoginProvider.swift */; }; F7AE00F8230E81CB007ACF8A /* NCBrowserWeb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AE00F7230E81CB007ACF8A /* NCBrowserWeb.swift */; }; F7AE00FA230E81EB007ACF8A /* NCBrowserWeb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7AE00F9230E81EB007ACF8A /* NCBrowserWeb.storyboard */; }; F7B398422A6A91D5007538D6 /* NCSectionFirstHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7B398412A6A91D5007538D6 /* NCSectionFirstHeader.xib */; }; @@ -1040,7 +1033,6 @@ F7E98C1627E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */; }; F7E98C1727E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */; }; F7E98C1927E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */; }; - F7ED547C25EEA65400956C55 /* QRCodeReader in Frameworks */ = {isa = PBXBuildFile; productRef = F7ED547B25EEA65400956C55 /* QRCodeReader */; }; F7EDE509262DA9D600414FE6 /* NCSelectCommandViewSelect.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7EDE508262DA9D600414FE6 /* NCSelectCommandViewSelect.xib */; }; F7EDE514262DC2CD00414FE6 /* NCSelectCommandViewSelect+CreateFolder.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7EDE513262DC2CD00414FE6 /* NCSelectCommandViewSelect+CreateFolder.xib */; }; F7EDE51B262DD0C400414FE6 /* NCSelectCommandViewCopyMove.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7EDE51A262DD0C400414FE6 /* NCSelectCommandViewCopyMove.xib */; }; @@ -1062,9 +1054,7 @@ F7FA80012C0F4F3B0072FC60 /* NCUploadAssetsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FA7FFF2C0F4F3B0072FC60 /* NCUploadAssetsView.swift */; }; F7FAFD3A28BFA948000777FE /* NCContextMenuNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FAFD3928BFA947000777FE /* NCContextMenuNotification.swift */; }; F7FDFF692E437E55000D7688 /* NCAccountRequest.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7FDFF512E437E55000D7688 /* NCAccountRequest.storyboard */; }; - F7FDFF6A2E437E55000D7688 /* NCShareAccounts.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7FDFF532E437E55000D7688 /* NCShareAccounts.storyboard */; }; F7FDFF6B2E437E55000D7688 /* NCAccountRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FDFF522E437E55000D7688 /* NCAccountRequest.swift */; }; - F7FDFF6C2E437E55000D7688 /* NCShareAccounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FDFF542E437E55000D7688 /* NCShareAccounts.swift */; }; F7FDFF6D2E437E55000D7688 /* NCAccountSettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FDFF562E437E55000D7688 /* NCAccountSettingsModel.swift */; }; F7FDFF6E2E437E55000D7688 /* NCAccountSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FDFF572E437E55000D7688 /* NCAccountSettingsView.swift */; }; F7FDFF6F2E437E55000D7688 /* NCAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FDFF592E437E55000D7688 /* NCAccount.swift */; }; @@ -1467,7 +1457,6 @@ F31165012F9674A1009A1E37 /* AppIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = AppIcon.icon; sourceTree = ""; }; F317C82D2E844C5300761AEA /* ClientIntegrationUIViewer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientIntegrationUIViewer.swift; sourceTree = ""; }; F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTrashSelectTabBar.swift; sourceTree = ""; }; - F32FADA82D1176DE007035E2 /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; F3374A802D64AB9E002A38F9 /* StatusInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusInfo.swift; sourceTree = ""; }; F3374A832D64AC2C002A38F9 /* AssistantLabelStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssistantLabelStyle.swift; sourceTree = ""; }; F3374A932D674454002A38F9 /* AssistantUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssistantUITests.swift; sourceTree = ""; }; @@ -1513,8 +1502,6 @@ F700510422DF6A89003A3356 /* NCShare.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShare.swift; sourceTree = ""; }; F702F2CC25EE5B4F008F8E80 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCGlobal.swift; sourceTree = ""; }; - F702F2F025EE5CDA008F8E80 /* NCLogin.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCLogin.storyboard; sourceTree = ""; }; - F702F2F625EE5CEC008F8E80 /* NCLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCLogin.swift; sourceTree = ""; }; F702F2FD25EE5D2C008F8E80 /* NYMnemonic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NYMnemonic.m; sourceTree = ""; }; F702F2FF25EE5D2C008F8E80 /* english.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = english.txt; sourceTree = ""; }; F702F30025EE5D2C008F8E80 /* NYMnemonic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NYMnemonic.h; sourceTree = ""; }; @@ -1578,7 +1565,6 @@ F72944F42A8424F800246839 /* NCEndToEndMetadataV1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndMetadataV1.swift; sourceTree = ""; }; F72A17D728B221E300F3F159 /* DashboardWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DashboardWidgetView.swift; sourceTree = ""; }; F72CA0562F5048C3002E2F06 /* UIApplication+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Extension.swift"; sourceTree = ""; }; - F72CA05B2F5051DB002E2F06 /* AlertActionBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertActionBannerView.swift; sourceTree = ""; }; F72CD63925C19EBF00F46F9A /* NCAutoUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAutoUpload.swift; sourceTree = ""; }; F72D1005210B6882009C96B7 /* NCPushNotificationEncryption.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCPushNotificationEncryption.m; sourceTree = ""; }; F72D1006210B6882009C96B7 /* NCPushNotificationEncryption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCPushNotificationEncryption.h; sourceTree = ""; }; @@ -1618,7 +1604,6 @@ F741C2232B6B9FD600E849BB /* NCMediaSelectTabBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCMediaSelectTabBar.swift; sourceTree = ""; }; F74230F22C79B57200CA1ACA /* NCNetworking+Task.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCNetworking+Task.swift"; sourceTree = ""; }; F743C89D2E5B2595000173A9 /* UIScene+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScene+Extension.swift"; sourceTree = ""; }; - F745B252222D88AE00346520 /* NCLoginQRCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginQRCode.swift; sourceTree = ""; }; F747EB0C2C4AC1FF00F959A8 /* NCCollectionViewCommon+CollectionViewDelegateFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+CollectionViewDelegateFlowLayout.swift"; sourceTree = ""; }; F749B649297B0CBB00087535 /* NCManageDatabase+Share.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+Share.swift"; sourceTree = ""; }; F749B650297B0F2400087535 /* NCManageDatabase+Avatar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+Avatar.swift"; sourceTree = ""; }; @@ -1942,7 +1927,6 @@ F7AA41E127C7CF8100494705 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/InfoPlist.strings"; sourceTree = ""; }; F7AC1CAF28AB94490032D99F /* Array+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Extension.swift"; sourceTree = ""; }; F7AC9349296193050002BC0F /* Reasons to use Nextcloud.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Reasons to use Nextcloud.pdf"; sourceTree = SOURCE_ROOT; }; - F7AE00F4230D5F9E007ACF8A /* NCLoginProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginProvider.swift; sourceTree = ""; }; F7AE00F7230E81CB007ACF8A /* NCBrowserWeb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCBrowserWeb.swift; sourceTree = ""; }; F7AE00F9230E81EB007ACF8A /* NCBrowserWeb.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCBrowserWeb.storyboard; sourceTree = ""; }; F7B1A7761EBB3C8000BFB6D1 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; @@ -2091,8 +2075,6 @@ F7FB188030401D0D00EB0AE6 /* BackgroundUploadExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.extensionkit-extension"; includeInIndex = 0; path = BackgroundUploadExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; F7FDFF512E437E55000D7688 /* NCAccountRequest.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCAccountRequest.storyboard; sourceTree = ""; }; F7FDFF522E437E55000D7688 /* NCAccountRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAccountRequest.swift; sourceTree = ""; }; - F7FDFF532E437E55000D7688 /* NCShareAccounts.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCShareAccounts.storyboard; sourceTree = ""; }; - F7FDFF542E437E55000D7688 /* NCShareAccounts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareAccounts.swift; sourceTree = ""; }; F7FDFF562E437E55000D7688 /* NCAccountSettingsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAccountSettingsModel.swift; sourceTree = ""; }; F7FDFF572E437E55000D7688 /* NCAccountSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAccountSettingsView.swift; sourceTree = ""; }; F7FDFF592E437E55000D7688 /* NCAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAccount.swift; sourceTree = ""; }; @@ -2138,7 +2120,6 @@ F37208BA2BAB63EF006B5430 /* TLPhotoPicker in Frameworks */, F37208AA2BAB63EE006B5430 /* MarkdownKit in Frameworks */, F37208C02BAB63F0006B5430 /* Mantis in Frameworks */, - F37208A42BAB63EE006B5430 /* QRCodeReader in Frameworks */, F37208B22BAB63EF006B5430 /* DropDown in Frameworks */, F37208BC2BAB63EF006B5430 /* OpenSSL in Frameworks */, F37208B82BAB63EF006B5430 /* NextcloudKit in Frameworks */, @@ -2206,7 +2187,6 @@ files = ( F7D4BF542CA2ED9D00A5E746 /* VLCKitSPM in Frameworks */, F7D56B1A2972405500FA46C4 /* Mantis in Frameworks */, - F7ED547C25EEA65400956C55 /* QRCodeReader in Frameworks */, F788ECC7263AAAFA00ADC67F /* MarkdownKit in Frameworks */, F3374AF02D78B01B002A38F9 /* BitCollections in Frameworks */, F77BC3EB293E5268005F2B08 /* Swifter in Frameworks */, @@ -2578,7 +2558,6 @@ F70557BC2ED44F1800135623 /* Lucid Banner */ = { isa = PBXGroup; children = ( - F72CA05B2F5051DB002E2F06 /* AlertActionBannerView.swift */, F74B91E42F51D4100050813D /* InfoBannerView.swift */, F7DF7B3E2F1A2EE400514020 /* WarningBannerView.swift */, F74B91E72F51D4510050813D /* ErrorBannerView.swift */, @@ -3433,7 +3412,6 @@ AF1A9B6327D0CA1E00F17A9E /* UIAlertController+Extension.swift */, F72CA0562F5048C3002E2F06 /* UIApplication+Extension.swift */, AF7E504D27A2D8FF00B5E4AF /* UIBarButton+Extension.swift */, - F32FADA82D1176DE007035E2 /* UIButton+Extension.swift */, F70CEF5523E9C7E50007035B /* UIColor+Extension.swift */, F79B645F26CA661600838ACA /* UIControl+Extension.swift */, F7CB77632F5843D700DE649A /* UIFont+Extension.swift */, @@ -3567,10 +3545,6 @@ 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */, 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */, 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */, - F702F2F025EE5CDA008F8E80 /* NCLogin.storyboard */, - F702F2F625EE5CEC008F8E80 /* NCLogin.swift */, - F745B252222D88AE00346520 /* NCLoginQRCode.swift */, - F7AE00F4230D5F9E007ACF8A /* NCLoginProvider.swift */, F7BC287D26663F6C004D46C5 /* NCViewCertificateDetails.storyboard */, F7BC287F26663F85004D46C5 /* NCViewCertificateDetails.swift */, ); @@ -3890,8 +3864,6 @@ children = ( F7FDFF512E437E55000D7688 /* NCAccountRequest.storyboard */, F7FDFF522E437E55000D7688 /* NCAccountRequest.swift */, - F7FDFF532E437E55000D7688 /* NCShareAccounts.storyboard */, - F7FDFF542E437E55000D7688 /* NCShareAccounts.swift */, ); path = "Account Request"; sourceTree = ""; @@ -3983,7 +3955,6 @@ packageProductDependencies = ( F3391B152B4C52F6001C0C4B /* FirebaseDatabase */, F3F0419E2B9F7E7900D5155F /* RealmSwift */, - F37208A32BAB63EE006B5430 /* QRCodeReader */, F37208A52BAB63EE006B5430 /* SwiftRichString */, F37208A92BAB63EE006B5430 /* MarkdownKit */, F37208B12BAB63EF006B5430 /* DropDown */, @@ -4147,7 +4118,6 @@ ); name = Nextcloud; packageProductDependencies = ( - F7ED547B25EEA65400956C55 /* QRCodeReader */, F72DA9B325F53E4E00B87DB1 /* SwiftRichString */, F788ECC6263AAAFA00ADC67F /* MarkdownKit */, F70B86742642CE3B00ED5349 /* FirebaseCrashlytics */, @@ -4375,7 +4345,6 @@ ); mainGroup = F7F67B9F1A24D27800EE80DA; packageReferences = ( - F7ED547A25EEA65400956C55 /* XCRemoteSwiftPackageReference "QRCodeReader" */, F72DA9B225F53E4E00B87DB1 /* XCRemoteSwiftPackageReference "SwiftRichString" */, F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */, F70B86732642CE3B00ED5349 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, @@ -4504,7 +4473,6 @@ F769453C22E9CFFF000A798A /* NCShareUserCell.xib in Resources */, F76D3CF52428D0C1005DFA87 /* NCViewerPDF.storyboard in Resources */, F700222C1EC479840080073F /* Custom.xcassets in Resources */, - F702F2F125EE5CDB008F8E80 /* NCLogin.storyboard in Resources */, F723985C253C95CE00257F49 /* NCViewerRichdocuments.storyboard in Resources */, F758B45A212C564000515F55 /* NCScan.storyboard in Resources */, F765F73225237E3F00391DBE /* NCRecent.storyboard in Resources */, @@ -4553,7 +4521,6 @@ F7D1612023CF19E30039EBBF /* NCViewerRichWorkspace.storyboard in Resources */, F77B0F631D118A16002130FE /* Localizable.strings in Resources */, F7FDFF692E437E55000D7688 /* NCAccountRequest.storyboard in Resources */, - F7FDFF6A2E437E55000D7688 /* NCShareAccounts.storyboard in Resources */, F774264A22EB4D0000B23912 /* NCSearchUserDropDownCell.xib in Resources */, F77B0F7D1D118A16002130FE /* Images.xcassets in Resources */, F73CB3B222E072A000AD728E /* NCShareHeaderView.xib in Resources */, @@ -5069,7 +5036,6 @@ F76340FC2EBDF64D0056F538 /* NCManageDatabase+Tag.swift in Sources */, F733598125C1C188002ABA72 /* NCAskAuthorization.swift in Sources */, 370D26AF248A3D7A00121797 /* NCCellMain.swift in Sources */, - F32FADA92D1176E3007035E2 /* UIButton+Extension.swift in Sources */, F7DF7B3F2F1A2EF900514020 /* WarningBannerView.swift in Sources */, F768822C2C0DD1E7001CF441 /* NCPreferences.swift in Sources */, A1E2EE010000000000000007 /* NCEndToEndKeySet.swift in Sources */, @@ -5253,7 +5219,6 @@ F75DD765290ABB25002EB562 /* Intent.intentdefinition in Sources */, F7D4BF012CA1831900A5E746 /* NCCollectionViewCommonPinchGesture.swift in Sources */, F74B6D952A7E239A00F03C5F /* NCManageDatabase+Chunk.swift in Sources */, - F702F2F725EE5CED008F8E80 /* NCLogin.swift in Sources */, F75D90212D2BE26F003E740B /* NCRecommendationsCell.swift in Sources */, F7E98C1627E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */, F76882222C0DD1E7001CF441 /* NCCapabilitiesView.swift in Sources */, @@ -5388,7 +5353,6 @@ F74C0436253F1CDC009762AB /* NCShares.swift in Sources */, F79699E72E689F68000EC82A /* NCMediaNavigationController.swift in Sources */, F7AC1CB028AB94490032D99F /* Array+Extension.swift in Sources */, - F7AE00F5230D5F9E007ACF8A /* NCLoginProvider.swift in Sources */, F707C26521A2DC5200F6181E /* NCStoreReview.swift in Sources */, F7814E972F3B5F170074DA3A /* NCSVGRenderer.swift in Sources */, F7CF06802E0FF3990063AD04 /* NCAppStateManager.swift in Sources */, @@ -5403,14 +5367,11 @@ F7CADEFD2EA159210057849E /* NCMetadataUploadTranfersSuccess.swift in Sources */, F343A4B32A1E01FF00DDA874 /* PHAsset+Extension.swift in Sources */, F7C30DFA291BCF790017149B /* NCNetworkingE2EECreateFolder.swift in Sources */, - F72CA05C2F5051DB002E2F06 /* AlertActionBannerView.swift in Sources */, F76995F42F9A4AC400291FA7 /* NCCollectionViewCommon+UIEditMenuInteractionDelegate.swift in Sources */, F722133B2D40EF9D002F7438 /* NCFilesNavigationController.swift in Sources */, F7BC288026663F85004D46C5 /* NCViewCertificateDetails.swift in Sources */, D5B6AA7827200C7200D49C24 /* NCActivityTableViewCell.swift in Sources */, - F745B253222D88AE00346520 /* NCLoginQRCode.swift in Sources */, F7FDFF6B2E437E55000D7688 /* NCAccountRequest.swift in Sources */, - F7FDFF6C2E437E55000D7688 /* NCShareAccounts.swift in Sources */, F7FDFF6D2E437E55000D7688 /* NCAccountSettingsModel.swift in Sources */, F7FDFF6E2E437E55000D7688 /* NCAccountSettingsView.swift in Sources */, F7FDFF6F2E437E55000D7688 /* NCAccount.swift in Sources */, @@ -7130,14 +7091,6 @@ version = 1.0.0; }; }; - F7ED547A25EEA65400956C55 /* XCRemoteSwiftPackageReference "QRCodeReader" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/yannickl/QRCodeReader.swift"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 10.1.1; - }; - }; F7F623B32A5EF4D30022D3D4 /* XCRemoteSwiftPackageReference "GzipSwift" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/1024jp/GzipSwift"; @@ -7184,11 +7137,6 @@ package = F70B86732642CE3B00ED5349 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; productName = FirebaseDatabase; }; - F37208A32BAB63EE006B5430 /* QRCodeReader */ = { - isa = XCSwiftPackageProductDependency; - package = F7ED547A25EEA65400956C55 /* XCRemoteSwiftPackageReference "QRCodeReader" */; - productName = QRCodeReader; - }; F37208A52BAB63EE006B5430 /* SwiftRichString */ = { isa = XCSwiftPackageProductDependency; package = F72DA9B225F53E4E00B87DB1 /* XCRemoteSwiftPackageReference "SwiftRichString" */; @@ -7483,11 +7431,6 @@ package = F7D56B182972405400FA46C4 /* XCRemoteSwiftPackageReference "Mantis" */; productName = Mantis; }; - F7ED547B25EEA65400956C55 /* QRCodeReader */ = { - isa = XCSwiftPackageProductDependency; - package = F7ED547A25EEA65400956C55 /* XCRemoteSwiftPackageReference "QRCodeReader" */; - productName = QRCodeReader; - }; F7F623B42A5EF4D30022D3D4 /* Gzip */ = { isa = XCSwiftPackageProductDependency; package = F7F623B32A5EF4D30022D3D4 /* XCRemoteSwiftPackageReference "GzipSwift" */; diff --git a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7cb7678f06..f1d29eab09 100644 --- a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -226,15 +226,6 @@ "version" : "2.4.1" } }, - { - "identity" : "qrcodereader.swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/yannickl/QRCodeReader.swift", - "state" : { - "revision" : "5020b5a47199d8ba80c83a4b4fafd70e9dc9dc7f", - "version" : "10.1.1" - } - }, { "identity" : "realm-core", "kind" : "remoteSourceControl", diff --git a/iOSClient/Account/Account Request/NCShareAccounts.storyboard b/iOSClient/Account/Account Request/NCShareAccounts.storyboard deleted file mode 100644 index a497eca7bc..0000000000 --- a/iOSClient/Account/Account Request/NCShareAccounts.storyboard +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iOSClient/Account/Account Request/NCShareAccounts.swift b/iOSClient/Account/Account Request/NCShareAccounts.swift deleted file mode 100644 index c0c2142aea..0000000000 --- a/iOSClient/Account/Account Request/NCShareAccounts.swift +++ /dev/null @@ -1,99 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2021 Marino Faggiana -// SPDX-License-Identifier: GPL-3.0-or-later - -import UIKit -import NextcloudKit - -public protocol NCShareAccountsDelegate: AnyObject { - func selected(url: String, user: String) -} - -// optional func -public extension NCShareAccountsDelegate { - func selected(url: String, user: String) {} -} - -class NCShareAccounts: UIViewController { - - @IBOutlet weak var titleLabel: UILabel! - @IBOutlet weak var tableView: UITableView! - - public var accounts: [NKShareAccounts.DataAccounts] = [] - public let heightCell: CGFloat = 60 - public var enableTimerProgress: Bool = true - public var dismissDidEnterBackground: Bool = true - public weak var delegate: NCShareAccountsDelegate? - - // MARK: - View Life Cycle - - override func viewDidLoad() { - super.viewDidLoad() - - titleLabel.text = NSLocalizedString("_account_select_to_add_", comment: "") - - tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 1)) - tableView.separatorStyle = UITableViewCell.SeparatorStyle.none - - view.backgroundColor = .secondarySystemBackground - tableView.backgroundColor = .secondarySystemBackground - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - let visibleCells = tableView.visibleCells - if visibleCells.count == accounts.count { - tableView.isScrollEnabled = false - } - } -} - -extension NCShareAccounts: UITableViewDelegate { - - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return heightCell - } - - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - - dismiss(animated: true) { - let account = self.accounts[indexPath.row] - self.delegate?.selected(url: account.url, user: account.user) - } - } -} - -extension NCShareAccounts: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return accounts.count - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - - let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) - cell.backgroundColor = tableView.backgroundColor - - let avatarImage = cell.viewWithTag(10) as? UIImageView - let userLabel = cell.viewWithTag(20) as? UILabel - let urlLabel = cell.viewWithTag(30) as? UILabel - - userLabel?.text = "" - urlLabel?.text = "" - - let account = accounts[indexPath.row] - - if let image = account.image { - avatarImage?.image = image - } - - if let name = account.name, !name.isEmpty { - userLabel?.text = name.uppercased() + " (\(account.user))" - } else { - userLabel?.text = account.user.uppercased() - } - urlLabel?.text = (URL(string: account.url)?.host ?? "") - - return cell - } -} diff --git a/iOSClient/Account/NCAccount.swift b/iOSClient/Account/NCAccount.swift index fa3dace930..af6fc51496 100644 --- a/iOSClient/Account/NCAccount.swift +++ b/iOSClient/Account/NCAccount.swift @@ -14,7 +14,7 @@ class NCAccount: NSObject { let global = NCGlobal.shared let utilityFileSystem = NCUtilityFileSystem() - func createAccount(viewController: UIViewController, urlBase: String, user: String, password: String, controller: NCMainTabBarController?) async { + func createAccount(viewController: UIViewController, urlBase: String, user: String, password: String, controller: NCMainTabBarController?) async throws { nkLog(debug: "Creating account...") var urlBase = urlBase @@ -43,11 +43,7 @@ class NCAccount: NSObject { nkLog(error: "Getting the user profile failed: \(error.logDescription)") - let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: error.userFriendlyMessage() ?? error.localizedGenericMessage, preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in })) - viewController.present(alertController, animated: true) - - return + throw error } // Login log debug @@ -271,12 +267,9 @@ class NCAccount: NSObject { await changeAccount(account, userProfile: nil, controller: controller) } else { if NCBrandOptions.shared.disable_intro { - if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin { - viewController.controller = controller - let navigationController = UINavigationController(rootViewController: viewController) - navigationController.modalPresentationStyle = .fullScreen - controller?.present(navigationController, animated: true) - } + let viewController = NCLoginHostingController(controller: controller, presentation: .modal) + viewController.modalPresentationStyle = .fullScreen + controller?.present(viewController, animated: true) } else { if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController { if let viewController = navigationController.topViewController as? NCIntroViewController { diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index 1bbdff022c..e6a3850e11 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -21,10 +21,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } var notificationSettings: UNNotificationSettings? - var loginFlowV2Token = "" - var loginFlowV2Endpoint = "" - var loginFlowV2Login = "" - let backgroundQueue = DispatchQueue(label: "com.nextcloud.bgTaskQueue") let global = NCGlobal.shared diff --git a/iOSClient/Extensions/UIButton+Extension.swift b/iOSClient/Extensions/UIButton+Extension.swift deleted file mode 100644 index 8050c15444..0000000000 --- a/iOSClient/Extensions/UIButton+Extension.swift +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2024 Milen Pivchev -// SPDX-License-Identifier: GPL-3.0-or-later - -extension UIButton { - func hideButtonAndShowSpinner(tint: UIColor = .white) { - self.isHidden = true - - let spinnerTag = Int(bitPattern: Unmanaged.passUnretained(self).toOpaque()) - if self.superview?.subviews.first(where: { view -> Bool in - return view.isKind(of: UIActivityIndicatorView.self) && view.tag == spinnerTag - }) != nil { - return - } - - let spinner = UIActivityIndicatorView(style: .medium) - spinner.tag = spinnerTag - spinner.color = tint - spinner.startAnimating() - spinner.center = self.center - self.superview?.addSubview(spinner) - spinner.translatesAutoresizingMaskIntoConstraints = false - spinner.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true - spinner.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true - } - - func hideSpinnerAndShowButton() { - let spinnerTag = Int(bitPattern: Unmanaged.passUnretained(self).toOpaque()) - let spinner = self.superview?.subviews.first(where: { view -> Bool in - return view.isKind(of: UIActivityIndicatorView.self) && view.tag == spinnerTag - }) - - spinner?.removeFromSuperview() - self.isHidden = false - } -} diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 99f4e7af87..155f9ca6a6 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -437,15 +437,15 @@ class NCFiles: NCCollectionViewCommon { let currentAccount = session.account if database.getAllTableAccount().isEmpty { - let navigationController: UINavigationController? + let rootViewController: UIViewController? - if NCBrandOptions.shared.disable_intro, let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin { - navigationController = UINavigationController(rootViewController: viewController) + if NCBrandOptions.shared.disable_intro { + rootViewController = NCLoginHostingController(controller: nil, presentation: .windowRoot) } else { - navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController + rootViewController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController } - UIApplication.shared.mainAppWindow?.rootViewController = navigationController + UIApplication.shared.mainAppWindow?.rootViewController = rootViewController } else if let account = tblAccount?.account, account != currentAccount { Task { await NCAccount().changeAccount(account, userProfile: nil, controller: controller) diff --git a/iOSClient/Files/NCFilesNavigationController.swift b/iOSClient/Files/NCFilesNavigationController.swift index 5e25016a5b..3c39506e77 100644 --- a/iOSClient/Files/NCFilesNavigationController.swift +++ b/iOSClient/Files/NCFilesNavigationController.swift @@ -115,12 +115,9 @@ class NCFilesNavigationController: NCMainNavigationController { let addAccountAction = UIAction(title: NSLocalizedString("_add_account_", comment: ""), image: utility.loadImage(named: "person.crop.circle.badge.plus", colors: NCBrandColor.shared.iconImageMultiColors)) { _ in if NCBrandOptions.shared.disable_intro { - if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin { - viewController.controller = self.controller - let navigationController = UINavigationController(rootViewController: viewController) - navigationController.modalPresentationStyle = .fullScreen - self.present(navigationController, animated: true) - } + let viewController = NCLoginHostingController(controller: self.controller, presentation: .modal) + viewController.modalPresentationStyle = .fullScreen + self.present(viewController, animated: true) } else { if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController { if let viewController = navigationController.topViewController as? NCIntroViewController { diff --git a/iOSClient/GUI/Lucid Banner/AlertActionBannerView.swift b/iOSClient/GUI/Lucid Banner/AlertActionBannerView.swift deleted file mode 100644 index d5fac9a19a..0000000000 --- a/iOSClient/GUI/Lucid Banner/AlertActionBannerView.swift +++ /dev/null @@ -1,189 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2026 Marino Faggiana -// SPDX-License-Identifier: GPL-3.0-or-later - -import SwiftUI -import LucidBanner - -@MainActor -func showAlertActionBanner(lucidBanner: LucidBanner?, - windowScene: UIWindowScene?, - title: String? = nil, - subtitle: String? = nil, - onConfirm: (() -> Void)? = nil) { - guard let lucidBanner, - let windowScene, - let window = windowScene.resolvedWindow else { - return - } - let horizontalLayout = horizontalLayoutBanner(bounds: window.bounds, - safeAreaInsets: window.safeAreaInsets, - idiom: window.traitCollection.userInterfaceIdiom) - - let payload = LucidBannerPayload( - title: title, - subtitle: subtitle, - vPosition: .top, - horizontalLayout: horizontalLayout, - swipeToDismiss: true - ) - - lucidBanner.show(payload: payload, - policy: .enqueue) { state in - AlertActionBannerView( - state: state, - onConfirm: { - onConfirm?() - lucidBanner.dismiss() - }, - onCancel: { - lucidBanner.dismiss() - } - ) - } -} - -// MARK: - SwiftUI - -struct AlertActionBannerView: View { - @ObservedObject var state: LucidBannerState - - let onConfirm: (() -> Void)? - let onCancel: (() -> Void)? - - init( - state: LucidBannerState, - onConfirm: (() -> Void)? = nil, - onCancel: (() -> Void)? = nil - ) { - self.state = state - self.onConfirm = onConfirm - self.onCancel = onCancel - } - - var body: some View { - alertActionContainerView { - VStack(spacing: 20) { - // Title - if let title = state.payload.title, !title.isEmpty { - Text(title) - .cappedFont(.headline, maxDynamicType: .accessibility2) - .fontWeight(.semibold) - .foregroundStyle(state.payload.textColor) - .multilineTextAlignment(.center) - } - - // Subtitle - if let subtitle = state.payload.subtitle, !subtitle.isEmpty { - Text(subtitle) - .cappedFont(.subheadline, maxDynamicType: .accessibility1) - .foregroundStyle(state.payload.textColor) - .multilineTextAlignment(.center) - } - - // Buttons - HStack(spacing: 12) { - Button { - onCancel?() - } label: { - Text("_cancel_") - .cappedFont(.footnote, maxDynamicType: .xxxLarge) - .frame(maxWidth: .infinity) - .contentShape(Rectangle()) - } - .padding(.vertical, 8) - .background( - Capsule() - .stroke(Color.secondary.opacity(0.5), lineWidth: 1) - ) - .foregroundStyle(.primary) - .buttonStyle(.plain) - - Button { - onConfirm?() - } label: { - Text("_ok_") - .cappedFont(.footnote, maxDynamicType: .xxxLarge) - .frame(maxWidth: .infinity) - .contentShape(Rectangle()) - } - .padding(.vertical, 8) - .background( - Capsule().fill(Color.accentColor) - ) - .foregroundStyle(.white) - .buttonStyle(.plain) - } - .frame(maxWidth: .infinity) - } - .padding(20) - } - } - - // MARK: - Container - - @ViewBuilder - func alertActionContainerView(@ViewBuilder _ content: () -> Content) -> some View { - let cornerRadius: CGFloat = 22 - let backgroundColor = Color(.systemBackground).opacity(0.9) - - if #available(iOS 26, *) { - content() - .background( - RoundedRectangle(cornerRadius: cornerRadius) - .fill(backgroundColor) - .id(backgroundColor) - ) - .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) - .shadow(color: .black.opacity(0.5), radius: 10, x: 0, y: 4) - } else { - content() - .background( - RoundedRectangle(cornerRadius: cornerRadius) - .fill(backgroundColor) - .id(backgroundColor) - ) - .background( - RoundedRectangle(cornerRadius: cornerRadius) - .fill(.ultraThinMaterial) - ) - .overlay( - RoundedRectangle(cornerRadius: cornerRadius) - .stroke(backgroundColor, lineWidth: 0.6) - .allowsHitTesting(false) - ) - .shadow(color: .black.opacity(0.5), radius: 10, x: 0, y: 4) - } - } -} - -// MARK: - Preview - -#Preview("Alert - Light") { - - let payload = LucidBannerPayload( - title: "Title ?", - subtitle: "Subtitle.", - stage: .warning, - vPosition: .center, - blocksTouches: true - ) - - let state = LucidBannerState(payload: payload) - - return ZStack { - Color.black.opacity(0.15) - .ignoresSafeArea() - - AlertActionBannerView( - state: state, - onConfirm: { - print("Confirm tapped") - }, - onCancel: { - print("Cancel tapped") - } - ) - .padding() - } -} diff --git a/iOSClient/Images.xcassets/certificate.imageset/Contents.json b/iOSClient/Images.xcassets/certificate.imageset/Contents.json deleted file mode 100644 index a9e01b039a..0000000000 --- a/iOSClient/Images.xcassets/certificate.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "filename" : "certificate.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true - } -} diff --git a/iOSClient/Images.xcassets/certificate.imageset/certificate.svg b/iOSClient/Images.xcassets/certificate.imageset/certificate.svg deleted file mode 100644 index abb2dff315..0000000000 --- a/iOSClient/Images.xcassets/certificate.imageset/certificate.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/iOSClient/Login/NCLogin.storyboard b/iOSClient/Login/NCLogin.storyboard deleted file mode 100644 index 981eadcc58..0000000000 --- a/iOSClient/Login/NCLogin.storyboard +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iOSClient/Login/NCLogin.swift b/iOSClient/Login/NCLogin.swift deleted file mode 100644 index 86b2053048..0000000000 --- a/iOSClient/Login/NCLogin.swift +++ /dev/null @@ -1,587 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2025 Marino Faggiana -// SPDX-FileCopyrightText: 2025 Milen Pivchev -// SPDX-License-Identifier: GPL-3.0-or-later - -import UniformTypeIdentifiers -import UIKit -import NextcloudKit -import SwiftUI -import SafariServices -import LucidBanner - -class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { - @IBOutlet weak var imageBrand: UIImageView! - @IBOutlet weak var imageBrandConstraintY: NSLayoutConstraint! - @IBOutlet weak var baseUrlTextField: UITextField! - @IBOutlet weak var loginAddressDetail: UILabel! - @IBOutlet weak var loginButton: UIButton! - @IBOutlet weak var qrCode: UIButton! - @IBOutlet weak var certificate: UIButton! - @IBOutlet weak var enforceServersButton: UIButton! - @IBOutlet weak var enforceServersDropdownImage: UIImageView! - - private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! - private var textColor: UIColor = .white - private var textColorOpponent: UIColor = .black - private var activeTextfieldDiff: CGFloat = 0 - private var activeTextField = UITextField() - - private var shareAccounts: [NKShareAccounts.DataAccounts]? - - /// Controller - var controller: NCMainTabBarController? - - /// The URL that will show up on the URL field when this screen appears - var urlBase = "" - - // Used for MDM - var configServerUrl: String? - var configUsername: String? - var configPassword: String? - var configAppPassword: String? - - private var p12Data: Data? - private var p12Password: String? - private var QRCodeCheck: Bool = false - private var activeLoginProvider: NCLoginProvider? - - // LucidBanner - var banner: LucidBanner? - - // MARK: - View Life Cycle - - override func viewDidLoad() { - super.viewDidLoad() - - // Text color - if NCBrandColor.shared.customer.isTooLight() { - textColor = .black - textColorOpponent = .white - } else if NCBrandColor.shared.customer.isTooDark() { - textColor = .white - textColorOpponent = .black - } else { - textColor = .white - textColorOpponent = .black - } - - // Image Brand - imageBrand.image = UIImage(named: "logo") - - // Url - baseUrlTextField.textColor = textColor - baseUrlTextField.tintColor = textColor - baseUrlTextField.layer.cornerRadius = 10 - baseUrlTextField.layer.borderWidth = 1 - baseUrlTextField.layer.borderColor = textColor.cgColor - baseUrlTextField.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 15, height: baseUrlTextField.frame.height)) - baseUrlTextField.leftViewMode = .always - baseUrlTextField.rightView = UIView(frame: CGRect(x: 0, y: 0, width: 35, height: baseUrlTextField.frame.height)) - baseUrlTextField.rightViewMode = .always - baseUrlTextField.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("_login_url_", comment: ""), attributes: [NSAttributedString.Key.foregroundColor: textColor.withAlphaComponent(0.5)]) - baseUrlTextField.delegate = self - - baseUrlTextField.isEnabled = !NCBrandOptions.shared.disable_request_login_url - - // Login button - loginAddressDetail.textColor = textColor - loginAddressDetail.text = String.localizedStringWithFormat(NSLocalizedString("_login_address_detail_", comment: ""), NCBrandOptions.shared.brand) - - // QR code button - qrCode.tintColor = NCBrandColor.shared.customer.isTooLight() ? .black : .white - - urlBase = NCBrandOptions.shared.loginBaseUrl - - // brand - if NCBrandOptions.shared.disable_request_login_url { - baseUrlTextField.isEnabled = false - baseUrlTextField.isUserInteractionEnabled = false - baseUrlTextField.alpha = 0.5 - } - - // certificate - certificate.setImage(UIImage(named: "certificate")?.image(color: textColor, size: 100), for: .normal) - certificate.isHidden = true - certificate.isEnabled = false - - // navigation - let navBarAppearance = UINavigationBarAppearance() - navBarAppearance.configureWithTransparentBackground() - navBarAppearance.shadowColor = .clear - navBarAppearance.shadowImage = UIImage() - navBarAppearance.titleTextAttributes = [.foregroundColor: textColor] - navBarAppearance.largeTitleTextAttributes = [.foregroundColor: textColor] - self.navigationController?.navigationBar.standardAppearance = navBarAppearance - self.navigationController?.view.backgroundColor = NCBrandColor.shared.customer - self.navigationController?.navigationBar.tintColor = textColor - - if let dirGroupApps = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps) { - // Nextcloud update share accounts - Task { - await NCAccount().updateAppsShareAccounts() - } - // Nextcloud get share accounts - if let shareAccounts = NKShareAccounts().getShareAccount(at: dirGroupApps, application: UIApplication.shared) { - var accountTemp = [NKShareAccounts.DataAccounts]() - for shareAccount in shareAccounts { - if NCManageDatabase.shared.getTableAccount(predicate: NSPredicate(format: "urlBase == %@ AND user == %@", shareAccount.url, shareAccount.user)) == nil { - accountTemp.append(shareAccount) - } - } - if !accountTemp.isEmpty { - self.shareAccounts = accountTemp - let image = NCUtility().loadImage(named: "person.badge.plus") - let navigationItem = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(openShareAccountsViewController(_:))) - navigationItem.tintColor = textColor - self.navigationItem.rightBarButtonItem = navigationItem - } - } - } - - self.navigationController?.navigationBar.setValue(true, forKey: "hidesShadow") - view.backgroundColor = NCBrandColor.shared.customer - - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil) - - handleLoginWithAppConfig() - baseUrlTextField.text = urlBase - - enforceServersButton.setTitle(NSLocalizedString("_select_server_", comment: ""), for: .normal) - - let enforceServers = NCBrandOptions.shared.enforce_servers - - if !enforceServers.isEmpty { - baseUrlTextField.isHidden = true - enforceServersDropdownImage.isHidden = false - enforceServersButton.isHidden = false - - let actions = enforceServers.map { server in - UIAction(title: server.name, handler: { [self] _ in - enforceServersButton.setTitle(server.name, for: .normal) - baseUrlTextField.text = server.url - }) - } - - enforceServersButton.layer.cornerRadius = 10 - enforceServersButton.menu = .init(title: NSLocalizedString("_servers_", comment: ""), children: actions) - enforceServersButton.showsMenuAsPrimaryAction = true - enforceServersButton.configuration?.titleTextAttributesTransformer = - UIConfigurationTextAttributesTransformer { incoming in - var outgoing = incoming - outgoing.font = UIFont.systemFont(ofSize: 13) - return outgoing - } - } - - NCNetworking.shared.certificateDelegate = self - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - - if !NCManageDatabase.shared.getAllTableAccount().isEmpty, - self.navigationController?.viewControllers.count ?? 0 == 1 { - let navigationItemCancel = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .plain, target: self, action: #selector(actionCancel(_:))) - navigationItemCancel.tintColor = textColor - navigationItem.leftBarButtonItem = navigationItemCancel - } - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - if self.shareAccounts != nil, - let windowScene = view.window?.windowScene { - let title = String(format: NSLocalizedString("_apps_nextcloud_detect_", comment: ""), NCBrandOptions.shared.brand) - let subtitle = String(format: NSLocalizedString("_add_existing_account_", comment: ""), NCBrandOptions.shared.brand) - self.banner = LucidBannerRegistry.shared.banner(for: windowScene) - - showAlertActionBanner(lucidBanner: banner, - windowScene: windowScene, - title: title, - subtitle: subtitle) { - self.openShareAccountsViewController(nil) - } - } - } - - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - - self.banner?.dismiss() - } - - private func handleLoginWithAppConfig() { -#if DEBUG - // Passcode UI tests provision an account through the same API as AppConfig. - let process = ProcessInfo.processInfo - let environment = process.environment - if process.arguments.contains("UI_TESTING"), process.arguments.contains("UI_TESTING_PASSCODE"), - let server = environment["UI_TESTING_PASSCODE_SERVER"], - let username = environment["UI_TESTING_PASSCODE_USERNAME"], - let password = environment["UI_TESTING_PASSCODE_PASSWORD"] { - Task { await getAppPassword(urlBase: server, user: username, password: password) } - return - } -#endif - let accountCount = NCManageDatabase.shared.getAccounts()?.count ?? 0 - - // load AppConfig - if (NCBrandOptions.shared.disable_multiaccount == false) || (NCBrandOptions.shared.disable_multiaccount == true && accountCount == 0) { - if let configurationManaged = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"), NCBrandOptions.shared.use_AppConfig { - if let serverUrl = configurationManaged[NCGlobal.shared.configuration_serverUrl] as? String { - self.configServerUrl = serverUrl - } - if let username = configurationManaged[NCGlobal.shared.configuration_username] as? String, !username.isEmpty, username.lowercased() != "username" { - self.configUsername = username - } - if let password = configurationManaged[NCGlobal.shared.configuration_password] as? String, !password.isEmpty, password.lowercased() != "password" { - self.configPassword = password - } - if let apppassword = configurationManaged[NCGlobal.shared.configuration_apppassword] as? String, !apppassword.isEmpty, apppassword.lowercased() != "apppassword" { - self.configAppPassword = apppassword - } - } - } - - // AppConfig - if let url = configServerUrl { - Task { - if let user = self.configUsername, let password = configAppPassword { - await createAccount(urlBase: url, user: user, password: password) - return - } else if let user = self.configUsername, let password = configPassword { - await getAppPassword(urlBase: url, user: user, password: password) - return - } else { - urlBase = url - } - } - } - } - - // MARK: - TextField - - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - textField.resignFirstResponder() - actionButtonLogin(self) - return false - } - - func textFieldDidBeginEditing(_ textField: UITextField) { - self.activeTextField = textField - } - - // MARK: - Keyboard notification - - @objc internal func keyboardWillShow(_ notification: Notification?) { - activeTextfieldDiff = 0 - if let info = notification?.userInfo, let centerObject = self.activeTextField.superview?.convert(self.activeTextField.center, to: nil) { - - let frameEndUserInfoKey = UIResponder.keyboardFrameEndUserInfoKey - if let keyboardFrame = info[frameEndUserInfoKey] as? CGRect { - let diff = keyboardFrame.origin.y - centerObject.y - self.activeTextField.frame.height - if diff < 0 { - activeTextfieldDiff = diff - imageBrandConstraintY.constant += diff - } - } - } - } - - @objc func keyboardWillHide(_ notification: Notification) { - imageBrandConstraintY.constant -= activeTextfieldDiff - } - - // MARK: - Action - - @objc func actionCancel(_ sender: Any?) { - dismiss(animated: true) { } - } - - @IBAction func actionButtonLogin(_ sender: Any) { - NCNetworking.shared.p12Data = nil - NCNetworking.shared.p12Password = nil - login() - } - - @IBAction func actionQRCode(_ sender: Any) { - let qrCode = NCLoginQRCode(delegate: self) - qrCode.scan() - } - - @IBAction func actionCertificate(_ sender: Any) { - - } - - // MARK: - Share accounts View Controller - - @objc func openShareAccountsViewController(_ sender: Any?) { - if let shareAccounts = self.shareAccounts, let vc = UIStoryboard(name: "NCShareAccounts", bundle: nil).instantiateInitialViewController() as? NCShareAccounts { - vc.accounts = shareAccounts - vc.enableTimerProgress = false - vc.dismissDidEnterBackground = false - vc.delegate = self - - let maximumHeight = view.safeAreaLayoutGuide.layoutFrame.height * 0.8 - let numberCell = shareAccounts.count - let height = min(CGFloat(numberCell * Int(vc.heightCell) + 45), maximumHeight) - let popup = NCPopupViewController(contentController: vc, popupWidth: 300, popupHeight: height + 20) - - self.present(popup, animated: true) - } - } - - // MARK: - Login - - private func login() { - guard var url = baseUrlTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) else { return } - if url.hasSuffix("/") { url = String(url.dropLast()) } - if url.isEmpty { return } - - attemptLogin(url: url) - } - - private func attemptLogin(url: String) { - var url = url - - if url.hasPrefix("https") == false && url.hasPrefix("http") == false { - url = "https://" + url - } else if url.isInsecureHTTPURL { - url = "https://" + url.dropFirst("http://".count) - } - - self.baseUrlTextField.text = url - startLogin(url: url) - } - - private func startLogin(url: String) { - loginButton.isEnabled = false - loginButton.hideButtonAndShowSpinner() - - NextcloudKit.shared.getServerStatus(serverUrl: url) { [self] _, serverInfoResult in - switch serverInfoResult { - case .success: - if let host = URL(string: url)?.host { - NCNetworking.shared.writeCertificate(host: host) - } - let loginOptions = NKRequestOptions(customUserAgent: userAgent) - NextcloudKit.shared.getLoginFlowV2(serverUrl: url, options: loginOptions) { [self] token, endpoint, login, _, error in - // Login Flow V2 - if error == .success, let token, let endpoint, let login { - nkLog(debug: "Successfully received login flow information.") - let loginProvider = NCLoginProvider() - loginProvider.initialURLString = login - loginProvider.delegate = self - loginProvider.controller = self.controller - loginProvider.presentingViewController = self - loginProvider.startPolling(loginFlowV2Token: token, loginFlowV2Endpoint: endpoint, loginFlowV2Login: login) - loginProvider.startAuthentication() - self.activeLoginProvider = loginProvider - } else { - let loginFlowError = error == .success ? NKError.invalidData : error - - nkLog(error: "Login flow v2 failed: \(loginFlowError.logDescription)") - - loginButton.hideSpinnerAndShowButton() - loginButton.isEnabled = true - - let alertController = UIAlertController(title: NSLocalizedString("_connection_error_", comment: ""), message: loginFlowError.localizedGenericMessage, preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in })) - self.present(alertController, animated: true, completion: { }) - } - } - case .failure(let error): - loginButton.hideSpinnerAndShowButton() - loginButton.isEnabled = true - - if error.errorCode == NSURLErrorServerCertificateUntrusted { - let alertController = UIAlertController(title: NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), message: NSLocalizedString("_connect_server_anyway_", comment: ""), preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .default, handler: { _ in - if let host = URL(string: url)?.host { - NCNetworking.shared.writeCertificate(host: host) - } - })) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_", comment: ""), style: .default, handler: { _ in })) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_certificate_details_", comment: ""), style: .default, handler: { _ in - if let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() as? UINavigationController, - let viewController = navigationController.topViewController as? NCViewCertificateDetails { - if let host = URL(string: url)?.host { - viewController.host = host - } - self.present(navigationController, animated: true) - } - })) - self.present(alertController, animated: true) - } else if url.lowercased().hasPrefix("https://") { - let httpUrl = "http://" + url.dropFirst("https://".count) - - #if DEBUG - self.baseUrlTextField.text = httpUrl - self.startLogin(url: httpUrl) - #else - // Any failed https attempt may fall back to plain http, but only with explicit consent. - let alertController = UIAlertController(title: NSLocalizedString("_warning_", comment: ""), - message: NSLocalizedString("_https_failed_try_http_", comment: ""), - preferredStyle: .alert) - - alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel)) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_continue_", comment: ""), style: .destructive) { _ in - self.baseUrlTextField.text = httpUrl - self.startLogin(url: httpUrl) - }) - - self.present(alertController, animated: true) - #endif - } else { - let alertController = UIAlertController(title: NSLocalizedString("_connection_error_", comment: ""), message: error.localizedGenericMessage, preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in })) - self.present(alertController, animated: true, completion: { }) - } - } - } - } - - // MARK: - QRCode - - func dismissQRCode(_ value: String?, metadataType: String?) { - guard let value, !QRCodeCheck else { - return - } - QRCodeCheck = true - - Task { @MainActor in - let protocolLogin = NCBrandOptions.shared.webLoginAutenticationProtocol + "login/" - let protocolLoginOneTime = NCBrandOptions.shared.webLoginAutenticationProtocol + "onetime-login/" - var parameters: String = "" - - if value.hasPrefix(protocolLoginOneTime) { - parameters = value.replacingOccurrences(of: protocolLoginOneTime, with: "") - } else if value.hasPrefix(protocolLogin) { - parameters = value.replacingOccurrences(of: protocolLogin, with: "") - } else { - QRCodeCheck = false - return - } - - guard parameters.contains("user:"), - parameters.contains("password:"), - parameters.contains("server:") else { - QRCodeCheck = false - return - } - let parametersArray = parameters.components(separatedBy: "&") - let user = parametersArray[0].replacingOccurrences(of: "user:", with: "") - let password = parametersArray[1].replacingOccurrences(of: "password:", with: "") - let server = parametersArray[2].replacingOccurrences(of: "server:", with: "") - - if value.hasPrefix(protocolLoginOneTime) { - let results = await NextcloudKit.shared.getAppPasswordOnetimeAsync(url: server, user: user, onetimeToken: password) - if results.error == .success, let token = results.token { - await createAccount(urlBase: server, user: user, password: token) - } else { - let windowScene = SceneManager.shared.getWindowScene(controller: self.controller) - - let error = results.error == .success ? NKError.invalidData : results.error - - await showErrorBanner(windowScene: windowScene, error: error) - dismiss(animated: true, completion: nil) - } - } else if value.hasPrefix(protocolLogin) { - await self.createAccount(urlBase: server, user: user, password: password) - } - } - } - - private func getAppPassword(urlBase: String, user: String, password: String) async { - let results = await NextcloudKit.shared.getAppPasswordAsync(url: urlBase, user: user, password: password) - - if results.error == .success, let password = results.token { - await self.createAccount(urlBase: urlBase, user: user, password: password) - } else { - let windowScene = SceneManager.shared.getWindowScene(controller: self.controller) - - let error = results.error == .success ? NKError.invalidData : results.error - - await showErrorBanner(windowScene: windowScene, error: error) - dismiss(animated: true, completion: nil) - } - } - - @MainActor - private func createAccount(urlBase: String, user: String, password: String) async { - if self.controller == nil { - self.controller = SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) - } - - if let host = URL(string: urlBase)?.host { - NCNetworking.shared.writeCertificate(host: host) - } - - await NCAccount().createAccount(viewController: self, urlBase: urlBase, user: user, password: password, controller: self.controller) - } -} - -// MARK: - NCShareAccountsDelegate - -extension NCLogin: NCShareAccountsDelegate { - func selected(url: String, user: String) { - attemptLogin(url: url) - } -} - -// MARK: - UIDocumentPickerDelegate - -extension NCLogin: ClientCertificateDelegate, UIDocumentPickerDelegate { - func didAskForClientCertificate() { - let alertNoCertFound = UIAlertController(title: NSLocalizedString("_no_client_cert_found_", comment: ""), message: NSLocalizedString("_no_client_cert_found_desc_", comment: ""), preferredStyle: .alert) - alertNoCertFound.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil)) - alertNoCertFound.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in - let documentProviderMenu = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.pkcs12]) - documentProviderMenu.delegate = self - self.present(documentProviderMenu, animated: true, completion: nil) - })) - DispatchQueue.main.async { - self.present(alertNoCertFound, animated: true) - } - } - - func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { - let alertEnterPassword = UIAlertController(title: NSLocalizedString("_client_cert_enter_password_", comment: ""), message: "", preferredStyle: .alert) - alertEnterPassword.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil)) - alertEnterPassword.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in - NCNetworking.shared.p12Data = try? Data(contentsOf: urls[0]) - NCNetworking.shared.p12Password = alertEnterPassword.textFields?[0].text - self.login() - })) - alertEnterPassword.addTextField { textField in - textField.isSecureTextEntry = true - } - DispatchQueue.main.async { - self.present(alertEnterPassword, animated: true) - } - } - - func onIncorrectPassword() { - NCNetworking.shared.p12Data = nil - NCNetworking.shared.p12Password = nil - let alertWrongPassword = UIAlertController(title: NSLocalizedString("_client_cert_wrong_password_", comment: ""), message: "", preferredStyle: .alert) - alertWrongPassword.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default)) - DispatchQueue.main.async { - self.present(alertWrongPassword, animated: true) - } - } -} - -// MARK: - NCLoginProviderDelegate - -extension NCLogin: NCLoginProviderDelegate { - func onBack() { - loginButton.isEnabled = true - loginButton.hideSpinnerAndShowButton() - activeLoginProvider?.cancel() - activeLoginProvider = nil - } -} diff --git a/iOSClient/Login/NCLoginProvider.swift b/iOSClient/Login/NCLoginProvider.swift deleted file mode 100644 index 405f4429b8..0000000000 --- a/iOSClient/Login/NCLoginProvider.swift +++ /dev/null @@ -1,401 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2025 Iva Horn -// SPDX-FileCopyrightText: 2025 Milen Pivchev -// SPDX-License-Identifier: GPL-3.0-or-later - -import AuthenticationServices -import UIKit -@preconcurrency import WebKit -import NextcloudKit - -protocol NCLoginProviderDelegate: AnyObject { - /// - /// Called when the authentication is cancelled or fails. - /// - func onBack() -} - -/// -/// Handles login authentication using ASWebAuthenticationSession with WKWebView fallback for mTLS. -/// -class NCLoginProvider: NSObject, ASWebAuthenticationPresentationContextProviding { - var initialURLString = "" - weak var delegate: NCLoginProviderDelegate? - var controller: NCMainTabBarController? - - /// The presenting view controller for the authentication session. - weak var presentingViewController: UIViewController? - - /// The active authentication session. - private var authSession: ASWebAuthenticationSession? - - /// Fallback web view controller for mTLS/certificate handling. - private var webViewFallbackVC: NCLoginProviderWebViewFallback? - - /// - /// A polling loop active in the background to check for the current status of the login flow. - /// - var pollingTask: Task? - - // MARK: - ASWebAuthenticationPresentationContextProviding - - func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { - return presentingViewController?.view.window ?? UIApplication.shared.mainAppWindow ?? ASPresentationAnchor() - } - - // MARK: - Authentication - - /// - /// Start the authentication flow using ASWebAuthenticationSession. - /// Falls back to WKWebView if authentication fails (e.g., asked for mTLS cert etc). - /// - func startAuthentication() { - guard let url = URL(string: initialURLString) else { - Task { - let windowScene = SceneManager.shared.getWindowScene(controller: self.controller) - await showErrorBanner(windowScene: windowScene, text: "_login_url_error_", errorCode: NCGlobal.shared.errorInternalError) - } - return - } - - // Use custom URL scheme to handle login callbacks (e.g., nc://login/...) - let callbackScheme = NCBrandOptions.shared.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "") - - authSession = ASWebAuthenticationSession(url: url, callbackURLScheme: callbackScheme) { [weak self] callbackURL, error in - guard let self else { return } - - if let error = error { - if let asError = error as? ASWebAuthenticationSessionError, asError.code == .canceledLogin { - // Only treat as user cancellation if polling hasn't succeeded yet - if self.pollingTask != nil { - Task { @MainActor in - self.delegate?.onBack() - } - } - } else { - // Fall back to WKWebView for other errors (e.g., certificate issues) - Task { @MainActor in - self.fallbackToWebView(url: url) - } - } - return - } - - // Handle login callback URL (e.g., nc://login/server:...&user:...&password:...) - if let callbackURL { - self.handleLoginCallback(url: callbackURL) - } - } - - authSession?.presentationContextProvider = self - authSession?.prefersEphemeralWebBrowserSession = true - - if authSession?.start() != true { - // Fall back to WKWebView if ASWebAuthenticationSession fails to start - fallbackToWebView(url: url) - } - } - - /// - /// Cancel the authentication session and clean up. - /// - func cancel() { - authSession?.cancel() - authSession = nil - - webViewFallbackVC?.dismiss(animated: true) - webViewFallbackVC = nil - - pollingTask?.cancel() - pollingTask = nil - } - - // MARK: - WKWebView Fallback - - /// - /// Present WKWebView as a fallback for mTLS/certificate handling. - /// - private func fallbackToWebView(url: URL) { - authSession?.cancel() - authSession = nil - - guard let presentingVC = presentingViewController else { return } - - let fallbackVC = NCLoginProviderWebViewFallback() - fallbackVC.initialURL = url - fallbackVC.initialURLString = initialURLString - fallbackVC.controller = controller - fallbackVC.loginProvider = self - - let navController = UINavigationController(rootViewController: fallbackVC) - navController.modalPresentationStyle = .fullScreen - - presentingVC.present(navController, animated: true) - self.webViewFallbackVC = fallbackVC - } - - /// - /// Handle the login callback URL from the authentication session. - /// - func handleLoginCallback(url: URL) { - let urlString = url.absoluteString.lowercased() - - // Check if this is a login callback - guard urlString.hasPrefix(NCBrandOptions.shared.webLoginAutenticationProtocol) && urlString.contains("login") else { - return - } - - var server: String = "" - var user: String = "" - var password: String = "" - let keyValue = url.path.components(separatedBy: "&") - - for value in keyValue { - if value.contains("server:") { server = value } - if value.contains("user:") { user = value } - if value.contains("password:") { password = value } - } - - if !server.isEmpty, !user.isEmpty, !password.isEmpty { - let server = server.replacingOccurrences(of: "/server:", with: "") - let username = user.replacingOccurrences(of: "user:", with: "").replacingOccurrences(of: "+", with: " ") - let password = password.replacingOccurrences(of: "password:", with: "") - - // Stop polling since we got credentials from callback - pollingTask?.cancel() - pollingTask = nil - - // Dismiss fallback web view if present - webViewFallbackVC?.dismiss(animated: true) - webViewFallbackVC = nil - - if self.controller == nil { - self.controller = SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) - } - - Task { @MainActor in - guard let viewController = self.presentingViewController else { return } - await NCAccount().createAccount(viewController: viewController, urlBase: server, user: username, password: password, controller: self.controller) - } - } - } - - // MARK: - Polling - - /// - /// Start checking the status of the login flow in the background periodically. - /// - func startPolling(loginFlowV2Token: String, loginFlowV2Endpoint: String, loginFlowV2Login: String) { - nkLog(start: "Starting polling at \(loginFlowV2Endpoint) with token \(loginFlowV2Token)") - pollingTask = createPollingTask(token: loginFlowV2Token, endpoint: loginFlowV2Endpoint) - nkLog(debug: "Polling task created.") - } - - /// - /// Fetch the server response and process it. - /// - private func poll(token: String, endpoint: String, options: NKRequestOptions) async -> (urlBase: String, loginName: String, appPassword: String)? { - await withCheckedContinuation { continuation in - NextcloudKit.shared.getLoginFlowV2Poll(token: token, endpoint: endpoint, options: options) { server, loginName, appPassword, _, error in - - guard error == .success else { - continuation.resume(returning: nil) - return - } - - guard let urlBase = server else { - nkLog(error: "Login poll response field for server for token \"\(token)\" is nil!") - continuation.resume(returning: nil) - return - } - - guard let user = loginName else { - nkLog(error: "Login poll response field for user name for token \"\(token)\" is nil!") - continuation.resume(returning: nil) - return - } - - guard let appPassword = appPassword else { - nkLog(error: "Login poll response field for app password for token \"\(token)\" is nil!") - continuation.resume(returning: nil) - return - } - - nkLog(debug: "Returning login poll response for \"\(user)\" on \"\(urlBase)\" for token \"\(token)\".") - continuation.resume(returning: (urlBase, user, appPassword)) - } - } - } - - /// - /// Handle login when polling is successful and access is granted. - /// - private func handleGrant(urlBase: String, loginName: String, appPassword: String) async { - nkLog(debug: "Handling login grant values for \(loginName) on \(urlBase)") - - // Cancel the auth session since login was successful - authSession?.cancel() - authSession = nil - - // Dismiss fallback web view if present - webViewFallbackVC?.dismiss(animated: true) - webViewFallbackVC = nil - - if controller == nil { - nkLog(debug: "View controller is still undefined, will resolve root view controller of first window.") - controller = SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) - } - - guard let viewController = presentingViewController else { - nkLog(error: "No presenting view controller available for account creation.") - return - } - - await NCAccount().createAccount(viewController: viewController, urlBase: urlBase, user: loginName, password: appPassword, controller: controller) - nkLog(debug: "Account creation for \(loginName) on \(urlBase) completed based on login grant values.") - } - - /// - /// Sets up polling. - /// - private func createPollingTask(token: String, endpoint: String) -> Task { - let options = NKRequestOptions(customUserAgent: userAgent) - var grantValues: (urlBase: String, loginName: String, appPassword: String)? - - return Task { @MainActor in - repeat { - try Task.checkCancellation() - - grantValues = await poll(token: token, endpoint: endpoint, options: options) - try await Task.sleep(for: .seconds(1)) - } while grantValues == nil - - guard let grantValues else { - return - } - - // Clear the polling task before handling grant to prevent cancellation callback - self.pollingTask = nil - - await handleGrant(urlBase: grantValues.urlBase, loginName: grantValues.loginName, appPassword: grantValues.appPassword) - nkLog(debug: "Polling task completed.") - } - } -} - -// MARK: - WKWebView Fallback View Controller - -/// -/// Fallback view controller using WKWebView for mTLS/certificate handling. -/// -class NCLoginProviderWebViewFallback: UIViewController, WKNavigationDelegate { - var initialURL: URL? - var initialURLString = "" - var controller: NCMainTabBarController? - weak var loginProvider: NCLoginProvider? - - private var webView: WKWebView! - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = NCBrandColor.shared.customer - - // Navigation bar - let closeButton = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .plain, target: self, action: #selector(closeTapped)) - closeButton.tintColor = .white - navigationItem.leftBarButtonItem = closeButton - - if let host = initialURL?.host { - title = host - } - - // Web view setup - let configuration = WKWebViewConfiguration() - configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent() - - webView = WKWebView(frame: .zero, configuration: configuration) - webView.customUserAgent = userAgent - webView.navigationDelegate = self - view.addSubview(webView) - - webView.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint.activate([ - webView.leadingAnchor.constraint(equalTo: view.leadingAnchor), - webView.trailingAnchor.constraint(equalTo: view.trailingAnchor), - webView.topAnchor.constraint(equalTo: view.topAnchor), - webView.bottomAnchor.constraint(equalTo: view.bottomAnchor) - ]) - - if let url = initialURL { - loadWebPage(url: url) - } - } - - @objc private func closeTapped() { - loginProvider?.delegate?.onBack() - dismiss(animated: true) - } - - private func loadWebPage(url: URL) { - let language = NSLocale.preferredLanguages[0] as String - var request = URLRequest(url: url) - - request.addValue("true", forHTTPHeaderField: "OCS-APIRequest") - request.addValue(language, forHTTPHeaderField: "Accept-Language") - - webView.load(request) - } - - // MARK: - WKNavigationDelegate - - func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) { - guard let currentWebViewURL = webView.url else { return } - - let currentWebViewURLString = currentWebViewURL.absoluteString.lowercased() - - // Prevent HTTP redirects - if initialURLString.lowercased().hasPrefix("https://") && currentWebViewURLString.hasPrefix("http://") { - let alertController = UIAlertController( - title: NSLocalizedString("_error_", comment: ""), - message: NSLocalizedString("_prevent_http_redirection_", comment: ""), - preferredStyle: .alert - ) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { _ in - self.dismiss(animated: true) - }) - present(alertController, animated: true) - return - } - - // Login via provider - if currentWebViewURLString.hasPrefix(NCBrandOptions.shared.webLoginAutenticationProtocol) && currentWebViewURLString.contains("login") { - loginProvider?.handleLoginCallback(url: currentWebViewURL) - } - } - - func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { - DispatchQueue.global().async { - if let serverTrust = challenge.protectionSpace.serverTrust { - completionHandler(.useCredential, URLCredential(trust: serverTrust)) - } else { - completionHandler(.useCredential, nil) - } - } - } - - func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { - nkLog(debug: "Web view will allow navigation to \(navigationAction.request.url?.absoluteString ?? "nil")") - decisionHandler(.allow) - } - - func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { - nkLog(debug: "Web view did start provisional navigation.") - NCActivityIndicator.shared.startActivity(backgroundView: view, style: .medium, blurEffect: false) - } - - func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { - nkLog(debug: "Web view did finish navigation to \(webView.url?.absoluteString ?? "nil")") - NCActivityIndicator.shared.stop() - } -} diff --git a/iOSClient/Login/NCLoginQRCode.swift b/iOSClient/Login/NCLoginQRCode.swift deleted file mode 100644 index 64c6ea97ef..0000000000 --- a/iOSClient/Login/NCLoginQRCode.swift +++ /dev/null @@ -1,81 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2019 Marino Faggiana -// SPDX-License-Identifier: GPL-3.0-or-later - -import UIKit -import QRCodeReader - -@objc public protocol NCLoginQRCodeDelegate { - @objc func dismissQRCode(_ value: String?, metadataType: String?) -} - -class NCLoginQRCode: NSObject, QRCodeReaderViewControllerDelegate { - lazy var reader: QRCodeReader = QRCodeReader() - weak var delegate: UIViewController? - lazy var readerVC: QRCodeReaderViewController = { - let builder = QRCodeReaderViewControllerBuilder { - $0.reader = QRCodeReader(metadataObjectTypes: [.qr], captureDevicePosition: .back) - $0.showTorchButton = true - $0.preferredStatusBarStyle = .lightContent - $0.showOverlayView = true - $0.rectOfInterest = CGRect(x: 0.2, y: 0.2, width: 0.6, height: 0.6) - - $0.reader.stopScanningWhenCodeIsFound = false - } - return QRCodeReaderViewController(builder: builder) - }() - - override init() { } - - @objc public init(delegate: UIViewController) { - self.delegate = delegate - } - - @objc func scan() { - guard checkScanPermissions() else { return } - - readerVC.modalPresentationStyle = .formSheet - readerVC.delegate = self - - readerVC.completionBlock = { (_: QRCodeReaderResult?) in - self.readerVC.dismiss(animated: true, completion: nil) - } - delegate?.present(readerVC, animated: true, completion: nil) - } - - private func checkScanPermissions() -> Bool { - do { - return try QRCodeReader.supportsMetadataObjectTypes() - } catch let error as NSError { - let alert: UIAlertController - switch error.code { - case -11852: - alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_qrcode_not_authorized_", comment: ""), preferredStyle: .alert) - alert.addAction(UIAlertAction(title: NSLocalizedString("_settings_", comment: ""), style: .default, handler: { _ in - DispatchQueue.main.async { - if let settingsURL = URL(string: UIApplication.openSettingsURLString) { - UIApplication.shared.open(settingsURL, options: [:], completionHandler: nil) - } - } - })) - - alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil)) - default: - alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_qrcode_not_supported_", comment: ""), preferredStyle: .alert) - alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .cancel, handler: nil)) - } - delegate?.present(alert, animated: true, completion: nil) - return false - } - } - - func reader(_ reader: QRCodeReaderViewController, didScanResult result: QRCodeReaderResult) { - reader.stopScanning() - (self.delegate as? NCLoginQRCodeDelegate)?.dismissQRCode(result.value, metadataType: result.metadataType) - } - - func readerDidCancel(_ reader: QRCodeReaderViewController) { - reader.stopScanning() - (self.delegate as? NCLoginQRCodeDelegate)?.dismissQRCode(nil, metadataType: nil) - } -} diff --git a/iOSClient/Networking/NCNetworking.swift b/iOSClient/Networking/NCNetworking.swift index 9e4e518436..5fd0564822 100644 --- a/iOSClient/Networking/NCNetworking.swift +++ b/iOSClient/Networking/NCNetworking.swift @@ -11,11 +11,6 @@ import UIKit import NextcloudKit import Alamofire -protocol ClientCertificateDelegate: AnyObject { - func onIncorrectPassword() - func didAskForClientCertificate() -} - protocol NCTransferDelegate: AnyObject { var sceneIdentifier: String { get } @@ -72,7 +67,6 @@ class NCNetworking: @unchecked Sendable, NextcloudKitDelegate { var lastReachability: Bool = true var networkReachability: NKTypeReachability? - weak var certificateDelegate: ClientCertificateDelegate? var p12Data: Data? var p12Password: String? @@ -123,12 +117,11 @@ class NCNetworking: @unchecked Sendable, NextcloudKitDelegate { if let p12Data = self.p12Data, 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.") }) { let creds = PKCS12.urlCredential(for: pkcs12) completionHandler(URLSession.AuthChallengeDisposition.useCredential, creds) } else { - self.certificateDelegate?.didAskForClientCertificate() completionHandler(URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil) } } else { diff --git a/iOSClient/SceneDelegate.swift b/iOSClient/SceneDelegate.swift index 43294a619b..ff0c262750 100644 --- a/iOSClient/SceneDelegate.swift +++ b/iOSClient/SceneDelegate.swift @@ -126,11 +126,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } if NCBrandOptions.shared.disable_intro { - if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin { - let navigationController = UINavigationController(rootViewController: viewController) - window?.rootViewController = navigationController - window?.makeKeyAndVisible() - } + window?.rootViewController = NCLoginHostingController(controller: nil, presentation: .windowRoot) + window?.makeKeyAndVisible() } else { if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController { window?.rootViewController = navigationController diff --git a/iOSClient/Settings/Acknowledgements.rtf b/iOSClient/Settings/Acknowledgements.rtf index 9ca49c01cb..2469e848b0 100644 --- a/iOSClient/Settings/Acknowledgements.rtf +++ b/iOSClient/Settings/Acknowledgements.rtf @@ -303,18 +303,6 @@ License: https://github.com/google/promises/blob/f4a19a3c313dc2616c70bb49d29a799 __________________________________\ \ -\f1\b QRCodeReader.swift\f0\b0\ -\ -https://github.com/yannickl/QRCodeReader.swift\ -\ -MIT License\ -\ -Copyright (c) 2014-present Yannick Loriot\ -\ -License: https://github.com/yannickl/QRCodeReader.swift/blob/5020b5a47199d8ba80c83a4b4fafd70e9dc9dc7f/LICENSE\ -__________________________________\ -\ - \f1\b Realm Core\f0\b0\ \ https://github.com/realm/realm-core\ diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings index cd77e60250..85f2c2bc1c 100644 --- a/iOSClient/Supporting Files/en.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings @@ -142,10 +142,8 @@ "_privacy_legal_" = "Privacy and Legal Policy"; "_source_code_" = "Get source code"; "_account_select_" = "Select the account"; -"_account_select_to_add_" = "Select the account to add"; "_remove_local_account_" = "Remove local account"; "_want_delete_account_" = "Do you want to remove local account?"; -"_prevent_http_redirection_"= "The redirection in HTTP is not permitted."; "_http_account_insecure_" = "This account uses an insecure HTTP server address. Data is transmitted unencrypted."; "_https_failed_try_http_" = "A secure connection could not be established. Do you want to try insecure HTTP instead? Your data will be transmitted unencrypted."; "_single_file_conflict_title_" = "File conflict"; @@ -267,9 +265,6 @@ "_set_log_level_" = "Set Log level"; "_connect_server_anyway_" = "Do you want to connect to the server anyway?"; "_server_is_trusted_" = "Do you consider this server trusted?"; -"_connection_error_" = "Connection error"; -"_login_url_" = "Server address https:// …"; -"_login_url_error_" = "URL error, please verify your server URL"; "_favorites_" = "Favorites"; "_favorite_short_" = "Favorite"; "_tutorial_favorite_view_" = "Files and folders you mark as favorites will show up here"; @@ -347,7 +342,6 @@ "_good_afternoon_" = "Good afternoon"; "_good_evening_" = "Good evening"; "_good_night_" = "Good night"; -"_servers_" = "Servers"; "_select_server_" = "Please select a server..."; // MARK: Share @@ -470,8 +464,6 @@ "_file_already_exists_" = "Could not complete the operation, a file with the same name exists."; "_err_permission_microphone_" = "Please allow Microphone usage from Settings."; "_err_permission_photolibrary_" = "Please allow Photos from Settings."; -"_qrcode_not_authorized_" = "This app is not authorized to use the Back Camera."; -"_qrcode_not_supported_" = "QR code not supported by the current device."; "_create_voice_memo_" = "Create voice memo"; "_voice_memo_start_" = "Tap to start"; "_voice_memo_stop_" = "Tap to stop"; @@ -532,8 +524,6 @@ "_description_lockscreenwidget_" = "Keep an eye on available space and recent activity"; "_keep_running_" = "Keep the app running for a better user experience."; -"_apps_nextcloud_detect_" = "Detected %@ apps"; -"_add_existing_account_" = "Other %@ Apps has been detected, do you want to add an existing account?"; "_status_in_progress_" = "Status reading in progress …"; "_status_e2ee_on_server_" = "The end-to-end encryption is already configured in the server but not yet enabled on this device."; "_status_e2ee_not_setup_" = "The end-to-end encryption is not yet configured on the server."; @@ -681,10 +671,6 @@ "_assistant_error_generate_response_" = "Could not generate response. Please try again."; // MARK: Client certificate -"_no_client_cert_found_" = "The server is requesting a client certificate."; -"_no_client_cert_found_desc_" = "Do you want to install a TLS client certificate? \n Note that the .p12 certificate must be installed on your device first by clicking on it and installing it as an Identitity Certificate Profile in Settings. The certificate MUST also have a password as that is a requirement by iOS."; -"_client_cert_enter_password_" = "Enter the password for the chosen certificate"; -"_client_cert_wrong_password_" = "Sorry, you entered an invalid password."; // MARK: Login poll From 88cf06ee5ecfd67bddb9a113151286e0265aeedc Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 19 Nov 2026 19:30:24 +0100 Subject: [PATCH 05/30] fix: harden the managed configuration auto-login 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 Signed-off-by: Milen Pivchev --- .../NextcloudUnitTests/NCLoginAppConfigTests.swift | 8 ++++++++ iOSClient/Login/NCLoginAppConfig.swift | 14 ++++++++++---- iOSClient/Login/NCLoginCoordinator.swift | 13 ++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift b/Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift index 78e321380f..6f0e114bd7 100644 --- a/Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift +++ b/Tests/NextcloudUnitTests/NCLoginAppConfigTests.swift @@ -40,6 +40,14 @@ struct NCLoginAppConfigTests { #expect(action(managed) == .requestAppPassword(serverURL: server, user: "jane", password: "plain")) } + @Test("Surrounding whitespace is trimmed except from the password") + func trimming() { + #expect(action(["serverUrl": " \(server)\n"]) == .prefill(serverURL: server)) + #expect(action(["serverUrl": server, "username": " jane ", "apppassword": "secret\n"]) == .createAccount(serverURL: server, user: "jane", appPassword: "secret")) + #expect(action(["serverUrl": server, "username": "jane", "password": " pass "]) == .requestAppPassword(serverURL: server, user: "jane", password: " pass ")) + #expect(action(["serverUrl": " "]) == nil) + } + @Test("Template placeholder values are ignored") func placeholders() { let managed = ["serverUrl": server, "username": "Username", "password": "password", "apppassword": "AppPassword"] diff --git a/iOSClient/Login/NCLoginAppConfig.swift b/iOSClient/Login/NCLoginAppConfig.swift index 0649a63e36..fccba236e2 100644 --- a/iOSClient/Login/NCLoginAppConfig.swift +++ b/iOSClient/Login/NCLoginAppConfig.swift @@ -24,7 +24,7 @@ enum NCLoginAppConfig { guard let serverURL = value(in: managed, for: global.configuration_serverUrl, placeholder: nil) else { return nil } let user = value(in: managed, for: global.configuration_username, placeholder: "username") - let password = value(in: managed, for: global.configuration_password, placeholder: "password") + let password = value(in: managed, for: global.configuration_password, placeholder: "password", trimming: false) let appPassword = value(in: managed, for: global.configuration_apppassword, placeholder: "apppassword") if let user, let appPassword { @@ -38,9 +38,15 @@ enum NCLoginAppConfig { return .prefill(serverURL: serverURL) } - /// MDM templates ship the key name as a placeholder value. - private static func value(in managed: [String: Any], for key: String, placeholder: String?) -> String? { - guard let value = managed[key] as? String, !value.isEmpty, value.lowercased() != placeholder else { return nil } + /// MDM templates ship the key name as a placeholder value. Only passwords keep surrounding whitespace. + private static func value(in managed: [String: Any], for key: String, placeholder: String?, trimming: Bool = true) -> String? { + guard var value = managed[key] as? String else { return nil } + + if trimming { + value = value.trimmingCharacters(in: .whitespacesAndNewlines) + } + + guard !value.isEmpty, value.lowercased() != placeholder else { return nil } return value } diff --git a/iOSClient/Login/NCLoginCoordinator.swift b/iOSClient/Login/NCLoginCoordinator.swift index 6954394ae8..895cc35e88 100644 --- a/iOSClient/Login/NCLoginCoordinator.swift +++ b/iOSClient/Login/NCLoginCoordinator.swift @@ -66,6 +66,14 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { /// Accounts of other Nextcloud apps on this device which are not added here yet. func loadSharedAccounts() -> [SharedAccount] { + // Their sheet would still be open when the managed configuration logs in by itself. + switch appConfigAction { + case .createAccount, .requestAppPassword: + return [] + case .prefill, nil: + break + } + guard let directory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps), let shareAccounts = NKShareAccounts().getShareAccount(at: directory, application: UIApplication.shared) else { return [] @@ -149,7 +157,10 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { return } - guard let host = URL(string: serverURL) else { return } + guard let host = URL(string: serverURL) else { + await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: .urlError) + return + } do { try await addAccount(host: host, user: user, password: password) From 078b505fb1ffa105bc7238d811f4d3b2e58e0ab0 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 19 Nov 2026 19:30:24 +0100 Subject: [PATCH 06/30] fix: stop offering a removed account to other apps 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 Signed-off-by: Milen Pivchev --- iOSClient/Account/NCAccount.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iOSClient/Account/NCAccount.swift b/iOSClient/Account/NCAccount.swift index af6fc51496..9e6eac7319 100644 --- a/iOSClient/Account/NCAccount.swift +++ b/iOSClient/Account/NCAccount.swift @@ -172,6 +172,8 @@ class NCAccount: NSObject { NCPreferences().clearAllKeysPushNotification(account: account) // Remove Account Server in Error NCNetworking.shared.removeServerErrorAccount(account) + // Stop offering the account to other apps + _ = await updateAppsShareAccounts() } func deleteAllAccounts() async { From 06e54109771fd544777ccf2bbd8e34bd5cbc2f36 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 19 Nov 2026 19:30:24 +0100 Subject: [PATCH 07/30] refactor: drop the login status bar override and empty string sections 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 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCLoginHostingController.swift | 4 ---- iOSClient/Supporting Files/en.lproj/Localizable.strings | 4 ---- 2 files changed, 8 deletions(-) diff --git a/iOSClient/Login/NCLoginHostingController.swift b/iOSClient/Login/NCLoginHostingController.swift index a7bb984930..c326c68991 100644 --- a/iOSClient/Login/NCLoginHostingController.swift +++ b/iOSClient/Login/NCLoginHostingController.swift @@ -34,10 +34,6 @@ final class NCLoginHostingController: UIHostingController { fatalError("init(coder:) has not been implemented") } - override var preferredStatusBarStyle: UIStatusBarStyle { - NCBrandColor.shared.customer.isTooLight() ? .darkContent : .lightContent - } - override func viewDidLoad() { super.viewDidLoad() diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings index 85f2c2bc1c..c2337b4b74 100644 --- a/iOSClient/Supporting Files/en.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings @@ -670,10 +670,6 @@ "_assistant_error_load_messages_" = "Could not load messages. Please try again."; "_assistant_error_generate_response_" = "Could not generate response. Please try again."; -// MARK: Client certificate - -// MARK: Login poll - // MARK: File name validator "_file_name_validator_error_reserved_name_" = "\"%@\" is a forbidden name."; "_file_name_new_extension_" = "Changing the extension might cause this file to open in a different application."; From ca64f10171c6cfac015337308a650b1825b24aff Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Fri, 20 Nov 2026 17:43:19 +0100 Subject: [PATCH 08/30] fix: hand the provider sign-up back to the app 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 Signed-off-by: Milen Pivchev --- Brand/Intro/NCIntroViewController.swift | 7 +- iOSClient/Login/NCProviderSignUp.swift | 153 ++++++++++++++++++------ 2 files changed, 120 insertions(+), 40 deletions(-) diff --git a/Brand/Intro/NCIntroViewController.swift b/Brand/Intro/NCIntroViewController.swift index f3f07cf459..b29d29845c 100644 --- a/Brand/Intro/NCIntroViewController.swift +++ b/Brand/Intro/NCIntroViewController.swift @@ -20,7 +20,6 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol private var timer: Timer? private var textColor: UIColor = .white private var textColorOpponent: UIColor = .black - private var providerSignUp: NCProviderSignUp? // MARK: - View Life Cycle @@ -166,9 +165,9 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol let coordinator = NCLoginCoordinator(controller: controller, presentation: .pushed) coordinator.presenter = self - let providerSignUp = NCProviderSignUp(coordinator: coordinator) - providerSignUp.start(url: url) - self.providerSignUp = providerSignUp + let navigationController = UINavigationController(rootViewController: NCProviderSignUp(url: url, coordinator: coordinator)) + navigationController.modalPresentationStyle = .fullScreen + present(navigationController, animated: true) } @IBAction func host(_ sender: Any) { diff --git a/iOSClient/Login/NCProviderSignUp.swift b/iOSClient/Login/NCProviderSignUp.swift index e1696349e5..8b4c09d380 100644 --- a/iOSClient/Login/NCProviderSignUp.swift +++ b/iOSClient/Login/NCProviderSignUp.swift @@ -2,66 +2,147 @@ // SPDX-FileCopyrightText: 2026 Milen Pivchev // SPDX-License-Identifier: GPL-3.0-or-later -import AuthenticationServices import NextcloudKit import NextcloudKitUI import UIKit +@preconcurrency import WebKit -/// Signs up with a provider in the browser, which redirects to the login callback URL with the new account's credentials. -@MainActor -final class NCProviderSignUp: NSObject, ASWebAuthenticationPresentationContextProviding { +/// Signs up with a provider and adds the new account from the login callback URL the sign-up ends on. +/// +/// A web view instead of a browser session, because the sign-up page only hands over credentials to page loads with the OCS API header. +final class NCProviderSignUp: UIViewController, WKNavigationDelegate { + private static let apiHeader = "OCS-APIRequest" + + private let url: URL private let coordinator: NCLoginCoordinator - private var session: ASWebAuthenticationSession? + private let scheme = NCBrandOptions.shared.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "").lowercased() + private var reissuedURL: URL? + private var isFinished = false - init(coordinator: NCLoginCoordinator) { + init(url: URL, coordinator: NCLoginCoordinator) { + self.url = url self.coordinator = coordinator + + super.init(nibName: nil, bundle: nil) } - func start(url: URL) { - let scheme = NCBrandOptions.shared.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "") + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - let session = ASWebAuthenticationSession(url: url, callbackURLScheme: scheme) { [weak self] callbackURL, error in - Task { @MainActor in - await self?.finish(callbackURL: callbackURL, error: error, scheme: scheme) - } - } + override func viewDidLoad() { + super.viewDidLoad() - session.presentationContextProvider = self - session.prefersEphemeralWebBrowserSession = true - self.session = session + title = url.host + view.backgroundColor = .systemBackground + navigationItem.leftBarButtonItem = UIBarButtonItem(systemItem: .close, primaryAction: UIAction { [weak self] _ in + self?.dismiss(animated: true) + }) - session.start() + let configuration = WKWebViewConfiguration() + configuration.websiteDataStore = .nonPersistent() + + let webView = WKWebView(frame: view.bounds, configuration: configuration) + webView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + webView.customUserAgent = userAgent + webView.navigationDelegate = self + view.addSubview(webView) + + webView.load(Self.apiRequest(for: Self.uncachedURL(url))) } - private func finish(callbackURL: URL?, error: Error?, scheme: String) async { - session = nil + /// nextcloud.com serves its sign-up page from a cache that ignores the header, unless the address has a query. + private static func uncachedURL(_ url: URL) -> URL { + guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return url } - let windowScene = coordinator.presenter?.view.window?.windowScene + components.queryItems = (components.queryItems ?? []) + [URLQueryItem(name: "ocsapi", value: "1")] - if let error { - if (error as? ASWebAuthenticationSessionError)?.code != .canceledLogin { - await showErrorBanner(windowScene: windowScene, error: NKError(error: error)) - } + return components.url ?? url + } + private static func apiRequest(for url: URL) -> URLRequest { + var request = URLRequest(url: url) + request.setValue("true", forHTTPHeaderField: apiHeader) + + return request + } + + // MARK: - WKNavigationDelegate + + func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { + let request = navigationAction.request + + guard let url = request.url else { + decisionHandler(.cancel) return } - guard let callbackURL else { return } - - do { - let credentials = try LoginCallbackParser.parse(callbackURL, scheme: scheme) + if url.scheme?.lowercased() == scheme { + decisionHandler(.cancel) + finish(callbackURL: url) + return + } - try await coordinator.addAccount(host: credentials.host, user: credentials.user, password: credentials.password) - } catch let error as NKError { - await showErrorBanner(windowScene: windowScene, error: error) - } catch { - await showErrorBanner(windowScene: windowScene, text: error.localizedDescription) + // Redirects and links lose the header, so such page loads are started again with it, once. + if navigationAction.targetFrame?.isMainFrame == true, request.httpMethod == "GET" { + if request.value(forHTTPHeaderField: Self.apiHeader) != nil { + reissuedURL = nil + } else if url != reissuedURL { + reissuedURL = url + decisionHandler(.cancel) + webView.load(Self.apiRequest(for: url)) + return + } } + + decisionHandler(.allow) + } + + func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) { + guard let url = webView.url, url.scheme?.lowercased() == scheme else { return } + + finish(callbackURL: url) + } + + func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { + NCActivityIndicator.shared.startActivity(backgroundView: view, style: .medium, blurEffect: false) + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + NCActivityIndicator.shared.stop() + } + + func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { + NCActivityIndicator.shared.stop() } - nonisolated func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { - MainActor.assumeIsolated { - coordinator.presenter?.view.window ?? UIApplication.shared.mainAppWindow ?? ASPresentationAnchor() + // MARK: - Account + + private func finish(callbackURL: URL) { + guard !isFinished else { return } + + isFinished = true + NCActivityIndicator.shared.stop() + + Task { + let windowScene = coordinator.presenter?.view.window?.windowScene + + await withCheckedContinuation { continuation in + dismiss(animated: true) { + continuation.resume() + } + } + + do { + let credentials = try LoginCallbackParser.parse(callbackURL, scheme: scheme) + + try await coordinator.addAccount(host: credentials.host, user: credentials.user, password: credentials.password) + } catch let error as NKError { + await showErrorBanner(windowScene: windowScene, error: error) + } catch { + await showErrorBanner(windowScene: windowScene, text: error.localizedDescription) + } } } } From 5b52022df6e6488a07c421e1c637a9931fe50141 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Mon, 23 Nov 2026 17:51:45 +0100 Subject: [PATCH 09/30] fix: show an error when the provider sign-up page does not load 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 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCProviderSignUp.swift | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/iOSClient/Login/NCProviderSignUp.swift b/iOSClient/Login/NCProviderSignUp.swift index 8b4c09d380..f1b1336dda 100644 --- a/iOSClient/Login/NCProviderSignUp.swift +++ b/iOSClient/Login/NCProviderSignUp.swift @@ -114,7 +114,42 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { } func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { + showLoadError(error, in: webView) + } + + func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { + showLoadError(error, in: webView) + } + + // MARK: - Errors + + private func showLoadError(_ error: Error, in webView: WKWebView) { NCActivityIndicator.shared.stop() + + // Page loads this class replaces end as interrupted or cancelled. + let nsError = error as NSError + let isInterrupted = nsError.domain == "WebKitErrorDomain" && nsError.code == 102 + + guard !isFinished, !isInterrupted, presentedViewController == nil, + let message = NKError(error: error).userFriendlyMessage() else { return } + + let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: message, preferredStyle: .alert) + + alert.addAction(UIAlertAction(title: NSLocalizedString("_close_", comment: ""), style: .cancel) { [weak self] _ in + self?.dismiss(animated: true) + }) + + alert.addAction(UIAlertAction(title: NSLocalizedString("_retry_", comment: ""), style: .default) { [weak self, weak webView] _ in + guard let self, let webView else { return } + + if webView.backForwardList.currentItem == nil { + webView.load(Self.apiRequest(for: Self.uncachedURL(url))) + } else { + webView.reload() + } + }) + + present(alert, animated: true) } // MARK: - Account From a064384988626d8e212344b923ec1e317cb1eb55 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Mon, 23 Nov 2026 18:19:06 +0100 Subject: [PATCH 10/30] fix: close the QR code scanner together with the login 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 Signed-off-by: Milen Pivchev --- iOSClient/Account/NCAccount.swift | 5 ++++- iOSClient/Login/NCLoginCoordinator.swift | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/iOSClient/Account/NCAccount.swift b/iOSClient/Account/NCAccount.swift index 9e6eac7319..bce110f94e 100644 --- a/iOSClient/Account/NCAccount.swift +++ b/iOSClient/Account/NCAccount.swift @@ -64,13 +64,16 @@ class NCAccount: NSObject { if let controller { controller.account = account nkLog(debug: "Dismissing login provider view controller...") - viewController.dismiss(animated: true) + // From its presenter, so a sheet the login still shows, such as the QR code scanner, closes too. + (viewController.presentingViewController ?? viewController).dismiss(animated: true) } else if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? NCMainTabBarController { nkLog(debug: "Presenting initial view controller from main storyboard...") controller.account = account controller.modalPresentationStyle = .fullScreen controller.view.alpha = 0 + // A sheet the replaced login still shows, such as the QR code scanner, would stay on screen. + UIApplication.shared.mainAppWindow?.rootViewController?.dismiss(animated: false) UIApplication.shared.mainAppWindow?.rootViewController = controller UIApplication.shared.mainAppWindow?.makeKeyAndVisible() diff --git a/iOSClient/Login/NCLoginCoordinator.swift b/iOSClient/Login/NCLoginCoordinator.swift index 895cc35e88..5e8e92b7f2 100644 --- a/iOSClient/Login/NCLoginCoordinator.swift +++ b/iOSClient/Login/NCLoginCoordinator.swift @@ -99,8 +99,8 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { func addAccount(host: URL, user: String, password: String) async throws { guard let presenter else { return } - // A closing QR scanner or shared accounts sheet would otherwise receive the dismissal below. - await waitForPresentedViewControllerDismissal() + // The shared accounts sheet may still be closing, while the QR code scanner stays open and closes with the login. + await waitForClosingSheet() let controller = self.controller ?? SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) @@ -225,7 +225,7 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { /// - Returns: The index of the chosen action, or `nil` when nothing could present the alert. private func presentChoice(title: String, message: String, actions: [(title: String, style: UIAlertAction.Style)]) async -> Int? { - await waitForPresentedViewControllerDismissal() + await waitForClosingSheet() guard let topViewController else { return nil } @@ -265,10 +265,11 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { } } - private func waitForPresentedViewControllerDismissal() async { + /// A sheet that is still closing would otherwise receive what is presented or dismissed next. + private func waitForClosingSheet() async { let deadline = ContinuousClock.now + .seconds(2) - while presenter?.presentedViewController != nil, ContinuousClock.now < deadline { + while presenter?.presentedViewController?.isBeingDismissed == true, ContinuousClock.now < deadline { try? await Task.sleep(for: .milliseconds(50)) } } From 8a63d3b9da626ccf82cf8d149d490d0c87c4cfb4 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 00:23:34 +0100 Subject: [PATCH 11/30] fix: always show why the provider sign-up page does not load 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 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCProviderSignUp.swift | 136 +++++++++++++++++++------ 1 file changed, 106 insertions(+), 30 deletions(-) diff --git a/iOSClient/Login/NCProviderSignUp.swift b/iOSClient/Login/NCProviderSignUp.swift index f1b1336dda..6c3495a68e 100644 --- a/iOSClient/Login/NCProviderSignUp.swift +++ b/iOSClient/Login/NCProviderSignUp.swift @@ -16,13 +16,23 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { private let url: URL private let coordinator: NCLoginCoordinator private let scheme = NCBrandOptions.shared.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "").lowercased() - private var reissuedURL: URL? + private let webView: WKWebView + private let activityIndicator = UIActivityIndicatorView(style: .medium) + private var loadingObservation: NSKeyValueObservation? + private var reissuedURLs: Set = [] + private var requestedURL: URL? + private var hasAppeared = false + private var hasReloadedAfterTermination = false private var isFinished = false init(url: URL, coordinator: NCLoginCoordinator) { self.url = url self.coordinator = coordinator + let configuration = WKWebViewConfiguration() + configuration.websiteDataStore = .nonPersistent() + webView = WKWebView(frame: .zero, configuration: configuration) + super.init(nibName: nil, bundle: nil) } @@ -40,15 +50,32 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { self?.dismiss(animated: true) }) - let configuration = WKWebViewConfiguration() - configuration.websiteDataStore = .nonPersistent() - - let webView = WKWebView(frame: view.bounds, configuration: configuration) + webView.frame = view.bounds webView.autoresizingMask = [.flexibleWidth, .flexibleHeight] webView.customUserAgent = userAgent webView.navigationDelegate = self view.addSubview(webView) + activityIndicator.center = CGPoint(x: view.bounds.midX, y: view.bounds.midY) + activityIndicator.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin, .flexibleBottomMargin] + view.addSubview(activityIndicator) + + loadingObservation = webView.observe(\.isLoading) { [weak self] webView, _ in + if webView.isLoading { + self?.activityIndicator.startAnimating() + } else { + self?.activityIndicator.stopAnimating() + } + } + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + // Not while the screen slides in, which would drop the alert of a load that fails right away. + guard !hasAppeared else { return } + + hasAppeared = true webView.load(Self.apiRequest(for: Self.uncachedURL(url))) } @@ -61,13 +88,20 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { return components.url ?? url } + /// Fails after 20 seconds without data instead of a minute, so an unreachable server is reported soon. private static func apiRequest(for url: URL) -> URLRequest { - var request = URLRequest(url: url) + var request = URLRequest(url: url, timeoutInterval: 20) request.setValue("true", forHTTPHeaderField: apiHeader) return request } + /// The page that failed, or the sign-up page when none has been requested yet. + private func reload() { + reissuedURLs.removeAll() + webView.load(Self.apiRequest(for: requestedURL ?? Self.uncachedURL(url))) + } + // MARK: - WKNavigationDelegate func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { @@ -84,16 +118,37 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { return } - // Redirects and links lose the header, so such page loads are started again with it, once. if navigationAction.targetFrame?.isMainFrame == true, request.httpMethod == "GET" { - if request.value(forHTTPHeaderField: Self.apiHeader) != nil { - reissuedURL = nil - } else if url != reissuedURL { - reissuedURL = url + // Redirects and links lose the header, so such page loads are started again with it, once per page. + if request.value(forHTTPHeaderField: Self.apiHeader) == nil, reissuedURLs.insert(url).inserted { decisionHandler(.cancel) webView.load(Self.apiRequest(for: url)) return } + + requestedURL = url + } + + decisionHandler(.allow) + } + + func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { + guard navigationResponse.isForMainFrame else { + decisionHandler(.allow) + return + } + + // Error pages and empty responses would otherwise load as if nothing went wrong. + if let response = navigationResponse.response as? HTTPURLResponse, response.statusCode >= 400 { + decisionHandler(.cancel) + showLoadError(Self.error(forStatusCode: response.statusCode), in: webView) + return + } + + if !navigationResponse.canShowMIMEType || navigationResponse.response.expectedContentLength == 0 { + decisionHandler(.cancel) + showLoadError(NKError.invalidResponseError, in: webView) + return } decisionHandler(.allow) @@ -105,12 +160,9 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { finish(callbackURL: url) } - func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { - NCActivityIndicator.shared.startActivity(backgroundView: view, style: .medium, blurEffect: false) - } - func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { - NCActivityIndicator.shared.stop() + reissuedURLs.removeAll() + hasReloadedAfterTermination = false } func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { @@ -121,17 +173,47 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { showLoadError(error, in: webView) } + func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { + // WebKit stops reloading by itself once this is implemented, so reload once and report a repeat. + guard hasReloadedAfterTermination else { + hasReloadedAfterTermination = true + reload() + return + } + + showLoadError(NKError(errorCode: WKError.Code.webContentProcessTerminated.rawValue, errorDescription: "Web content process terminated", kind: .unknown), in: webView) + } + // MARK: - Errors - private func showLoadError(_ error: Error, in webView: WKWebView) { - NCActivityIndicator.shared.stop() + /// Picks a kind whose NextcloudKit text fits a web page, unlike the file-related ones for 403 or 404. + private static func error(forStatusCode statusCode: Int) -> NKError { + let kind: NKError.Kind + + switch statusCode { + case 408, 504: + kind = .timeout + case 429: + kind = .rateLimited + case 503: + kind = .unavailable + case 500, 501, 505...599: + kind = .serverError + default: + kind = .serverUnreachable + } + + return NKError(errorCode: statusCode, errorDescription: HTTPURLResponse.localizedString(forStatusCode: statusCode), kind: kind) + } + private func showLoadError(_ error: Error, in webView: WKWebView) { // Page loads this class replaces end as interrupted or cancelled. let nsError = error as NSError let isInterrupted = nsError.domain == "WebKitErrorDomain" && nsError.code == 102 + let nkError = error as? NKError ?? NKError(error: error) guard !isFinished, !isInterrupted, presentedViewController == nil, - let message = NKError(error: error).userFriendlyMessage() else { return } + let message = nkError.userFriendlyMessage() else { return } let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: message, preferredStyle: .alert) @@ -139,14 +221,8 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { self?.dismiss(animated: true) }) - alert.addAction(UIAlertAction(title: NSLocalizedString("_retry_", comment: ""), style: .default) { [weak self, weak webView] _ in - guard let self, let webView else { return } - - if webView.backForwardList.currentItem == nil { - webView.load(Self.apiRequest(for: Self.uncachedURL(url))) - } else { - webView.reload() - } + alert.addAction(UIAlertAction(title: NSLocalizedString("_retry_", comment: ""), style: .default) { [weak self] _ in + self?.reload() }) present(alert, animated: true) @@ -158,11 +234,11 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { guard !isFinished else { return } isFinished = true - NCActivityIndicator.shared.stop() - Task { - let windowScene = coordinator.presenter?.view.window?.windowScene + // The presenter is off screen behind this full screen page, so its scene would be nil. + let windowScene = view.window?.windowScene + Task { await withCheckedContinuation { continuation in dismiss(animated: true) { continuation.resume() From 39f00a7bccb2553e00f4932f1383bd41ec827e97 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 00:23:39 +0100 Subject: [PATCH 12/30] fix: show an error when the server answers the profile request with another 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 Signed-off-by: Milen Pivchev --- iOSClient/Account/NCAccount.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iOSClient/Account/NCAccount.swift b/iOSClient/Account/NCAccount.swift index bce110f94e..00966845ce 100644 --- a/iOSClient/Account/NCAccount.swift +++ b/iOSClient/Account/NCAccount.swift @@ -39,9 +39,11 @@ class NCAccount: NSObject { guard resultsGetUserProfile.error == .success, let userProfile = resultsGetUserProfile.userProfile else { NextcloudKit.shared.nkCommonInstance.nksessions.remove(account: account) - let error = resultsGetUserProfile.error == .success ? NKError.invalidData : resultsGetUserProfile.error + nkLog(error: "Getting the user profile failed: \(resultsGetUserProfile.error.logDescription)") - nkLog(error: "Getting the user profile failed: \(error.logDescription)") + // A reply that is no profile, such as the login page of a proxy, has no kind and so no message to show. + let isUnclassified = resultsGetUserProfile.error == .success || resultsGetUserProfile.error.kind == nil + let error = isUnclassified ? NKError.invalidData : resultsGetUserProfile.error throw error } From 1a33d6acc4fd3bb57da631c435a624d51c649665 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 10:21:34 +0100 Subject: [PATCH 13/30] fix: show the readable error instead of the http prompt when offline 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 Signed-off-by: Milen Pivchev --- .../NCLoginServerErrorClassifierTests.swift | 5 +++++ iOSClient/Login/NCLoginServerErrorClassifier.swift | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift b/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift index a8d85f578e..bba9adb754 100644 --- a/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift +++ b/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift @@ -30,6 +30,11 @@ struct NCLoginServerErrorClassifierTests { #expect(resolution == .insecureFallback(URL(string: "http://cloud.example.com:8443/nextcloud/")!)) } + @Test("No network or an unknown host is shown, as http can't help", arguments: [NSURLErrorNotConnectedToInternet, NSURLErrorCannotFindHost, NSURLErrorDNSLookupFailed]) + func unreachable(errorCode: Int) { + #expect(NCLoginServerErrorClassifier.classify(NKError(errorCode: errorCode), serverURL: httpsURL) == .generic) + } + @Test("Failures over http are shown") func httpFailure() { let httpURL = URL(string: "http://cloud.example.com/")! diff --git a/iOSClient/Login/NCLoginServerErrorClassifier.swift b/iOSClient/Login/NCLoginServerErrorClassifier.swift index ca90372602..c3006b6c20 100644 --- a/iOSClient/Login/NCLoginServerErrorClassifier.swift +++ b/iOSClient/Login/NCLoginServerErrorClassifier.swift @@ -20,13 +20,21 @@ enum NCLoginServerErrorClassifier { NSURLErrorServerCertificateNotYetValid ] + /// The host name does not exist, which plain http can't change. + private static let unknownHostErrorCodes = [ + NSURLErrorCannotFindHost, + NSURLErrorDNSLookupFailed + ] + static func classify(_ error: NKError, serverURL: URL) -> Resolution { if certificateErrorCodes.contains(error.errorCode), let host = serverURL.host { return .untrustedCertificate(host: host) } - // Any other failed https attempt may fall back to plain http. + // Other failed https attempts may fall back to plain http, unless there is no network or no such host. guard error.kind != .cancelled, + error.kind != .offline, + !unknownHostErrorCodes.contains(error.errorCode), serverURL.scheme?.lowercased() == "https", var components = URLComponents(url: serverURL, resolvingAgainstBaseURL: false) else { return .generic From fe988f062e789ee36df6e54cb621ed97652dba5b Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 10:21:34 +0100 Subject: [PATCH 14/30] fix: say no server was found when adding an account gets a 404 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 Signed-off-by: Milen Pivchev --- .../NKErrorUserFriendlyMessageTests.swift | 12 +++++++++++- iOSClient/Login/NCLoginCoordinator.swift | 8 +++++--- iOSClient/Login/NCProviderSignUp.swift | 4 ++-- iOSClient/Networking/NCErrorContext.swift | 4 ++++ .../Networking/NKError+UserFriendlyMessage.swift | 4 ++++ .../Supporting Files/en.lproj/Localizable.strings | 2 ++ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Tests/NextcloudUnitTests/NKErrorUserFriendlyMessageTests.swift b/Tests/NextcloudUnitTests/NKErrorUserFriendlyMessageTests.swift index 3d28a56922..589f12707d 100644 --- a/Tests/NextcloudUnitTests/NKErrorUserFriendlyMessageTests.swift +++ b/Tests/NextcloudUnitTests/NKErrorUserFriendlyMessageTests.swift @@ -60,6 +60,16 @@ struct NKErrorUserFriendlyMessageTests { #expect(NKError(error: CancellationError()).userFriendlyMessage() == nil) } + @Test("Says no server was found when a login gets a 404") + func loginMessages() { + let notFound = NKError(errorCode: 404, errorDescription: "404: Not found") + let timeout = NKError(errorCode: NSURLErrorTimedOut, errorDescription: "The request timed out.") + + #expect(notFound.userFriendlyMessage(for: .login) == localized("_error_login_server_not_found_")) + #expect(NKError.invalidData.userFriendlyMessage(for: .login) == NKError.invalidData.userFriendlyMessage()) + #expect(timeout.userFriendlyMessage(for: .login) == timeout.userFriendlyMessage()) + } + @Test("Words different kinds of failure differently") func kindMessages() { let timeout = NKError(errorCode: NSURLErrorTimedOut, errorDescription: "The request timed out.").userFriendlyMessage() @@ -91,7 +101,7 @@ struct NKErrorUserFriendlyMessageTests { @Test("Titles say what failed") func failureTitles() throws { - let contexts: [NCErrorContext] = [.upload(fileName: "f"), .download(fileName: "f"), .delete(fileName: "f"), .rename, .moveOrCopy(fileName: "f"), .createFolder(folderName: "f"), .favorite(fileName: "f"), .createDocument(fileName: "f"), .openDocument(fileName: "f")] + let contexts: [NCErrorContext] = [.upload(fileName: "f"), .download(fileName: "f"), .delete(fileName: "f"), .rename, .moveOrCopy(fileName: "f"), .createFolder(folderName: "f"), .favorite(fileName: "f"), .createDocument(fileName: "f"), .openDocument(fileName: "f"), .login] #expect(NCErrorContext.generic.failureTitle == nil) #expect(NCErrorContext.upload(fileName: "IMG_0042.jpg").failureTitle?.contains("IMG_0042.jpg") == true) diff --git a/iOSClient/Login/NCLoginCoordinator.swift b/iOSClient/Login/NCLoginCoordinator.swift index 5e8e92b7f2..ab50a96f48 100644 --- a/iOSClient/Login/NCLoginCoordinator.swift +++ b/iOSClient/Login/NCLoginCoordinator.swift @@ -146,7 +146,9 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { let results = await NextcloudKit.shared.getAppPasswordAsync(url: url, user: name, password: userPassword) guard results.error == .success, let token = results.token else { - await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: results.error == .success ? .invalidData : results.error) + let isUnclassified = results.error == .success || results.error.kind == nil + + await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: isUnclassified ? .invalidData : results.error, context: .login) return } @@ -158,14 +160,14 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { } guard let host = URL(string: serverURL) else { - await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: .urlError) + await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: .urlError, context: .login) return } do { try await addAccount(host: host, user: user, password: password) } catch { - await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: error as? NKError ?? NKError(error: error)) + await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: error as? NKError ?? NKError(error: error), context: .login) } } diff --git a/iOSClient/Login/NCProviderSignUp.swift b/iOSClient/Login/NCProviderSignUp.swift index 6c3495a68e..959bb76f69 100644 --- a/iOSClient/Login/NCProviderSignUp.swift +++ b/iOSClient/Login/NCProviderSignUp.swift @@ -250,9 +250,9 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { try await coordinator.addAccount(host: credentials.host, user: credentials.user, password: credentials.password) } catch let error as NKError { - await showErrorBanner(windowScene: windowScene, error: error) + await showErrorBanner(windowScene: windowScene, error: error, context: .login) } catch { - await showErrorBanner(windowScene: windowScene, text: error.localizedDescription) + await showErrorBanner(windowScene: windowScene, title: NCErrorContext.login.failureTitle ?? "_error_", text: error.localizedDescription) } } } diff --git a/iOSClient/Networking/NCErrorContext.swift b/iOSClient/Networking/NCErrorContext.swift index ffcd89d8f7..e6d23d9a30 100644 --- a/iOSClient/Networking/NCErrorContext.swift +++ b/iOSClient/Networking/NCErrorContext.swift @@ -16,6 +16,7 @@ enum NCErrorContext: Equatable { case favorite(fileName: String) case createDocument(fileName: String) case openDocument(fileName: String) + case login /// The context of a transfer event, from its `networkingStatus`. init(networkingStatus: String, fileName: String) { @@ -111,6 +112,9 @@ enum NCErrorContext: Equatable { case .openDocument(let fileName): return String(format: NSLocalizedString("_error_title_open_document_", comment: ""), fileName) + + case .login: + return NSLocalizedString("_error_title_login_", comment: "") } } } diff --git a/iOSClient/Networking/NKError+UserFriendlyMessage.swift b/iOSClient/Networking/NKError+UserFriendlyMessage.swift index 45b4b4815c..cfcc4ac67f 100644 --- a/iOSClient/Networking/NKError+UserFriendlyMessage.swift +++ b/iOSClient/Networking/NKError+UserFriendlyMessage.swift @@ -45,6 +45,10 @@ extension NKError { case (.createDocument, .forbidden), (.openDocument, .forbidden): return NSLocalizedString("_error_occurred_", comment: "") + // While logging in, a 404 means the address has no Nextcloud server, not a missing file. + case (.login, .notFound): + return NSLocalizedString("_error_login_server_not_found_", comment: "") + default: return nil } diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings index c2337b4b74..9dcf130ce9 100644 --- a/iOSClient/Supporting Files/en.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings @@ -870,5 +870,7 @@ "_error_title_favorite_" = "Couldn't update the favorite for “%@”"; "_error_title_create_document_" = "Couldn't create “%@”"; "_error_title_open_document_" = "Couldn't open “%@”"; +"_error_title_login_" = "Couldn't log in"; "_error_password_incorrect_" = "The password is incorrect."; "_error_file_busy_" = "The file is still being transferred. Try again later."; +"_error_login_server_not_found_" = "No server was found at this address."; From 0bd6e7785cf3457cfedeb1ffcace9caed2326f60 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 11:28:24 +0100 Subject: [PATCH 15/30] fix: log in to the new account when the server refuses the sign-up credentials 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 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCLoginCoordinator.swift | 24 +++++++++++++++++-- .../Login/NCLoginHostingController.swift | 5 ++-- iOSClient/Login/NCProviderSignUp.swift | 9 ++++++- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/iOSClient/Login/NCLoginCoordinator.swift b/iOSClient/Login/NCLoginCoordinator.swift index ab50a96f48..5a3609a7b6 100644 --- a/iOSClient/Login/NCLoginCoordinator.swift +++ b/iOSClient/Login/NCLoginCoordinator.swift @@ -20,11 +20,14 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { private let presentation: Presentation private let controller: NCMainTabBarController? + /// A server to log in to right away, such as one the user just signed up on. + private let loginServerURL: URL? private var certificateDetailsContinuation: CheckedContinuation? - init(controller: NCMainTabBarController?, presentation: Presentation) { + init(controller: NCMainTabBarController?, presentation: Presentation, loginServerURL: URL? = nil) { self.controller = controller self.presentation = presentation + self.loginServerURL = loginServerURL } // MARK: - Configuration @@ -38,7 +41,10 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { configuration.serverAddressDescription = String.localizedStringWithFormat(NSLocalizedString("_login_address_detail_", comment: ""), brandOptions.brand) configuration.enforcedServersPrompt = NSLocalizedString("_select_server_", comment: "") - if case .prefill(let serverURL) = appConfigAction { + if let loginServerURL { + configuration.initialServerAddress = loginServerURL.absoluteString + configuration.startsLoginOnAppear = true + } else if case .prefill(let serverURL) = appConfigAction { configuration.initialServerAddress = serverURL } else if !brandOptions.loginBaseUrl.isEmpty { configuration.initialServerAddress = brandOptions.loginBaseUrl @@ -111,6 +117,17 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { try await NCAccount().createAccount(viewController: presenter, urlBase: host.absoluteString, user: user, password: password, controller: controller) } + /// Pushes the login for a server, which starts right away. + /// - Returns: Whether the presenter has a navigation stack to show it on. + func showLogin(serverURL: URL) -> Bool { + guard let navigationController = presenter?.navigationController else { return false } + + let viewController = NCLoginHostingController(controller: controller, presentation: .pushed, loginServerURL: serverURL) + navigationController.pushViewController(viewController, animated: true) + + return true + } + // MARK: - Managed configuration private var appConfigAction: NCLoginAppConfig.Action? { @@ -133,6 +150,9 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { } func runAppConfigAutoLoginIfNeeded() async { + // It would race the login that starts by itself for this server. + guard loginServerURL == nil else { return } + let serverURL: String let user: String let password: String diff --git a/iOSClient/Login/NCLoginHostingController.swift b/iOSClient/Login/NCLoginHostingController.swift index c326c68991..086a8bf601 100644 --- a/iOSClient/Login/NCLoginHostingController.swift +++ b/iOSClient/Login/NCLoginHostingController.swift @@ -11,8 +11,9 @@ final class NCLoginHostingController: UIHostingController { private let coordinator: NCLoginCoordinator private var hasAppeared = false - init(controller: NCMainTabBarController?, presentation: NCLoginCoordinator.Presentation) { - let coordinator = NCLoginCoordinator(controller: controller, presentation: presentation) + /// - Parameter loginServerURL: A server to log in to right away, such as one the user just signed up on. + init(controller: NCMainTabBarController?, presentation: NCLoginCoordinator.Presentation, loginServerURL: URL? = nil) { + let coordinator = NCLoginCoordinator(controller: controller, presentation: presentation, loginServerURL: loginServerURL) let rootView = ServerAddressView(backgroundColor: .constant(Color(uiColor: NCBrandColor.shared.customer)), brandImage: Image("logo"), diff --git a/iOSClient/Login/NCProviderSignUp.swift b/iOSClient/Login/NCProviderSignUp.swift index 959bb76f69..9c8c4e0dc8 100644 --- a/iOSClient/Login/NCProviderSignUp.swift +++ b/iOSClient/Login/NCProviderSignUp.swift @@ -248,7 +248,14 @@ final class NCProviderSignUp: UIViewController, WKNavigationDelegate { do { let credentials = try LoginCallbackParser.parse(callbackURL, scheme: scheme) - try await coordinator.addAccount(host: credentials.host, user: credentials.user, password: credentials.password) + do { + try await coordinator.addAccount(host: credentials.host, user: credentials.user, password: credentials.password) + } catch let error as NKError where error.kind == .unauthorized { + // Providers may hand over a session token, which servers refuse, so the user logs in to the new account instead. + nkLog(error: "The new account refused its sign-up credentials, starting the login: \(error.logDescription)") + + guard coordinator.showLogin(serverURL: credentials.host) else { throw error } + } } catch let error as NKError { await showErrorBanner(windowScene: windowScene, error: error, context: .login) } catch { From 281f4e947b0f1e82fac86f68fcbf0f033dfbba8e Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 15:58:28 +0100 Subject: [PATCH 16/30] refactor: move the navigation controller status bar override out of the 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 Signed-off-by: Milen Pivchev --- Brand/Intro/NCIntroViewController.swift | 6 ------ iOSClient/Extensions/UINavigationController+Extension.swift | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Brand/Intro/NCIntroViewController.swift b/Brand/Intro/NCIntroViewController.swift index b29d29845c..0d16d4198f 100644 --- a/Brand/Intro/NCIntroViewController.swift +++ b/Brand/Intro/NCIntroViewController.swift @@ -175,9 +175,3 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol UIApplication.shared.open(url) } } - -extension UINavigationController { - open override var childForStatusBarStyle: UIViewController? { - return topViewController?.childForStatusBarStyle ?? topViewController - } -} diff --git a/iOSClient/Extensions/UINavigationController+Extension.swift b/iOSClient/Extensions/UINavigationController+Extension.swift index 46b9a063fb..734a7edf3b 100644 --- a/iOSClient/Extensions/UINavigationController+Extension.swift +++ b/iOSClient/Extensions/UINavigationController+Extension.swift @@ -6,6 +6,9 @@ import Foundation import UIKit extension UINavigationController { + open override var childForStatusBarStyle: UIViewController? { + return topViewController?.childForStatusBarStyle ?? topViewController + } // https://stackoverflow.com/questions/6131205/how-to-find-topmost-view-controller-on-ios override func topMostViewController() -> UIViewController { From 1908becb30990a08924bf475b6206acb214d657c Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 15:58:40 +0100 Subject: [PATCH 17/30] feat: account setup in SwiftUI with the shared onboarding and login 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 Signed-off-by: Milen Pivchev --- AGENTS.md | 2 +- Brand/Intro/NCIntro.storyboard | 137 --------- Brand/Intro/NCIntroCollectionViewCell.swift | 14 - Brand/Intro/NCIntroCollectionViewCell.xib | 56 ---- Brand/Intro/NCIntroViewController.swift | 177 ------------ Nextcloud.xcodeproj/project.pbxproj | 48 +--- Tests/NextcloudUITests/BaseUIXCTestCase.swift | 10 +- Tests/NextcloudUITests/PasscodeUITests.swift | 2 +- .../NCAccountSetupModelTests.swift | 84 ++++++ iOSClient/Account/NCAccount.swift | 16 +- iOSClient/Files/NCFiles.swift | 10 +- .../Files/NCFilesNavigationController.swift | 14 +- ...inator.swift => NCAccountSetupModel.swift} | 207 +++++++------- iOSClient/Login/NCAccountSetupView.swift | 97 +++++++ .../Login/NCLoginHostingController.swift | 59 ---- iOSClient/Login/NCProviderSignUp.swift | 266 ------------------ .../Login/NCViewCertificateDetails.swift | 19 ++ iOSClient/SceneDelegate.swift | 11 +- .../en.lproj/Localizable.strings | 1 + 19 files changed, 323 insertions(+), 907 deletions(-) delete mode 100644 Brand/Intro/NCIntro.storyboard delete mode 100644 Brand/Intro/NCIntroCollectionViewCell.swift delete mode 100644 Brand/Intro/NCIntroCollectionViewCell.xib delete mode 100644 Brand/Intro/NCIntroViewController.swift create mode 100644 Tests/NextcloudUnitTests/NCAccountSetupModelTests.swift rename iOSClient/Login/{NCLoginCoordinator.swift => NCAccountSetupModel.swift} (53%) create mode 100644 iOSClient/Login/NCAccountSetupView.swift delete mode 100644 iOSClient/Login/NCLoginHostingController.swift delete mode 100644 iOSClient/Login/NCProviderSignUp.swift diff --git a/AGENTS.md b/AGENTS.md index 7fe8ec2350..31cf9e8f4c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,7 +28,7 @@ Other platforms like Android are irrelevant for this project. | `iOSClient` | Main iOS client source code. | — | | `iOSClient/Utility/Passcode` | Shared SwiftUI passcode UI and authentication model for the app and Share Extension; the mandatory app lock uses a dedicated window per scene. | Preserve existing credentials, lockout rules and app/extension reset behavior. | | `iOSClient/Supporting Files` | Translation files synced with Transifex (see `iOSClient/.tx/config`). | Only add new strings to `en.lproj` (`Localizable.strings`, plurals in `Localizable.stringsdict`); never edit the other `*.lproj` dirs — Transifex overwrites them. | -| `Brand` | Branding layer: `NCBrand.swift` (app constants, colors), `Database.swift` (Realm database name and schema version), Info.plists and entitlements for all targets, launch screen and intro screens. | Bump `databaseSchemaVersion` in `Brand/Database.swift` when changing Realm models. | +| `Brand` | Branding layer: `NCBrand.swift` (app constants, colors), `Database.swift` (Realm database name and schema version), Info.plists and entitlements for all targets, and the launch screen. | Bump `databaseSchemaVersion` in `Brand/Database.swift` when changing Realm models. | | `File Provider Extension` | Contains business logic for the iOS File Provider extension. | — | | `File Provider Extension UI` | Contains UI logic for the iOS File Provider extension. | — | | `Share` | Contains the active Share extension entry point, launched through `NSExtensionPrincipalClass`, plus input preparation, session storage and recent upload destinations. | — | diff --git a/Brand/Intro/NCIntro.storyboard b/Brand/Intro/NCIntro.storyboard deleted file mode 100644 index 8fbfcb94de..0000000000 --- a/Brand/Intro/NCIntro.storyboard +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Brand/Intro/NCIntroCollectionViewCell.swift b/Brand/Intro/NCIntroCollectionViewCell.swift deleted file mode 100644 index 600d6029aa..0000000000 --- a/Brand/Intro/NCIntroCollectionViewCell.swift +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2019 Marino Faggiana -// SPDX-FileCopyrightText: 2019 Philippe Weidmann -// SPDX-License-Identifier: GPL-3.0-or-later - -import UIKit - -class NCIntroCollectionViewCell: UICollectionViewCell { - - @IBOutlet weak var titleLabel: UILabel! - @IBOutlet weak var imageView: UIImageView! - - var indexPath = IndexPath() -} diff --git a/Brand/Intro/NCIntroCollectionViewCell.xib b/Brand/Intro/NCIntroCollectionViewCell.xib deleted file mode 100644 index 7eed66d3ba..0000000000 --- a/Brand/Intro/NCIntroCollectionViewCell.xib +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Brand/Intro/NCIntroViewController.swift b/Brand/Intro/NCIntroViewController.swift deleted file mode 100644 index 0d16d4198f..0000000000 --- a/Brand/Intro/NCIntroViewController.swift +++ /dev/null @@ -1,177 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2019 Marino Faggiana -// SPDX-FileCopyrightText: 2019 Philippe Weidmann -// SPDX-License-Identifier: GPL-3.0-or-later - -import UIKit - -class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { - @IBOutlet weak var buttonLogin: UIButton! - @IBOutlet weak var buttonSignUp: UIButton! - @IBOutlet weak var buttonHost: UIButton! - @IBOutlet weak var introCollectionView: UICollectionView! - @IBOutlet weak var pageControl: UIPageControl! - - // Controller - var controller: NCMainTabBarController? - - private let titles = [NSLocalizedString("_intro_1_title_", comment: ""), NSLocalizedString("_intro_2_title_", comment: ""), NSLocalizedString("_intro_3_title_", comment: ""), NSLocalizedString("_intro_4_title_", comment: "")] - private let images = [UIImage(named: "intro1"), UIImage(named: "intro2"), UIImage(named: "intro3"), UIImage(named: "intro4")] - private var timer: Timer? - private var textColor: UIColor = .white - private var textColorOpponent: UIColor = .black - - // MARK: - View Life Cycle - - override func viewDidLoad() { - super.viewDidLoad() - - let isTooLight = NCBrandColor.shared.customer.isTooLight() - let isTooDark = NCBrandColor.shared.customer.isTooDark() - - if isTooLight { - textColor = .black - textColorOpponent = .white - } else if isTooDark { - textColor = .white - textColorOpponent = .black - } else { - textColor = .white - textColorOpponent = .black - } - - let navBarAppearance = UINavigationBarAppearance() - navBarAppearance.configureWithTransparentBackground() - navBarAppearance.shadowColor = .clear - navBarAppearance.shadowImage = UIImage() - self.navigationController?.navigationBar.standardAppearance = navBarAppearance - self.navigationController?.view.backgroundColor = NCBrandColor.shared.customer - self.navigationController?.navigationBar.tintColor = textColor - - if !NCManageDatabase.shared.getAllTableAccount().isEmpty { - let navigationItemCancel = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .plain, target: self, action: #selector(actionCancel(_:))) - navigationItemCancel.tintColor = textColor - navigationItem.rightBarButtonItem = navigationItemCancel - } - - pageControl.currentPageIndicatorTintColor = textColor - pageControl.pageIndicatorTintColor = .lightGray - - buttonLogin.layer.cornerRadius = 8 - buttonLogin.setTitleColor(NCBrandColor.shared.customer, for: .normal) - buttonLogin.backgroundColor = textColor - buttonLogin.setTitle(NSLocalizedString("_log_in_", comment: ""), for: .normal) - - buttonSignUp.layer.cornerRadius = 8 - buttonSignUp.setTitleColor(textColor, for: .normal) - buttonSignUp.backgroundColor = textColor.withAlphaComponent(0.2) - buttonSignUp.titleLabel?.adjustsFontSizeToFitWidth = true - buttonSignUp.setTitle(NSLocalizedString("_sign_up_", comment: ""), for: .normal) - - buttonHost.layer.cornerRadius = 20 - buttonHost.setTitle(NSLocalizedString("_host_your_own_server_", comment: ""), for: .normal) - buttonHost.setTitleColor(textColor.withAlphaComponent(0.5), for: .normal) - - introCollectionView.register(UINib(nibName: "NCIntroCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "introCell") - introCollectionView.dataSource = self - introCollectionView.delegate = self - introCollectionView.backgroundColor = NCBrandColor.shared.customer - pageControl.numberOfPages = self.titles.count - - view.backgroundColor = NCBrandColor.shared.customer - - self.timer = Timer.scheduledTimer(timeInterval: 4, target: self, selector: (#selector(self.autoScroll(_:))), userInfo: nil, repeats: true) - } - - override var preferredStatusBarStyle: UIStatusBarStyle { - if traitCollection.userInterfaceStyle == .light { - return .lightContent - } else { - return .darkContent - } - } - - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - - timer?.invalidate() - timer = nil - } - - override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { - super.viewWillTransition(to: size, with: coordinator) - - coordinator.animate(alongsideTransition: nil) { _ in - self.pageControl?.currentPage = 0 - self.introCollectionView?.collectionViewLayout.invalidateLayout() - } - } - - @objc func autoScroll(_ sender: Any?) { - if pageControl.currentPage + 1 >= titles.count { - pageControl.currentPage = 0 - } else { - pageControl.currentPage += 1 - } - introCollectionView.scrollToItem(at: IndexPath(row: pageControl.currentPage, section: 0), at: .centeredHorizontally, animated: true) - } - - func collectionView(_ collectionView: UICollectionView, targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint { - return CGPoint.zero - } - - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return titles.count - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = (collectionView.dequeueReusableCell(withReuseIdentifier: "introCell", for: indexPath) as? NCIntroCollectionViewCell)! - cell.backgroundColor = NCBrandColor.shared.customer - cell.indexPath = indexPath - cell.titleLabel.textColor = textColor - cell.titleLabel.text = titles[indexPath.row] - cell.imageView.image = images[indexPath.row] - return cell - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return collectionView.bounds.size - } - - func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { - timer = Timer.scheduledTimer(timeInterval: 4, target: self, selector: (#selector(autoScroll(_:))), userInfo: nil, repeats: true) - pageControl.currentPage = Int(scrollView.contentOffset.x) / Int(scrollView.frame.width) - } - - func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { - timer?.invalidate() - timer = nil - } - - // MARK: - Action - - @objc func actionCancel(_ sender: Any?) { - dismiss(animated: true) { } - } - - @IBAction func login(_ sender: Any) { - let viewController = NCLoginHostingController(controller: controller, presentation: .pushed) - navigationController?.pushViewController(viewController, animated: true) - } - - @IBAction func signupWithProvider(_ sender: Any) { - guard let url = URL(string: NCBrandOptions.shared.linkloginPreferredProviders) else { return } - - let coordinator = NCLoginCoordinator(controller: controller, presentation: .pushed) - coordinator.presenter = self - - let navigationController = UINavigationController(rootViewController: NCProviderSignUp(url: url, coordinator: coordinator)) - navigationController.modalPresentationStyle = .fullScreen - present(navigationController, animated: true) - } - - @IBAction func host(_ sender: Any) { - guard let url = URL(string: NCBrandOptions.shared.linkLoginHost) else { return } - UIApplication.shared.open(url) - } -} diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index ab1df0e3ef..d5a865aa74 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -7,8 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 1FBDC9311538242613612B94 /* NCAccountSetupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B5E8728DE9ABBD5BDD3B447 /* NCAccountSetupModel.swift */; }; 22BA14432CF44BDBA2E6C291 /* NCDocumentEditorSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B74B947E07444CC9CFE0A6C /* NCDocumentEditorSupportTests.swift */; }; - 2A3D983FCEC820C453EDD1CC /* NCLoginHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */; }; 2C1D5D7623E2DE3300334ABB /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; }; 2C1D5D7923E2DE9100334ABB /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; }; 2C33C48223E2C475005F963B /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C33C48123E2C475005F963B /* NotificationService.swift */; }; @@ -77,7 +77,6 @@ AAFC0D062F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D032F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift */; }; AAFC0D092F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D082F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift */; }; AAFC0D0B2F9AA10000F0A001 /* NCAutoUploadCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D0A2F9AA10000F0A001 /* NCAutoUploadCounter.swift */; }; - AB0BFE5B60D759FFBDEE99FF /* NCLoginCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */; }; AB1028260000000000030000 /* NCShareEntryController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1028260000000000020000 /* NCShareEntryController.swift */; }; AB1028260000000000030002 /* NCShareViewModel+Accounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1028260000000000020002 /* NCShareViewModel+Accounts.swift */; }; AB1028260000000000030003 /* NCShareViewModel+Folders.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1028260000000000020003 /* NCShareViewModel+Folders.swift */; }; @@ -148,12 +147,13 @@ B5E6D3241C08B33DD08B09FE /* NCLoginAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */; }; B601AA012F10000100C0D3E5 /* NCLogFilesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B601AA002F10000100C0D3E5 /* NCLogFilesView.swift */; }; BAF64949B487A080A98F83F2 /* NKErrorUserFriendlyMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320C20803A58DAF7575440A8 /* NKErrorUserFriendlyMessageTests.swift */; }; + BB6422A1935553376638E7BF /* NCAccountSetupModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8E39D2FC977AA9ACE6A0F05 /* NCAccountSetupModelTests.swift */; }; C0DEA070306D000100000005 /* NCLocalDatabase+AutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEA070306D000100000004 /* NCLocalDatabase+AutoUpload.swift */; }; C0DEA070306D000100000006 /* NCLocalDatabase+AutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEA070306D000100000004 /* NCLocalDatabase+AutoUpload.swift */; }; C0DEA070306D000100000008 /* NCAutoUploadAssetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEA070306D000100000007 /* NCAutoUploadAssetTests.swift */; }; C0DECA022F65000100C0D001 /* NCCameraRollTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DECA012F65000100C0D001 /* NCCameraRollTests.swift */; }; C0DEDA7E30C1000100A00002 /* NCAutoUploadDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEDA7E30C1000100A00001 /* NCAutoUploadDateTests.swift */; }; - C27C31EC91411047C288D266 /* NCProviderSignUp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */; }; + C32F0D5074355BA3F35E7FCE /* NCAccountSetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A84566BEF80733CC99BA52 /* NCAccountSetupView.swift */; }; C7724CB38D2A7B4B98CA1AFA /* NCLoginServerErrorClassifierTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */; }; CB3666201AF7550816B5CD6A /* NCContextMenuComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8932E90EC4278026D86CCCC9 /* NCContextMenuComment.swift */; }; D56DFFE5D5014F66A7C9FED0 /* PasscodeUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC6C501EF1104A6A8569D9C1 /* PasscodeUITests.swift */; }; @@ -579,10 +579,6 @@ F760DE0B2AE66ED80027D78A /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = F760DE0A2AE66ED80027D78A /* KeychainAccess */; }; F760DE0D2AE66EDF0027D78A /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = F760DE0C2AE66EDF0027D78A /* KeychainAccess */; }; F760DE0F2AE66EE60027D78A /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = F760DE0E2AE66EE60027D78A /* KeychainAccess */; }; - F761856A29E98543006EB3B0 /* NCIntro.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F761856629E98543006EB3B0 /* NCIntro.storyboard */; }; - F761856B29E98543006EB3B0 /* NCIntroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F761856729E98543006EB3B0 /* NCIntroViewController.swift */; }; - F761856C29E98543006EB3B0 /* NCIntroCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F761856829E98543006EB3B0 /* NCIntroCollectionViewCell.swift */; }; - F761856D29E98543006EB3B0 /* NCIntroCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F761856929E98543006EB3B0 /* NCIntroCollectionViewCell.xib */; }; F76340ED2EBDE74C0056F538 /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76340EB2EBDE7420056F538 /* NCManageDatabase.swift */; }; F76340EE2EBDE74C0056F538 /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76340EB2EBDE7420056F538 /* NCManageDatabase.swift */; }; F76340F42EBDE9760056F538 /* NCManageDatabaseCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76340F32EBDE9740056F538 /* NCManageDatabaseCore.swift */; }; @@ -1283,14 +1279,13 @@ 2C33C48A23E2CC26005F963B /* Notification_Service_Extension-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Notification_Service_Extension-Bridging-Header.h"; sourceTree = ""; }; 320C20803A58DAF7575440A8 /* NKErrorUserFriendlyMessageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NKErrorUserFriendlyMessageTests.swift; sourceTree = ""; }; 370D26AE248A3D7A00121797 /* NCCellMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCellMain.swift; sourceTree = ""; }; - 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCProviderSignUp.swift; sourceTree = ""; }; 439616AAA50F4360A761E5EF /* NCAlbumsPersistenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAlbumsPersistenceTests.swift; sourceTree = ""; }; + 4B5E8728DE9ABBD5BDD3B447 /* NCAccountSetupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAccountSetupModel.swift; sourceTree = ""; }; 4B74B947E07444CC9CFE0A6C /* NCDocumentEditorSupportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCDocumentEditorSupportTests.swift; sourceTree = ""; }; 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginServerErrorClassifier.swift; sourceTree = ""; }; 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginAppConfig.swift; sourceTree = ""; }; 79DFE0BDF3898A66910E67CA /* NKError+UserFriendlyMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NKError+UserFriendlyMessage.swift"; sourceTree = ""; }; 8932E90EC4278026D86CCCC9 /* NCContextMenuComment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuComment.swift; sourceTree = ""; }; - 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginHostingController.swift; sourceTree = ""; }; A0C0DE0130E0000100C0D001 /* NCPasscodeWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCPasscodeWindow.swift; sourceTree = ""; }; A1E2EE010000000000000001 /* NCEndToEndKeySet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndKeySet.swift; sourceTree = ""; }; A1E2EE010000000000000009 /* NCEndToEndKeySetArchiveTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndKeySetArchiveTests.swift; sourceTree = ""; }; @@ -1441,17 +1436,18 @@ B601AA002F10000100C0D3E5 /* NCLogFilesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCLogFilesView.swift; sourceTree = ""; }; BB7697C94BA14450A0867940 /* NCContextMenuProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuProfile.swift; sourceTree = ""; }; BC6C501EF1104A6A8569D9C1 /* PasscodeUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasscodeUITests.swift; sourceTree = ""; }; - BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginCoordinator.swift; sourceTree = ""; }; C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C04E2F202A17BB4D001BAD85 /* NextcloudIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C0DEA070306D000100000004 /* NCLocalDatabase+AutoUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCLocalDatabase+AutoUpload.swift"; sourceTree = ""; }; C0DEA070306D000100000007 /* NCAutoUploadAssetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAutoUploadAssetTests.swift; sourceTree = ""; }; C0DECA012F65000100C0D001 /* NCCameraRollTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCameraRollTests.swift; sourceTree = ""; }; C0DEDA7E30C1000100A00001 /* NCAutoUploadDateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAutoUploadDateTests.swift; sourceTree = ""; }; + C4A84566BEF80733CC99BA52 /* NCAccountSetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAccountSetupView.swift; sourceTree = ""; }; CE0CD9A00D74B01055F238E9 /* NCErrorContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCErrorContext.swift; sourceTree = ""; }; CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginServerErrorClassifierTests.swift; sourceTree = ""; }; D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = ""; }; DCCD8BFC693B6BB556D97C47 /* NCLoginAppConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginAppConfigTests.swift; sourceTree = ""; }; + E8E39D2FC977AA9ACE6A0F05 /* NCAccountSetupModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAccountSetupModelTests.swift; sourceTree = ""; }; F0A1B2C330B5000100D4E5F6 /* NCMediaViewerFloatingTitleViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMediaViewerFloatingTitleViewTests.swift; sourceTree = ""; }; F0A1B2C530B6000100D4E5F6 /* NCImageZoomViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCImageZoomViewTests.swift; sourceTree = ""; }; F31165012F9674A1009A1E37 /* AppIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = AppIcon.icon; sourceTree = ""; }; @@ -1716,10 +1712,6 @@ F75E197430484B77008ACFDC /* BackgroundUploadExtension+LivePhoto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BackgroundUploadExtension+LivePhoto.swift"; sourceTree = ""; }; F760A4852FE959EB001B212E /* NCTransferCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTransferCoordinator.swift; sourceTree = ""; }; F760A4892FE95D04001B212E /* NCTransferDelegateDispatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTransferDelegateDispatcher.swift; sourceTree = ""; }; - F761856629E98543006EB3B0 /* NCIntro.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCIntro.storyboard; sourceTree = ""; }; - F761856729E98543006EB3B0 /* NCIntroViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCIntroViewController.swift; sourceTree = ""; }; - F761856829E98543006EB3B0 /* NCIntroCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCIntroCollectionViewCell.swift; sourceTree = ""; }; - F761856929E98543006EB3B0 /* NCIntroCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCIntroCollectionViewCell.xib; sourceTree = ""; }; F76340EB2EBDE7420056F538 /* NCManageDatabase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCManageDatabase.swift; sourceTree = ""; }; F76340F32EBDE9740056F538 /* NCManageDatabaseCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCManageDatabaseCore.swift; sourceTree = ""; }; F76340FB2EBDF64A0056F538 /* NCManageDatabase+Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+Tag.swift"; sourceTree = ""; }; @@ -2296,6 +2288,7 @@ AA52EB442D42AC500089C348 /* NextcloudUnitTests */ = { isa = PBXGroup; children = ( + E8E39D2FC977AA9ACE6A0F05 /* NCAccountSetupModelTests.swift */, DCCD8BFC693B6BB556D97C47 /* NCLoginAppConfigTests.swift */, CE2A4CC67E2712B70FCFC090 /* NCLoginServerErrorClassifierTests.swift */, AC13ADAF2026101300000001 /* NCMediaAdaptiveLayoutViewTests.swift */, @@ -3103,17 +3096,6 @@ path = Actors; sourceTree = ""; }; - F761856529E98543006EB3B0 /* Intro */ = { - isa = PBXGroup; - children = ( - F761856629E98543006EB3B0 /* NCIntro.storyboard */, - F761856729E98543006EB3B0 /* NCIntroViewController.swift */, - F761856829E98543006EB3B0 /* NCIntroCollectionViewCell.swift */, - F761856929E98543006EB3B0 /* NCIntroCollectionViewCell.xib */, - ); - path = Intro; - sourceTree = ""; - }; F765F72E25237E3F00391DBE /* Recent */ = { isa = PBXGroup; children = ( @@ -3540,11 +3522,10 @@ F7BFFA621A24D7300044ED85 /* Login */ = { isa = PBXGroup; children = ( + 4B5E8728DE9ABBD5BDD3B447 /* NCAccountSetupModel.swift */, + C4A84566BEF80733CC99BA52 /* NCAccountSetupView.swift */, 5F79FDB4AA1ACCC1AD414CDD /* NCLoginAppConfig.swift */, - BCEB88BE3EAFDCE905D77064 /* NCLoginCoordinator.swift */, - 987B4F1236F0EF15BF30BA8F /* NCLoginHostingController.swift */, 4E0AE8A484BEB1B166E78D2A /* NCLoginServerErrorClassifier.swift */, - 3EB910C38B261399FAD2F20A /* NCProviderSignUp.swift */, F7BC287D26663F6C004D46C5 /* NCViewCertificateDetails.storyboard */, F7BC287F26663F85004D46C5 /* NCViewCertificateDetails.swift */, ); @@ -3599,7 +3580,6 @@ F7C1CDD91E6DFC6F005D92BE /* Brand */ = { isa = PBXGroup; children = ( - F761856529E98543006EB3B0 /* Intro */, F700222B1EC479840080073F /* Custom.xcassets */, F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */, F78E2D6429AF02DB0024D4F3 /* Database.swift */, @@ -4467,7 +4447,6 @@ F7362A1F220C853A005101B5 /* LaunchScreen.storyboard in Resources */, F77444F622281649000D5EB0 /* NCMediaCell.xib in Resources */, F78ACD4421903CF20088454D /* NCListCell.xib in Resources */, - F761856D29E98543006EB3B0 /* NCIntroCollectionViewCell.xib in Resources */, F78ACD4621903D010088454D /* NCGridCell.xib in Resources */, F72685E727C78E490019EF5E /* InfoPlist.strings in Resources */, F769453C22E9CFFF000A798A /* NCShareUserCell.xib in Resources */, @@ -4504,7 +4483,6 @@ F700510122DF63AC003A3356 /* NCShare.storyboard in Resources */, F787704F22E7019900F287A9 /* NCShareLinkCell.xib in Resources */, F7AC934A296193050002BC0F /* Reasons to use Nextcloud.pdf in Resources */, - F761856A29E98543006EB3B0 /* NCIntro.storyboard in Resources */, F719D9E0288D37A300762E33 /* NCColorPicker.storyboard in Resources */, AA517B802D660EFE00F8D37C /* Localizable.stringsdict in Resources */, F704B5E72430C06700632F5F /* NCCreateFormUploadConflictCell.xib in Resources */, @@ -4669,6 +4647,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + BB6422A1935553376638E7BF /* NCAccountSetupModelTests.swift in Sources */, 729609D38218F8A21700723C /* NCLoginAppConfigTests.swift in Sources */, C7724CB38D2A7B4B98CA1AFA /* NCLoginServerErrorClassifierTests.swift in Sources */, AB1028260000000000090120 /* NCShareRecentFoldersStore.swift in Sources */, @@ -4996,11 +4975,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 1FBDC9311538242613612B94 /* NCAccountSetupModel.swift in Sources */, + C32F0D5074355BA3F35E7FCE /* NCAccountSetupView.swift in Sources */, B5E6D3241C08B33DD08B09FE /* NCLoginAppConfig.swift in Sources */, - AB0BFE5B60D759FFBDEE99FF /* NCLoginCoordinator.swift in Sources */, - 2A3D983FCEC820C453EDD1CC /* NCLoginHostingController.swift in Sources */, DE4831E27DECD1D32A381E00 /* NCLoginServerErrorClassifier.swift in Sources */, - C27C31EC91411047C288D266 /* NCProviderSignUp.swift in Sources */, AB1028260000000000090110 /* NCShareRecentFoldersStore.swift in Sources */, AB1028260000000000080000 /* NCShareViewModel+Accounts.swift in Sources */, AB1028260000000000080001 /* NCShareViewModel+Folders.swift in Sources */, @@ -5050,7 +5028,6 @@ F7D890752BD25C570050B8A6 /* NCCollectionViewCommon+DragDrop.swift in Sources */, F7BD0A042C4689E9003A4A6D /* NCMedia+MediaLayout.swift in Sources */, F718E25A2DF2D5D1004038AF /* NCBackgroundLocationUploadManager.swift in Sources */, - F761856B29E98543006EB3B0 /* NCIntroViewController.swift in Sources */, F7743A142C33F13A0034F670 /* NCCollectionViewCommon+CollectionViewDataSource.swift in Sources */, F321DA8A2B71205A00DDA0E6 /* NCTrashSelectTabBar.swift in Sources */, F702F2CD25EE5B4F008F8E80 /* AppDelegate.swift in Sources */, @@ -5215,7 +5192,6 @@ F73EF7BF2B02250B0087E6E9 /* NCManageDatabase+GPS.swift in Sources */, F39A1EE22D0AF8A400DAD522 /* Albums.swift in Sources */, F71F6D072B6A6A5E00F1EB15 /* ThreadSafeArray.swift in Sources */, - F761856C29E98543006EB3B0 /* NCIntroCollectionViewCell.swift in Sources */, F75DD765290ABB25002EB562 /* Intent.intentdefinition in Sources */, F7D4BF012CA1831900A5E746 /* NCCollectionViewCommonPinchGesture.swift in Sources */, F74B6D952A7E239A00F03C5F /* NCManageDatabase+Chunk.swift in Sources */, diff --git a/Tests/NextcloudUITests/BaseUIXCTestCase.swift b/Tests/NextcloudUITests/BaseUIXCTestCase.swift index d718cb5d71..ab8929bebf 100644 --- a/Tests/NextcloudUITests/BaseUIXCTestCase.swift +++ b/Tests/NextcloudUITests/BaseUIXCTestCase.swift @@ -61,7 +61,7 @@ class BaseUIXCTestCase: XCTestCase { /// Sign in through the browser by default, or let the app provision a test account on the login screen. func logIn(usingAppConfig: Bool = false) async throws { - let login = app.buttons["login"] + let continueOnboarding = app.buttons["continueOnboarding"] let deadline = Date().addingTimeInterval(30) // Startup can restore the main interface after the first accessibility snapshot. // Wait for either destination instead of assuming that the login screen will appear. @@ -69,16 +69,16 @@ class BaseUIXCTestCase: XCTestCase { if app.buttons["openSidebar"].exists || app.buttons["accountSwitcher"].exists { return } - if login.exists && login.isHittable { + if continueOnboarding.exists && continueOnboarding.isHittable { break } try await Task.sleep(for: .milliseconds(250)) } while Date() < deadline - guard login.exists else { + guard continueOnboarding.exists else { attachAuthenticationDiagnostics() - throw UITestError.waitForExistence(login) + throw UITestError.waitForExistence(continueOnboarding) } - login.tap() + continueOnboarding.tap() if !usingAppConfig { try await authenticateInBrowser() } diff --git a/Tests/NextcloudUITests/PasscodeUITests.swift b/Tests/NextcloudUITests/PasscodeUITests.swift index f752c9a4af..76a36f436c 100644 --- a/Tests/NextcloudUITests/PasscodeUITests.swift +++ b/Tests/NextcloudUITests/PasscodeUITests.swift @@ -289,7 +289,7 @@ final class PasscodeUITests: BaseUIXCTestCase { // Relaunch without setup flags so they cannot hide an incomplete reset. app.launchArguments = languageArguments app.launch() - XCTAssertTrue(app.buttons["login"].waitForExistence(timeout: TestConstants.controlExistenceTimeout)) + XCTAssertTrue(app.buttons["continueOnboarding"].waitForExistence(timeout: TestConstants.controlExistenceTimeout)) XCTAssertFalse(title.exists, "The app reset must remove the stored passcode.") } diff --git a/Tests/NextcloudUnitTests/NCAccountSetupModelTests.swift b/Tests/NextcloudUnitTests/NCAccountSetupModelTests.swift new file mode 100644 index 0000000000..b5a9f5a2f9 --- /dev/null +++ b/Tests/NextcloudUnitTests/NCAccountSetupModelTests.swift @@ -0,0 +1,84 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import Foundation +import NextcloudKit +import NextcloudKitUI +import Testing +@testable import Nextcloud + +@MainActor +@Suite("Account setup prompts") +struct NCAccountSetupModelTests { + private let serverURL = URL(string: "https://cloud.example.com/")! + private let untrustedCertificate = NKError(errorCode: NSURLErrorServerCertificateUntrusted) + + private func waitUntil(_ condition: @MainActor () -> Bool) async throws { + let deadline = ContinuousClock.now + .seconds(5) + + while condition() == false { + guard ContinuousClock.now < deadline else { + Issue.record("Timed out waiting for the condition.") + return + } + + try await Task.sleep(for: .milliseconds(20)) + } + } + + @Test("Declining the certificate prompt cancels the login") + func decliningCancels() async throws { + let model = NCAccountSetupModel(controller: nil) + let recovery = Task { await model.recover(from: untrustedCertificate, serverURL: serverURL) } + + try await waitUntil { model.isPresentingCertificatePrompt } + + #expect(model.certificateHost == "cloud.example.com") + + model.answer(false) + + guard case .cancel = await recovery.value else { + Issue.record("The login must be cancelled.") + return + } + + #expect(model.isPresentingCertificatePrompt == false) + } + + @Test("Closing the certificate details asks again") + func certificateDetailsAskAgain() async throws { + let model = NCAccountSetupModel(controller: nil) + let recovery = Task { await model.recover(from: untrustedCertificate, serverURL: serverURL) } + + try await waitUntil { model.isPresentingCertificatePrompt } + + // The alert closes itself when one of its buttons is tapped. + model.isPresentingCertificatePrompt = false + model.presentCertificateDetails() + model.certificateDetailsDidClose() + + #expect(model.isPresentingCertificateDetails == false) + #expect(model.isPresentingCertificatePrompt) + + model.answer(false) + _ = await recovery.value + + model.certificateDetailsDidClose() + + #expect(model.isPresentingCertificatePrompt == false) + } + + @Test("Errors https can't avoid are shown") + func otherErrorsAreShown() async { + let model = NCAccountSetupModel(controller: nil) + + guard case .presentError = await model.recover(from: NKError(errorCode: NSURLErrorNotConnectedToInternet), serverURL: serverURL) else { + Issue.record("The error must be shown.") + return + } + + #expect(model.isPresentingCertificatePrompt == false) + #expect(model.isPresentingInsecureConnectionPrompt == false) + } +} diff --git a/iOSClient/Account/NCAccount.swift b/iOSClient/Account/NCAccount.swift index 00966845ce..f27f7a28e8 100644 --- a/iOSClient/Account/NCAccount.swift +++ b/iOSClient/Account/NCAccount.swift @@ -265,7 +265,7 @@ class NCAccount: NSObject { && NCPreferences().getPassword(account: session.account) == token } - /// Presents the login (or intro) screen if no account remains. + /// Presents the account setup if no account remains. func switchToFirstAvailableAccount(controller: NCMainTabBarController?) async { let accounts = await NCManageDatabase.shared.getAccountsAsync() @@ -273,19 +273,7 @@ class NCAccount: NSObject { let account = accounts.first { await changeAccount(account, userProfile: nil, controller: controller) } else { - if NCBrandOptions.shared.disable_intro { - let viewController = NCLoginHostingController(controller: controller, presentation: .modal) - viewController.modalPresentationStyle = .fullScreen - controller?.present(viewController, animated: true) - } else { - if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController { - if let viewController = navigationController.topViewController as? NCIntroViewController { - viewController.controller = controller - } - navigationController.modalPresentationStyle = .fullScreen - controller?.present(navigationController, animated: true) - } - } + controller?.present(NCAccountSetupView.viewController(controller: controller), animated: true) } } } diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 155f9ca6a6..ebe2e2f362 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -437,15 +437,7 @@ class NCFiles: NCCollectionViewCommon { let currentAccount = session.account if database.getAllTableAccount().isEmpty { - let rootViewController: UIViewController? - - if NCBrandOptions.shared.disable_intro { - rootViewController = NCLoginHostingController(controller: nil, presentation: .windowRoot) - } else { - rootViewController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController - } - - UIApplication.shared.mainAppWindow?.rootViewController = rootViewController + UIApplication.shared.mainAppWindow?.rootViewController = NCAccountSetupView.viewController() } else if let account = tblAccount?.account, account != currentAccount { Task { await NCAccount().changeAccount(account, userProfile: nil, controller: controller) diff --git a/iOSClient/Files/NCFilesNavigationController.swift b/iOSClient/Files/NCFilesNavigationController.swift index 3c39506e77..df7a32f05f 100644 --- a/iOSClient/Files/NCFilesNavigationController.swift +++ b/iOSClient/Files/NCFilesNavigationController.swift @@ -114,19 +114,7 @@ class NCFilesNavigationController: NCMainNavigationController { } let addAccountAction = UIAction(title: NSLocalizedString("_add_account_", comment: ""), image: utility.loadImage(named: "person.crop.circle.badge.plus", colors: NCBrandColor.shared.iconImageMultiColors)) { _ in - if NCBrandOptions.shared.disable_intro { - let viewController = NCLoginHostingController(controller: self.controller, presentation: .modal) - viewController.modalPresentationStyle = .fullScreen - self.present(viewController, animated: true) - } else { - if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController { - if let viewController = navigationController.topViewController as? NCIntroViewController { - viewController.controller = nil - } - navigationController.modalPresentationStyle = .fullScreen - self.present(navigationController, animated: true) - } - } + self.present(NCAccountSetupView.viewController(controller: self.controller), animated: true) } let settingsAccountAction = UIAction(title: NSLocalizedString("_account_settings_", comment: ""), image: utility.loadImage(named: "gear", colors: [NCBrandColor.shared.iconImageColor])) { _ in diff --git a/iOSClient/Login/NCLoginCoordinator.swift b/iOSClient/Login/NCAccountSetupModel.swift similarity index 53% rename from iOSClient/Login/NCLoginCoordinator.swift rename to iOSClient/Login/NCAccountSetupModel.swift index 5a3609a7b6..cb1547899b 100644 --- a/iOSClient/Login/NCLoginCoordinator.swift +++ b/iOSClient/Login/NCAccountSetupModel.swift @@ -7,33 +7,45 @@ import NextcloudKitUI import SwiftUI import UIKit -/// Connects the shared NextcloudKitUI login to the app: branding, managed configuration, certificate trust and account creation. +/// Connects the shared NextcloudKitUI onboarding and login to the app: branding, managed configuration, certificate trust and account creation. @MainActor -final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { - enum Presentation { - case windowRoot - case modal - case pushed - } +@Observable +final class NCAccountSetupModel { + /// Shown before the login while the app has no account, unless the brand turned it off. + var showsOnboarding: Bool + + var isPresentingCertificatePrompt = false + var isPresentingInsecureConnectionPrompt = false + var isPresentingCertificateDetails = false + + /// The server whose certificate the prompt and its details are about. + private(set) var certificateHost = "" - weak var presenter: UIViewController? + /// The controller hosting the setup, which dismisses it and shows its error banners. + @ObservationIgnored weak var presenter: UIViewController? - private let presentation: Presentation - private let controller: NCMainTabBarController? - /// A server to log in to right away, such as one the user just signed up on. - private let loginServerURL: URL? - private var certificateDetailsContinuation: CheckedContinuation? + @ObservationIgnored private(set) var configuration = LoginFlowConfiguration() + @ObservationIgnored private(set) var sharedAccounts: [SharedAccount] = [] - init(controller: NCMainTabBarController?, presentation: Presentation, loginServerURL: URL? = nil) { + @ObservationIgnored private let controller: NCMainTabBarController? + @ObservationIgnored private var answerContinuation: CheckedContinuation? + @ObservationIgnored private var hasLoginAppeared = false + + /// - Parameter controller: The tab bar the setup is presented on, or `nil` when the setup is the root of the window. + init(controller: NCMainTabBarController?) { self.controller = controller - self.presentation = presentation - self.loginServerURL = loginServerURL + + let hasAccounts = !NCManageDatabase.shared.getAllTableAccount().isEmpty + + showsOnboarding = !NCBrandOptions.shared.disable_intro && !hasAccounts + configuration = makeConfiguration(showsCancelButton: controller != nil && hasAccounts) + sharedAccounts = loadSharedAccounts() } // MARK: - Configuration - /// Built from the brand options at presentation time, so values overridden by the managed configuration apply. - func makeConfiguration() -> LoginFlowConfiguration { + /// Built from the brand options when the setup is created, so values overridden by the managed configuration apply. + private func makeConfiguration(showsCancelButton: Bool) -> LoginFlowConfiguration { let brandOptions = NCBrandOptions.shared var configuration = LoginFlowConfiguration() @@ -41,10 +53,7 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { configuration.serverAddressDescription = String.localizedStringWithFormat(NSLocalizedString("_login_address_detail_", comment: ""), brandOptions.brand) configuration.enforcedServersPrompt = NSLocalizedString("_select_server_", comment: "") - if let loginServerURL { - configuration.initialServerAddress = loginServerURL.absoluteString - configuration.startsLoginOnAppear = true - } else if case .prefill(let serverURL) = appConfigAction { + if case .prefill(let serverURL) = appConfigAction { configuration.initialServerAddress = serverURL } else if !brandOptions.loginBaseUrl.isEmpty { configuration.initialServerAddress = brandOptions.loginBaseUrl @@ -56,8 +65,18 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { } configuration.upgradesInsecureHTTP = true configuration.loginURLScheme = brandOptions.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "") - configuration.embedsNavigationStack = presentation != .pushed - configuration.showsCancelButton = presentation == .modal && !NCManageDatabase.shared.getAllTableAccount().isEmpty + configuration.showsCancelButton = showsCancelButton + + // Branded apps link to neither the nextcloud.com providers nor its install page. + if !brandOptions.disable_intro { + configuration.providerSignUp = URL(string: brandOptions.linkloginPreferredProviders).map { + LoginFlowConfiguration.WebLink(title: NSLocalizedString("_sign_up_", comment: ""), url: $0) + } + + configuration.hostingInformation = URL(string: brandOptions.linkLoginHost).map { + LoginFlowConfiguration.WebLink(title: NSLocalizedString("_host_your_own_server_", comment: ""), url: $0) + } + } configuration.onCancel = { [weak self] in self?.presenter?.dismiss(animated: true) @@ -71,7 +90,7 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { } /// Accounts of other Nextcloud apps on this device which are not added here yet. - func loadSharedAccounts() -> [SharedAccount] { + private func loadSharedAccounts() -> [SharedAccount] { // Their sheet would still be open when the managed configuration logs in by itself. switch appConfigAction { case .createAccount, .requestAppPassword: @@ -105,8 +124,8 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { func addAccount(host: URL, user: String, password: String) async throws { guard let presenter else { return } - // The shared accounts sheet may still be closing, while the QR code scanner stays open and closes with the login. - await waitForClosingSheet() + // The shared accounts sheet may still be closing, while the QR code scanner stays open and closes with the setup. + await waitForTransitions() let controller = self.controller ?? SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) @@ -117,15 +136,19 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { try await NCAccount().createAccount(viewController: presenter, urlBase: host.absoluteString, user: user, password: password, controller: controller) } - /// Pushes the login for a server, which starts right away. - /// - Returns: Whether the presenter has a navigation stack to show it on. - func showLogin(serverURL: URL) -> Bool { - guard let navigationController = presenter?.navigationController else { return false } + /// Publishes the accounts for other apps and logs in with the managed configuration, once. + func loginDidAppear() { + guard !hasLoginAppeared else { return } + + hasLoginAppeared = true - let viewController = NCLoginHostingController(controller: controller, presentation: .pushed, loginServerURL: serverURL) - navigationController.pushViewController(viewController, animated: true) + Task { + _ = await NCAccount().updateAppsShareAccounts() + } - return true + Task { + await runAppConfigAutoLoginIfNeeded() + } } // MARK: - Managed configuration @@ -149,10 +172,7 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { accountCount: NCManageDatabase.shared.getAccounts()?.count ?? 0) } - func runAppConfigAutoLoginIfNeeded() async { - // It would race the login that starts by itself for this server. - guard loginServerURL == nil else { return } - + private func runAppConfigAutoLoginIfNeeded() async { let serverURL: String let user: String let password: String @@ -193,106 +213,73 @@ final class NCLoginCoordinator: NCViewCertificateDetailsDelegate { // MARK: - Server errors - private func recover(from error: NKError, serverURL: URL) async -> LoginFlowConfiguration.Recovery { + func recover(from error: NKError, serverURL: URL) async -> LoginFlowConfiguration.Recovery { switch NCLoginServerErrorClassifier.classify(error, serverURL: serverURL) { case .untrustedCertificate(let host): - return await resolveUntrustedCertificate(host: host, serverURL: serverURL) + certificateHost = host + + guard await ask(\.isPresentingCertificatePrompt) else { return .cancel } + + NCNetworking.shared.writeCertificate(host: host) + return .retry(serverURL) case .insecureFallback(let httpURL): #if DEBUG return .retry(httpURL) #else - let choice = await presentChoice(title: NSLocalizedString("_warning_", comment: ""), - message: NSLocalizedString("_https_failed_try_http_", comment: ""), - actions: [(NSLocalizedString("_cancel_", comment: ""), .cancel), - (NSLocalizedString("_continue_", comment: ""), .destructive)]) - - return choice == 1 ? .retry(httpURL) : .cancel + return await ask(\.isPresentingInsecureConnectionPrompt) ? .retry(httpURL) : .cancel #endif case .generic: return .presentError } } - private func resolveUntrustedCertificate(host: String, serverURL: URL) async -> LoginFlowConfiguration.Recovery { - while true { - let choice = await presentChoice(title: NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), - message: NSLocalizedString("_connect_server_anyway_", comment: ""), - actions: [(NSLocalizedString("_yes_", comment: ""), .default), - (NSLocalizedString("_no_", comment: ""), .default), - (NSLocalizedString("_certificate_details_", comment: ""), .default)]) - - switch choice { - case 0: - NCNetworking.shared.writeCertificate(host: host) - return .retry(serverURL) - case 2: - await presentCertificateDetails(host: host) - default: - return .cancel - } - } - } - - // MARK: - Presentation + /// Shows the prompt once nothing else is closing, and waits for its answer. + private func ask(_ prompt: ReferenceWritableKeyPath) async -> Bool { + await waitForTransitions() - private var topViewController: UIViewController? { - var top = presenter - - while let presented = top?.presentedViewController, !presented.isBeingDismissed { - top = presented + return await withCheckedContinuation { continuation in + answerContinuation?.resume(returning: false) + answerContinuation = continuation + self[keyPath: prompt] = true } - - return top } - /// - Returns: The index of the chosen action, or `nil` when nothing could present the alert. - private func presentChoice(title: String, message: String, actions: [(title: String, style: UIAlertAction.Style)]) async -> Int? { - await waitForClosingSheet() - - guard let topViewController else { return nil } + /// Resumes the login waiting for the prompt. + func answer(_ isConfirmed: Bool) { + isPresentingCertificatePrompt = false + isPresentingInsecureConnectionPrompt = false - return await withCheckedContinuation { continuation in - let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) - - for (index, action) in actions.enumerated() { - alertController.addAction(UIAlertAction(title: action.title, style: action.style) { _ in - continuation.resume(returning: index) - }) - } + answerContinuation?.resume(returning: isConfirmed) + answerContinuation = nil + } - topViewController.present(alertController, animated: true) - } + func presentCertificateDetails() { + isPresentingCertificateDetails = true } - private func presentCertificateDetails(host: String) async { - guard let topViewController, - let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() as? UINavigationController, - let viewController = navigationController.topViewController as? NCViewCertificateDetails else { - return - } + /// Asks again about the certificate whose details were shown. + func certificateDetailsDidClose() { + isPresentingCertificateDetails = false - viewController.host = host - viewController.delegate = self + guard answerContinuation != nil else { return } - await withCheckedContinuation { continuation in - certificateDetailsContinuation = continuation - topViewController.present(navigationController, animated: true) - } + isPresentingCertificatePrompt = true } - nonisolated func viewCertificateDetailsDismiss(host: String) { - MainActor.assumeIsolated { - certificateDetailsContinuation?.resume() - certificateDetailsContinuation = nil - } - } + // MARK: - Transitions - /// A sheet that is still closing would otherwise receive what is presented or dismissed next. - private func waitForClosingSheet() async { + /// A sheet still closing, or the setup still sliding in, would drop what is presented or dismissed next. + private func waitForTransitions() async { let deadline = ContinuousClock.now + .seconds(2) - while presenter?.presentedViewController?.isBeingDismissed == true, ContinuousClock.now < deadline { + while isTransitioning, ContinuousClock.now < deadline { try? await Task.sleep(for: .milliseconds(50)) } } + + private var isTransitioning: Bool { + guard let presenter else { return false } + + return presenter.isBeingPresented || presenter.presentedViewController?.isBeingDismissed == true + } } diff --git a/iOSClient/Login/NCAccountSetupView.swift b/iOSClient/Login/NCAccountSetupView.swift new file mode 100644 index 0000000000..561e6cc26a --- /dev/null +++ b/iOSClient/Login/NCAccountSetupView.swift @@ -0,0 +1,97 @@ +// SPDX-FileCopyrightText: Nextcloud GmbH +// SPDX-FileCopyrightText: 2026 Milen Pivchev +// SPDX-License-Identifier: GPL-3.0-or-later + +import NextcloudKitUI +import SwiftUI +import UIKit + +/// The onboarding and login of NextcloudKitUI, shown while the app has no account and to add one. +struct NCAccountSetupView: View { + @Bindable var model: NCAccountSetupModel + + var body: some View { + ZStack { + if model.showsOnboarding { + OnboardingView(title: String.localizedStringWithFormat(NSLocalizedString("_onboarding_title_", comment: ""), NCBrandOptions.shared.brand), + features: features, + tint: Color(uiColor: NCBrandColor.shared.customer)) { + withAnimation { + model.showsOnboarding = false + } + } + .transition(.opacity) + } else { + ServerAddressView(backgroundColor: .constant(Color(uiColor: NCBrandColor.shared.customer)), + brandImage: Image("logo"), + sharedAccounts: model.sharedAccounts, + userAgent: userAgent, + configuration: model.configuration) { host, name, password in + try await model.addAccount(host: host, user: name, password: password) + } + .onAppear { + model.loginDidAppear() + } + .transition(.opacity) + } + } + .alert(NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), isPresented: $model.isPresentingCertificatePrompt) { + Button(NSLocalizedString("_yes_", comment: "")) { + model.answer(true) + } + + Button(NSLocalizedString("_no_", comment: "")) { + model.answer(false) + } + + Button(NSLocalizedString("_certificate_details_", comment: "")) { + model.presentCertificateDetails() + } + } message: { + Text(NSLocalizedString("_connect_server_anyway_", comment: "")) + } + .alert(NSLocalizedString("_warning_", comment: ""), isPresented: $model.isPresentingInsecureConnectionPrompt) { + Button(NSLocalizedString("_cancel_", comment: ""), role: .cancel) { + model.answer(false) + } + + Button(NSLocalizedString("_continue_", comment: ""), role: .destructive) { + model.answer(true) + } + } message: { + Text(NSLocalizedString("_https_failed_try_http_", comment: "")) + } + .sheet(isPresented: $model.isPresentingCertificateDetails) { + // The details close themselves, which a sheet binding may not notice. + certificateDetailsView(host: model.certificateHost, title: NSLocalizedString("_certificate_view_", comment: "")) { + model.certificateDetailsDidClose() + } + } + .onDisappear { + // A login must not wait for a prompt of a setup that is gone. + model.answer(false) + } + } + + private var features: [OnboardingFeature] { + [ + OnboardingFeature(icon: Image(systemName: "lock.shield"), title: NSLocalizedString("_intro_1_title_", comment: "")), + OnboardingFeature(icon: Image(systemName: "person.2"), title: NSLocalizedString("_intro_2_title_", comment: "")), + OnboardingFeature(icon: Image(systemName: "envelope"), title: NSLocalizedString("_intro_3_title_", comment: "")), + OnboardingFeature(icon: Image(systemName: "video"), title: NSLocalizedString("_intro_4_title_", comment: "")) + ] + } + + /// The setup in a full screen controller, for the root of a window or to present on the tab bar. + /// - Parameter controller: The tab bar to present the setup on. + static func viewController(controller: NCMainTabBarController? = nil) -> UIViewController { + let model = NCAccountSetupModel(controller: controller) + let viewController = UIHostingController(rootView: NCAccountSetupView(model: model)) + + viewController.modalPresentationStyle = .fullScreen + viewController.view.backgroundColor = model.showsOnboarding ? .systemBackground : NCBrandColor.shared.customer + model.presenter = viewController + + return viewController + } +} diff --git a/iOSClient/Login/NCLoginHostingController.swift b/iOSClient/Login/NCLoginHostingController.swift deleted file mode 100644 index 086a8bf601..0000000000 --- a/iOSClient/Login/NCLoginHostingController.swift +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2026 Milen Pivchev -// SPDX-License-Identifier: GPL-3.0-or-later - -import NextcloudKitUI -import SwiftUI -import UIKit - -/// Hosts the shared NextcloudKitUI login for every place the app shows its login screen. -final class NCLoginHostingController: UIHostingController { - private let coordinator: NCLoginCoordinator - private var hasAppeared = false - - /// - Parameter loginServerURL: A server to log in to right away, such as one the user just signed up on. - init(controller: NCMainTabBarController?, presentation: NCLoginCoordinator.Presentation, loginServerURL: URL? = nil) { - let coordinator = NCLoginCoordinator(controller: controller, presentation: presentation, loginServerURL: loginServerURL) - - let rootView = ServerAddressView(backgroundColor: .constant(Color(uiColor: NCBrandColor.shared.customer)), - brandImage: Image("logo"), - sharedAccounts: coordinator.loadSharedAccounts(), - userAgent: userAgent, - configuration: coordinator.makeConfiguration()) { host, name, password in - try await coordinator.addAccount(host: host, user: name, password: password) - } - - self.coordinator = coordinator - - super.init(rootView: rootView) - - coordinator.presenter = self - } - - @available(*, unavailable) - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = NCBrandColor.shared.customer - - Task { - _ = await NCAccount().updateAppsShareAccounts() - } - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - guard !hasAppeared else { return } - - hasAppeared = true - - Task { - await coordinator.runAppConfigAutoLoginIfNeeded() - } - } -} diff --git a/iOSClient/Login/NCProviderSignUp.swift b/iOSClient/Login/NCProviderSignUp.swift deleted file mode 100644 index 9c8c4e0dc8..0000000000 --- a/iOSClient/Login/NCProviderSignUp.swift +++ /dev/null @@ -1,266 +0,0 @@ -// SPDX-FileCopyrightText: Nextcloud GmbH -// SPDX-FileCopyrightText: 2026 Milen Pivchev -// SPDX-License-Identifier: GPL-3.0-or-later - -import NextcloudKit -import NextcloudKitUI -import UIKit -@preconcurrency import WebKit - -/// Signs up with a provider and adds the new account from the login callback URL the sign-up ends on. -/// -/// A web view instead of a browser session, because the sign-up page only hands over credentials to page loads with the OCS API header. -final class NCProviderSignUp: UIViewController, WKNavigationDelegate { - private static let apiHeader = "OCS-APIRequest" - - private let url: URL - private let coordinator: NCLoginCoordinator - private let scheme = NCBrandOptions.shared.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "").lowercased() - private let webView: WKWebView - private let activityIndicator = UIActivityIndicatorView(style: .medium) - private var loadingObservation: NSKeyValueObservation? - private var reissuedURLs: Set = [] - private var requestedURL: URL? - private var hasAppeared = false - private var hasReloadedAfterTermination = false - private var isFinished = false - - init(url: URL, coordinator: NCLoginCoordinator) { - self.url = url - self.coordinator = coordinator - - let configuration = WKWebViewConfiguration() - configuration.websiteDataStore = .nonPersistent() - webView = WKWebView(frame: .zero, configuration: configuration) - - super.init(nibName: nil, bundle: nil) - } - - @available(*, unavailable) - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewDidLoad() { - super.viewDidLoad() - - title = url.host - view.backgroundColor = .systemBackground - navigationItem.leftBarButtonItem = UIBarButtonItem(systemItem: .close, primaryAction: UIAction { [weak self] _ in - self?.dismiss(animated: true) - }) - - webView.frame = view.bounds - webView.autoresizingMask = [.flexibleWidth, .flexibleHeight] - webView.customUserAgent = userAgent - webView.navigationDelegate = self - view.addSubview(webView) - - activityIndicator.center = CGPoint(x: view.bounds.midX, y: view.bounds.midY) - activityIndicator.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin, .flexibleBottomMargin] - view.addSubview(activityIndicator) - - loadingObservation = webView.observe(\.isLoading) { [weak self] webView, _ in - if webView.isLoading { - self?.activityIndicator.startAnimating() - } else { - self?.activityIndicator.stopAnimating() - } - } - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - // Not while the screen slides in, which would drop the alert of a load that fails right away. - guard !hasAppeared else { return } - - hasAppeared = true - webView.load(Self.apiRequest(for: Self.uncachedURL(url))) - } - - /// nextcloud.com serves its sign-up page from a cache that ignores the header, unless the address has a query. - private static func uncachedURL(_ url: URL) -> URL { - guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return url } - - components.queryItems = (components.queryItems ?? []) + [URLQueryItem(name: "ocsapi", value: "1")] - - return components.url ?? url - } - - /// Fails after 20 seconds without data instead of a minute, so an unreachable server is reported soon. - private static func apiRequest(for url: URL) -> URLRequest { - var request = URLRequest(url: url, timeoutInterval: 20) - request.setValue("true", forHTTPHeaderField: apiHeader) - - return request - } - - /// The page that failed, or the sign-up page when none has been requested yet. - private func reload() { - reissuedURLs.removeAll() - webView.load(Self.apiRequest(for: requestedURL ?? Self.uncachedURL(url))) - } - - // MARK: - WKNavigationDelegate - - func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { - let request = navigationAction.request - - guard let url = request.url else { - decisionHandler(.cancel) - return - } - - if url.scheme?.lowercased() == scheme { - decisionHandler(.cancel) - finish(callbackURL: url) - return - } - - if navigationAction.targetFrame?.isMainFrame == true, request.httpMethod == "GET" { - // Redirects and links lose the header, so such page loads are started again with it, once per page. - if request.value(forHTTPHeaderField: Self.apiHeader) == nil, reissuedURLs.insert(url).inserted { - decisionHandler(.cancel) - webView.load(Self.apiRequest(for: url)) - return - } - - requestedURL = url - } - - decisionHandler(.allow) - } - - func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { - guard navigationResponse.isForMainFrame else { - decisionHandler(.allow) - return - } - - // Error pages and empty responses would otherwise load as if nothing went wrong. - if let response = navigationResponse.response as? HTTPURLResponse, response.statusCode >= 400 { - decisionHandler(.cancel) - showLoadError(Self.error(forStatusCode: response.statusCode), in: webView) - return - } - - if !navigationResponse.canShowMIMEType || navigationResponse.response.expectedContentLength == 0 { - decisionHandler(.cancel) - showLoadError(NKError.invalidResponseError, in: webView) - return - } - - decisionHandler(.allow) - } - - func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) { - guard let url = webView.url, url.scheme?.lowercased() == scheme else { return } - - finish(callbackURL: url) - } - - func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { - reissuedURLs.removeAll() - hasReloadedAfterTermination = false - } - - func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { - showLoadError(error, in: webView) - } - - func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { - showLoadError(error, in: webView) - } - - func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { - // WebKit stops reloading by itself once this is implemented, so reload once and report a repeat. - guard hasReloadedAfterTermination else { - hasReloadedAfterTermination = true - reload() - return - } - - showLoadError(NKError(errorCode: WKError.Code.webContentProcessTerminated.rawValue, errorDescription: "Web content process terminated", kind: .unknown), in: webView) - } - - // MARK: - Errors - - /// Picks a kind whose NextcloudKit text fits a web page, unlike the file-related ones for 403 or 404. - private static func error(forStatusCode statusCode: Int) -> NKError { - let kind: NKError.Kind - - switch statusCode { - case 408, 504: - kind = .timeout - case 429: - kind = .rateLimited - case 503: - kind = .unavailable - case 500, 501, 505...599: - kind = .serverError - default: - kind = .serverUnreachable - } - - return NKError(errorCode: statusCode, errorDescription: HTTPURLResponse.localizedString(forStatusCode: statusCode), kind: kind) - } - - private func showLoadError(_ error: Error, in webView: WKWebView) { - // Page loads this class replaces end as interrupted or cancelled. - let nsError = error as NSError - let isInterrupted = nsError.domain == "WebKitErrorDomain" && nsError.code == 102 - let nkError = error as? NKError ?? NKError(error: error) - - guard !isFinished, !isInterrupted, presentedViewController == nil, - let message = nkError.userFriendlyMessage() else { return } - - let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: message, preferredStyle: .alert) - - alert.addAction(UIAlertAction(title: NSLocalizedString("_close_", comment: ""), style: .cancel) { [weak self] _ in - self?.dismiss(animated: true) - }) - - alert.addAction(UIAlertAction(title: NSLocalizedString("_retry_", comment: ""), style: .default) { [weak self] _ in - self?.reload() - }) - - present(alert, animated: true) - } - - // MARK: - Account - - private func finish(callbackURL: URL) { - guard !isFinished else { return } - - isFinished = true - - // The presenter is off screen behind this full screen page, so its scene would be nil. - let windowScene = view.window?.windowScene - - Task { - await withCheckedContinuation { continuation in - dismiss(animated: true) { - continuation.resume() - } - } - - do { - let credentials = try LoginCallbackParser.parse(callbackURL, scheme: scheme) - - do { - try await coordinator.addAccount(host: credentials.host, user: credentials.user, password: credentials.password) - } catch let error as NKError where error.kind == .unauthorized { - // Providers may hand over a session token, which servers refuse, so the user logs in to the new account instead. - nkLog(error: "The new account refused its sign-up credentials, starting the login: \(error.logDescription)") - - guard coordinator.showLogin(serverURL: credentials.host) else { throw error } - } - } catch let error as NKError { - await showErrorBanner(windowScene: windowScene, error: error, context: .login) - } catch { - await showErrorBanner(windowScene: windowScene, title: NCErrorContext.login.failureTitle ?? "_error_", text: error.localizedDescription) - } - } - } -} diff --git a/iOSClient/Login/NCViewCertificateDetails.swift b/iOSClient/Login/NCViewCertificateDetails.swift index 46bd3cdf01..36fc1b2ba1 100644 --- a/iOSClient/Login/NCViewCertificateDetails.swift +++ b/iOSClient/Login/NCViewCertificateDetails.swift @@ -101,6 +101,12 @@ struct certificateDetailsView: UIViewControllerRepresentable { var privateKeyString: String = "" var host: String = "" var title: String = "" + /// Called when the details close, also when they close themselves. + var onClose: (() -> Void)? + + func makeCoordinator() -> Coordinator { + Coordinator(onClose: onClose) + } func makeUIViewController(context: Context) -> UINavigationController { let storyboard = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil) @@ -110,9 +116,22 @@ struct certificateDetailsView: UIViewControllerRepresentable { viewController?.privateKeyString = privateKeyString viewController?.host = host viewController?.certificateTitle = title + viewController?.delegate = context.coordinator return navigationController! } func updateUIViewController(_ uiViewController: UINavigationController, context: Context) { } + + final class Coordinator: NCViewCertificateDetailsDelegate { + let onClose: (() -> Void)? + + init(onClose: (() -> Void)?) { + self.onClose = onClose + } + + func viewCertificateDetailsDismiss(host: String) { + onClose?() + } + } } diff --git a/iOSClient/SceneDelegate.swift b/iOSClient/SceneDelegate.swift index ff0c262750..dcb48343dd 100644 --- a/iOSClient/SceneDelegate.swift +++ b/iOSClient/SceneDelegate.swift @@ -125,15 +125,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { UserDefaults.standard.removePersistentDomain(forName: bundleID) } - if NCBrandOptions.shared.disable_intro { - window?.rootViewController = NCLoginHostingController(controller: nil, presentation: .windowRoot) - window?.makeKeyAndVisible() - } else { - if let navigationController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() as? UINavigationController { - window?.rootViewController = navigationController - window?.makeKeyAndVisible() - } - } + window?.rootViewController = NCAccountSetupView.viewController() + window?.makeKeyAndVisible() } } diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings index 9dcf130ce9..b2a77eb80e 100644 --- a/iOSClient/Supporting Files/en.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings @@ -452,6 +452,7 @@ "_create_new_diagram_" = "Diagram"; "_more_documents_" = "More Documents"; "_go_online_" = "Go online to see the document"; +"_onboarding_title_" = "Welcome to %@"; "_intro_1_title_" = "Keep your data secure and under your control"; "_intro_2_title_" = "Secure collaboration & file exchange"; "_intro_3_title_" = "Easy-to-use web mail, calendaring & contacts"; From fd13da7e7c04aa397876bab8e60ab92bba149d68 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Tue, 24 Nov 2026 15:58:40 +0100 Subject: [PATCH 18/30] chore: remove the unused intro images and string Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Milen Pivchev --- .../intro1.imageset/Contents.json | 12 ------------ .../Custom.xcassets/intro1.imageset/intro1.svg | 1 - .../intro2.imageset/Contents.json | 12 ------------ .../Custom.xcassets/intro2.imageset/intro2.png | Bin 5335 -> 0 bytes .../intro3.imageset/Contents.json | 12 ------------ .../Custom.xcassets/intro3.imageset/intro3.png | Bin 8944 -> 0 bytes .../intro4.imageset/Contents.json | 12 ------------ .../Custom.xcassets/intro4.imageset/intro4.png | Bin 11087 -> 0 bytes .../en.lproj/Localizable.strings | 1 - 9 files changed, 50 deletions(-) delete mode 100644 Brand/Custom.xcassets/intro1.imageset/Contents.json delete mode 100644 Brand/Custom.xcassets/intro1.imageset/intro1.svg delete mode 100644 Brand/Custom.xcassets/intro2.imageset/Contents.json delete mode 100644 Brand/Custom.xcassets/intro2.imageset/intro2.png delete mode 100644 Brand/Custom.xcassets/intro3.imageset/Contents.json delete mode 100644 Brand/Custom.xcassets/intro3.imageset/intro3.png delete mode 100644 Brand/Custom.xcassets/intro4.imageset/Contents.json delete mode 100644 Brand/Custom.xcassets/intro4.imageset/intro4.png diff --git a/Brand/Custom.xcassets/intro1.imageset/Contents.json b/Brand/Custom.xcassets/intro1.imageset/Contents.json deleted file mode 100644 index 9b5a868724..0000000000 --- a/Brand/Custom.xcassets/intro1.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "intro1.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Brand/Custom.xcassets/intro1.imageset/intro1.svg b/Brand/Custom.xcassets/intro1.imageset/intro1.svg deleted file mode 100644 index 076f295e4d..0000000000 --- a/Brand/Custom.xcassets/intro1.imageset/intro1.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Brand/Custom.xcassets/intro2.imageset/Contents.json b/Brand/Custom.xcassets/intro2.imageset/Contents.json deleted file mode 100644 index b56c247bbc..0000000000 --- a/Brand/Custom.xcassets/intro2.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "intro2.png", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Brand/Custom.xcassets/intro2.imageset/intro2.png b/Brand/Custom.xcassets/intro2.imageset/intro2.png deleted file mode 100644 index 6cf5f76ae73a8e8f6fe8c88353e9af20b6ff8fdc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5335 zcmb7Id011|wohV|APPanL}tOMQq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+cSr1}kE@|3n#R7hDBp%V=qjeg5L1uyq6b z&r1JTAQena%6{jQNZ8gJ-tGDFz(cuaov!jb{yc^eKQnuLfe3po$1C)-H*=6LKf0>m zyx9siA1Wskf4oaS|C5qGYhRH*WKh?JR2Gal3`yZQ7p(yWuXz0g_QXWn|M7@U>k`*q z0lz-vY1>w^B2y@LC?r(!Jp7tW0xeLJad1|=!gIRAVxPO{vSu;8@u3E!MH8jernUzN zdkkiyqyoU|vsR*1UbNIs!Fy+}mnB{2#xMDX;v(LjA^ zo3xJaQrzXYsd0Z%NHeY77&zc7IM;Cf)Qu5st=9Z}QCALmPU1MC+1*!TUJ`9<)*^-! zwDOw=pMtS+Tl-hfxhGXESaI}bOyb*7T0(_mS^Wp+*)HR1*U$ZSLp4wTe$Y!5GQ`lI YMjzrm;d&lGPbcs()HOp_-^4!oAKJK Date: Wed, 25 Nov 2026 11:58:28 +0100 Subject: [PATCH 19/30] feat: keep the onboarding and login in portrait on iPhone 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 Signed-off-by: Milen Pivchev --- iOSClient/AppDelegate.swift | 36 ++++++++++++++++++++++++ iOSClient/Login/NCAccountSetupView.swift | 19 +++++++++++++ 2 files changed, 55 insertions(+) diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index e6a3850e11..bbe455f850 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -326,6 +326,42 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { return false } + + // MARK: - Orientation + + func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { + // The onboarding and login are laid out for portrait on iPhone. + if UIDevice.current.userInterfaceIdiom == .phone, NCAccountSetupView.isShown(in: window) { + return .portrait + } + + return Self.infoPlistOrientations + } + + /// The orientations the Info.plist allows on this device, which this delegate method otherwise replaces. + private static let infoPlistOrientations: UIInterfaceOrientationMask = { + let bundle = Bundle.main + let names = (UIDevice.current.userInterfaceIdiom == .pad ? bundle.object(forInfoDictionaryKey: "UISupportedInterfaceOrientations~ipad") as? [String] : nil) + ?? bundle.object(forInfoDictionaryKey: "UISupportedInterfaceOrientations") as? [String] + ?? [] + + let mask = names.reduce(into: UIInterfaceOrientationMask()) { mask, name in + switch name { + case "UIInterfaceOrientationPortrait": + mask.insert(.portrait) + case "UIInterfaceOrientationPortraitUpsideDown": + mask.insert(.portraitUpsideDown) + case "UIInterfaceOrientationLandscapeLeft": + mask.insert(.landscapeLeft) + case "UIInterfaceOrientationLandscapeRight": + mask.insert(.landscapeRight) + default: + break + } + } + + return mask.isEmpty ? .all : mask + }() } // MARK: - Extension diff --git a/iOSClient/Login/NCAccountSetupView.swift b/iOSClient/Login/NCAccountSetupView.swift index 561e6cc26a..1e00125158 100644 --- a/iOSClient/Login/NCAccountSetupView.swift +++ b/iOSClient/Login/NCAccountSetupView.swift @@ -67,6 +67,10 @@ struct NCAccountSetupView: View { model.certificateDetailsDidClose() } } + .onAppear { + // Turns to portrait right away when shown over the files in landscape. + model.presenter?.setNeedsUpdateOfSupportedInterfaceOrientations() + } .onDisappear { // A login must not wait for a prompt of a setup that is gone. model.answer(false) @@ -82,6 +86,21 @@ struct NCAccountSetupView: View { ] } + /// Whether the setup is the root of the window or presented in it, with anything it presents on top. + static func isShown(in window: UIWindow?) -> Bool { + var viewController = window?.rootViewController + + while let current = viewController { + if current is UIHostingController { + return true + } + + viewController = current.presentedViewController + } + + return false + } + /// The setup in a full screen controller, for the root of a window or to present on the tab bar. /// - Parameter controller: The tab bar to present the setup on. static func viewController(controller: NCMainTabBarController? = nil) -> UIViewController { From b8722c893e1d440f370fedf9237def922cf36346 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Wed, 25 Nov 2026 12:09:27 +0100 Subject: [PATCH 20/30] refactor: reword why shared accounts are hidden during the managed login Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCAccountSetupModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOSClient/Login/NCAccountSetupModel.swift b/iOSClient/Login/NCAccountSetupModel.swift index cb1547899b..054dc65043 100644 --- a/iOSClient/Login/NCAccountSetupModel.swift +++ b/iOSClient/Login/NCAccountSetupModel.swift @@ -91,7 +91,7 @@ final class NCAccountSetupModel { /// Accounts of other Nextcloud apps on this device which are not added here yet. private func loadSharedAccounts() -> [SharedAccount] { - // Their sheet would still be open when the managed configuration logs in by itself. + // Not offered while the managed configuration logs in by itself. switch appConfigAction { case .createAccount, .requestAppPassword: return [] From 86e031f83aa679a718e06bdc16197d0ea6ef5246 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Wed, 25 Nov 2026 15:22:56 +0100 Subject: [PATCH 21/30] =?UTF-8?q?fix:=20bring=20back=20the=20"Server=20add?= =?UTF-8?q?ress=20https://=20=E2=80=A6"=20placeholder=20on=20the=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCAccountSetupModel.swift | 1 + iOSClient/Supporting Files/en.lproj/Localizable.strings | 1 + 2 files changed, 2 insertions(+) diff --git a/iOSClient/Login/NCAccountSetupModel.swift b/iOSClient/Login/NCAccountSetupModel.swift index 054dc65043..2071bf7fd1 100644 --- a/iOSClient/Login/NCAccountSetupModel.swift +++ b/iOSClient/Login/NCAccountSetupModel.swift @@ -50,6 +50,7 @@ final class NCAccountSetupModel { var configuration = LoginFlowConfiguration() configuration.foregroundColor = NCBrandColor.shared.customer.isTooLight() ? .black : .white + configuration.serverAddressPrompt = NSLocalizedString("_login_url_", comment: "") configuration.serverAddressDescription = String.localizedStringWithFormat(NSLocalizedString("_login_address_detail_", comment: ""), brandOptions.brand) configuration.enforcedServersPrompt = NSLocalizedString("_select_server_", comment: "") diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings index be41e5d86c..411b3f3a9a 100644 --- a/iOSClient/Supporting Files/en.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings @@ -494,6 +494,7 @@ "_monthly_" = "Monthly"; "_yearly_" = "Yearly"; "_daily_" = "Daily"; +"_login_url_" = "Server address https:// …"; "_login_address_detail_" = "The link to your %@ web interface when you open it in the browser."; "_go_to_page_" = "Go to page"; "_page_" = "Page"; From ecfaa952fbfc35c4875f6980749e3e50fa26cd3d Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Wed, 25 Nov 2026 15:24:43 +0100 Subject: [PATCH 22/30] fix: show the onboarding only once 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 Signed-off-by: Milen Pivchev --- Tests/NextcloudUITests/BaseUIXCTestCase.swift | 12 +++++++----- Tests/NextcloudUITests/PasscodeUITests.swift | 3 ++- iOSClient/Login/NCAccountSetupModel.swift | 11 ++++++++--- iOSClient/Login/NCAccountSetupView.swift | 2 +- iOSClient/Settings/NCPreferences.swift | 9 +++++++++ 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Tests/NextcloudUITests/BaseUIXCTestCase.swift b/Tests/NextcloudUITests/BaseUIXCTestCase.swift index ab8929bebf..96f9c26ce0 100644 --- a/Tests/NextcloudUITests/BaseUIXCTestCase.swift +++ b/Tests/NextcloudUITests/BaseUIXCTestCase.swift @@ -62,23 +62,25 @@ class BaseUIXCTestCase: XCTestCase { /// Sign in through the browser by default, or let the app provision a test account on the login screen. func logIn(usingAppConfig: Bool = false) async throws { let continueOnboarding = app.buttons["continueOnboarding"] + let serverAddress = app.textFields["serverAddress"].firstMatch let deadline = Date().addingTimeInterval(30) // Startup can restore the main interface after the first accessibility snapshot. - // Wait for either destination instead of assuming that the login screen will appear. + // Wait for any destination; the onboarding only shows until it was continued once. repeat { if app.buttons["openSidebar"].exists || app.buttons["accountSwitcher"].exists { return } - if continueOnboarding.exists && continueOnboarding.isHittable { + if (continueOnboarding.exists && continueOnboarding.isHittable) || serverAddress.exists { break } try await Task.sleep(for: .milliseconds(250)) } while Date() < deadline - guard continueOnboarding.exists else { + if continueOnboarding.exists { + continueOnboarding.tap() + } else if !serverAddress.exists { attachAuthenticationDiagnostics() - throw UITestError.waitForExistence(continueOnboarding) + throw UITestError.waitForExistence(serverAddress) } - continueOnboarding.tap() if !usingAppConfig { try await authenticateInBrowser() } diff --git a/Tests/NextcloudUITests/PasscodeUITests.swift b/Tests/NextcloudUITests/PasscodeUITests.swift index 76a36f436c..6f31260c7f 100644 --- a/Tests/NextcloudUITests/PasscodeUITests.swift +++ b/Tests/NextcloudUITests/PasscodeUITests.swift @@ -289,7 +289,8 @@ final class PasscodeUITests: BaseUIXCTestCase { // Relaunch without setup flags so they cannot hide an incomplete reset. app.launchArguments = languageArguments app.launch() - XCTAssertTrue(app.buttons["continueOnboarding"].waitForExistence(timeout: TestConstants.controlExistenceTimeout)) + XCTAssertTrue(app.textFields["serverAddress"].firstMatch.waitForExistence(timeout: TestConstants.controlExistenceTimeout) + || app.buttons["continueOnboarding"].exists) XCTAssertFalse(title.exists, "The app reset must remove the stored passcode.") } diff --git a/iOSClient/Login/NCAccountSetupModel.swift b/iOSClient/Login/NCAccountSetupModel.swift index 2071bf7fd1..109bb0c685 100644 --- a/iOSClient/Login/NCAccountSetupModel.swift +++ b/iOSClient/Login/NCAccountSetupModel.swift @@ -11,8 +11,8 @@ import UIKit @MainActor @Observable final class NCAccountSetupModel { - /// Shown before the login while the app has no account, unless the brand turned it off. - var showsOnboarding: Bool + /// Shown once before the first login, unless the brand turned it off. + private(set) var showsOnboarding: Bool var isPresentingCertificatePrompt = false var isPresentingInsecureConnectionPrompt = false @@ -37,11 +37,16 @@ final class NCAccountSetupModel { let hasAccounts = !NCManageDatabase.shared.getAllTableAccount().isEmpty - showsOnboarding = !NCBrandOptions.shared.disable_intro && !hasAccounts + showsOnboarding = !NCBrandOptions.shared.disable_intro && !hasAccounts && !NCPreferences().hasSeenOnboarding configuration = makeConfiguration(showsCancelButton: controller != nil && hasAccounts) sharedAccounts = loadSharedAccounts() } + func finishOnboarding() { + NCPreferences().hasSeenOnboarding = true + showsOnboarding = false + } + // MARK: - Configuration /// Built from the brand options when the setup is created, so values overridden by the managed configuration apply. diff --git a/iOSClient/Login/NCAccountSetupView.swift b/iOSClient/Login/NCAccountSetupView.swift index 1e00125158..c0adf4a33a 100644 --- a/iOSClient/Login/NCAccountSetupView.swift +++ b/iOSClient/Login/NCAccountSetupView.swift @@ -17,7 +17,7 @@ struct NCAccountSetupView: View { features: features, tint: Color(uiColor: NCBrandColor.shared.customer)) { withAnimation { - model.showsOnboarding = false + model.finishOnboarding() } } .transition(.opacity) diff --git a/iOSClient/Settings/NCPreferences.swift b/iOSClient/Settings/NCPreferences.swift index fd07152e5d..73d1bcae43 100644 --- a/iOSClient/Settings/NCPreferences.swift +++ b/iOSClient/Settings/NCPreferences.swift @@ -37,6 +37,15 @@ final class NCPreferences: NSObject { } } + var hasSeenOnboarding: Bool { + get { + return getBoolPreference(key: "hasSeenOnboarding", defaultValue: false) + } + set { + setUserDefaults(newValue, forKey: "hasSeenOnboarding") + } + } + var showRecommendedFiles: Bool { get { return getBoolPreference(key: "showRecommendedFiles", defaultValue: true) From 116d8abec3d07085f0ade41160085438b8f477fb Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Wed, 25 Nov 2026 15:35:35 +0100 Subject: [PATCH 23/30] chore: use the NextcloudKit shared-login-swiftui branch 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 Signed-off-by: Milen Pivchev --- Nextcloud.xcodeproj/project.pbxproj | 28 +- .../xcshareddata/swiftpm/Package.resolved | 330 ++++++++++++++++++ 2 files changed, 350 insertions(+), 8 deletions(-) create mode 100644 Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 246ac4e85e..da011780b2 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -4357,7 +4357,7 @@ F76DA967277B77E90082465B /* XCRemoteSwiftPackageReference "DropDown" */, F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */, F753BA91281FD8010015BFB6 /* XCRemoteSwiftPackageReference "EasyTipView" */, - A1B2C3D4E5F6A7B8C9D0E1F2 /* XCLocalSwiftPackageReference "../NextcloudKit-shared-login" */, + F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */, F734B06428E75C0100E180D5 /* XCRemoteSwiftPackageReference "TLPhotoPicker" */, F77333862927A72100466E35 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */, F77BC3E9293E5268005F2B08 /* XCRemoteSwiftPackageReference "swifter" */, @@ -6955,13 +6955,6 @@ }; /* End XCConfigurationList section */ -/* Begin XCLocalSwiftPackageReference section */ - A1B2C3D4E5F6A7B8C9D0E1F2 /* XCLocalSwiftPackageReference "../NextcloudKit-shared-login" */ = { - isa = XCLocalSwiftPackageReference; - relativePath = "../NextcloudKit-shared-login"; - }; -/* End XCLocalSwiftPackageReference section */ - /* Begin XCRemoteSwiftPackageReference section */ F3374AEE2D78B01B002A38F9 /* XCRemoteSwiftPackageReference "swift-collections" */ = { isa = XCRemoteSwiftPackageReference; @@ -7067,6 +7060,14 @@ kind = branch; }; }; + F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/nextcloud/NextcloudKit"; + requirement = { + branch = "shared-login-swiftui"; + kind = branch; + }; + }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/bmoliveira/MarkdownKit"; @@ -7167,6 +7168,7 @@ }; F37208B72BAB63EF006B5430 /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F37208B92BAB63EF006B5430 /* TLPhotoPicker */ = { @@ -7241,6 +7243,7 @@ }; F70CAC7C30408F2600CCCB7F /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F70CAC7E30408F3100CCCB7F /* KeychainAccess */ = { @@ -7295,18 +7298,22 @@ }; F72AD70C28C24B93006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72AD70E28C24BA1006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72AD71028C24BBB006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72AD71228C24BCC006CB92D /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F72DA9B325F53E4E00B87DB1 /* SwiftRichString */ = { @@ -7326,6 +7333,7 @@ }; F7490E8A29882CE4009DCE94 /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F753BA92281FD8020015BFB6 /* EasyTipView */ = { @@ -7400,6 +7408,7 @@ }; F783034328B5142B00B84583 /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F788ECC6263AAAFA00ADC67F /* MarkdownKit */ = { @@ -7414,10 +7423,12 @@ }; F7A27B2C3053007C00EF02C7 /* NextcloudKitUI */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKitUI; }; F7A8D72328F1771B008BBE1C /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F7A8D72728F17728008BBE1C /* RealmSwift */ = { @@ -7427,6 +7438,7 @@ }; F7C55C9E2FB5B83A004A974F /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; productName = NextcloudKit; }; F7D4BF532CA2ED9D00A5E746 /* VLCKitSPM */ = { diff --git a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000000..1b4f783290 --- /dev/null +++ b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,330 @@ +{ + "originHash" : "5236b0018852b3d5fa374f118d9825d5acd8f4ce80430d339706d09182995ba2", + "pins" : [ + { + "identity" : "abseil-cpp-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/abseil-cpp-binary.git", + "state" : { + "revision" : "26509120768c4add61cc1a63059f15f4fb49edb4", + "version" : "1.2025051202.0" + } + }, + { + "identity" : "alamofire", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Alamofire/Alamofire", + "state" : { + "revision" : "bda9ed57d72988a3a2ada33d824583541f86eac6", + "version" : "5.12.2" + } + }, + { + "identity" : "app-check", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/app-check.git", + "state" : { + "revision" : "b7c71458b70284cc0f5a87103f66f0b1d98b1873", + "version" : "12.1.0" + } + }, + { + "identity" : "codescanner", + "kind" : "remoteSourceControl", + "location" : "https://github.com/twostraws/CodeScanner.git", + "state" : { + "revision" : "5e886430238944c7200fc9e10dbf2d9550dba865", + "version" : "2.5.2" + } + }, + { + "identity" : "dropdown", + "kind" : "remoteSourceControl", + "location" : "https://github.com/AssistoLab/DropDown", + "state" : { + "branch" : "master", + "revision" : "2ab6f6ce19f0117d1a76ea043ef8f57722c65d16" + } + }, + { + "identity" : "easytipview", + "kind" : "remoteSourceControl", + "location" : "https://github.com/marinofaggiana/EasyTipView", + "state" : { + "branch" : "master", + "revision" : "bb25a13c8fa5d65144c8e5b5d31237b80a001b07" + } + }, + { + "identity" : "firebase-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/firebase-ios-sdk", + "state" : { + "revision" : "dc6dfd442b1f3ec215ed62b8beb2623ffab010d6", + "version" : "13.1.1" + } + }, + { + "identity" : "google-ads-on-device-conversion-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/googleads/google-ads-on-device-conversion-ios-sdk", + "state" : { + "revision" : "0208e2681ec81f8a9c81084696f60fcce26cb7ee", + "version" : "3.7.0" + } + }, + { + "identity" : "googleappmeasurement", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleAppMeasurement.git", + "state" : { + "revision" : "1a3546fb9189292e9d64db9e72add7a286c0f85a", + "version" : "13.0.1" + } + }, + { + "identity" : "googledatatransport", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleDataTransport.git", + "state" : { + "revision" : "ba3358d3c3dbae8ef230b58a46b97ad65e84e974", + "version" : "10.1.1" + } + }, + { + "identity" : "googleutilities", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleUtilities.git", + "state" : { + "revision" : "5459ee5603def3db0fe14ca522185f42c48d978e", + "version" : "8.1.5" + } + }, + { + "identity" : "grdb.swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/groue/GRDB.swift", + "state" : { + "revision" : "92a554cd0d5e8d67cb18993c6054e73fe42c066c", + "version" : "7.12.0" + } + }, + { + "identity" : "grpc-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/grpc-binary.git", + "state" : { + "revision" : "9d5e9f05670c9eab8d8c22731ddd5d4d9cf867a8", + "version" : "1.83.1" + } + }, + { + "identity" : "gtm-session-fetcher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/gtm-session-fetcher.git", + "state" : { + "revision" : "724a52eea6329b7e12d3ad8300d76ca9f3895fcc", + "version" : "5.3.1" + } + }, + { + "identity" : "gzipswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/1024jp/GzipSwift", + "state" : { + "revision" : "41d37421fe2cbbfae4a5593dc29d12999fb73cd7", + "version" : "7.0.0" + } + }, + { + "identity" : "interop-ios-for-google-sdks", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/interop-ios-for-google-sdks.git", + "state" : { + "revision" : "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe", + "version" : "101.0.0" + } + }, + { + "identity" : "keychainaccess", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kishikawakatsumi/KeychainAccess", + "state" : { + "revision" : "84e546727d66f1adc5439debad16270d0fdd04e7", + "version" : "4.2.2" + } + }, + { + "identity" : "leveldb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/leveldb.git", + "state" : { + "revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1", + "version" : "1.22.5" + } + }, + { + "identity" : "lucidbanner", + "kind" : "remoteSourceControl", + "location" : "https://github.com/marinofaggiana/LucidBanner", + "state" : { + "revision" : "408af8b2ff2451f055ff17042d8b9fb5c822d5fd", + "version" : "0.8.0" + } + }, + { + "identity" : "mantis", + "kind" : "remoteSourceControl", + "location" : "https://github.com/marinofaggiana/Mantis", + "state" : { + "revision" : "d145ce2403e0d94d4926eb8510bc4966fbf1bfca", + "version" : "1.0.0" + } + }, + { + "identity" : "markdownkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/bmoliveira/MarkdownKit", + "state" : { + "revision" : "39ea7a3fc7e65bcafe55152592b834859be574a5", + "version" : "1.7.3" + } + }, + { + "identity" : "nanopb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/nanopb.git", + "state" : { + "revision" : "3851d94a41890dea16dc3db34caf60e585cb4163", + "version" : "2.30910.1" + } + }, + { + "identity" : "nextcloudkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/nextcloud/NextcloudKit", + "state" : { + "branch" : "shared-login-swiftui", + "revision" : "476bab40376841ec484042b2a0dcabb5c9fa9d2a" + } + }, + { + "identity" : "openssl-package", + "kind" : "remoteSourceControl", + "location" : "https://github.com/krzyzanowskim/OpenSSL-Package", + "state" : { + "revision" : "4ac3f9a68731cb3cf736a591814bad9a7a2008c8", + "version" : "3.6.5000" + } + }, + { + "identity" : "popupview", + "kind" : "remoteSourceControl", + "location" : "https://github.com/exyte/PopupView.git", + "state" : { + "revision" : "38fe3de1d9b455a77dd119794e2fa22bdea3ba7f", + "version" : "5.0.9" + } + }, + { + "identity" : "promises", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/promises.git", + "state" : { + "revision" : "f4a19a3c313dc2616c70bb49d29a799fb16be837", + "version" : "2.4.1" + } + }, + { + "identity" : "realm-core", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/realm-core.git", + "state" : { + "revision" : "b4192c46305570577c4d08df790fddec5ab3aa04", + "version" : "20.1.5" + } + }, + { + "identity" : "realm-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/realm-swift", + "state" : { + "revision" : "a40ced79265b644a896e393b0f3a37e7916e7de3", + "version" : "20.0.6" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "88754449ab766a739610b660e117762115fabc9c", + "version" : "1.7.6" + } + }, + { + "identity" : "swifter", + "kind" : "remoteSourceControl", + "location" : "https://github.com/httpswift/swifter.git", + "state" : { + "branch" : "stable", + "revision" : "1e4f51c92d7ca486242d8bf0722b99de2c3531aa" + } + }, + { + "identity" : "swiftrichstring", + "kind" : "remoteSourceControl", + "location" : "https://github.com/malcommac/SwiftRichString", + "state" : { + "revision" : "9bf4b5af6bb4386865636fc504d6c588c2b65040", + "version" : "3.7.2" + } + }, + { + "identity" : "swiftyjson", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SwiftyJSON/SwiftyJSON", + "state" : { + "revision" : "af76cf3ef710b6ca5f8c05f3a31307d44a3c5828", + "version" : "5.0.2" + } + }, + { + "identity" : "swiftyxmlparser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/yahoojapan/SwiftyXMLParser", + "state" : { + "revision" : "d7a1d23f04c86c1cd2e8f19247dd15d74e0ea8be", + "version" : "5.6.0" + } + }, + { + "identity" : "taglistview", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ElaWorkshop/TagListView", + "state" : { + "revision" : "b30b61826736f4d9ec04aef5df891f3914423f16", + "version" : "1.4.1" + } + }, + { + "identity" : "tlphotopicker", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tilltue/TLPhotoPicker", + "state" : { + "revision" : "4e948c4eecae0a164b746767701ed805a6e904d0", + "version" : "2.2.0" + } + }, + { + "identity" : "vlckit-spm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tylerjonesio/vlckit-spm", + "state" : { + "revision" : "e932bbd488872fdb74f6654d28c2f291eae03daf", + "version" : "3.6.0" + } + } + ], + "version" : 3 +} From ea6d834f80e23d88e07b65e52c41c3cec12c3c17 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 26 Nov 2026 10:37:22 +0100 Subject: [PATCH 24/30] chore: update the package pins hash for the NextcloudKit branch Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 Signed-off-by: Milen Pivchev --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 1b4f783290..1650d7df89 100644 --- a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "5236b0018852b3d5fa374f118d9825d5acd8f4ce80430d339706d09182995ba2", + "originHash" : "19cee9bce0527e84fb4b83b6cc3fd1f2677d81935be8a72347c0a85660fdc201", "pins" : [ { "identity" : "abseil-cpp-binary", From a8ef8f11e43f0c076bc9f1193e57ebc955df6020 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 26 Nov 2026 12:14:14 +0100 Subject: [PATCH 25/30] refactor: trim account setup leftovers 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 Signed-off-by: Milen Pivchev --- .../NCLoginServerErrorClassifierTests.swift | 7 +-- iOSClient/Account/NCAccount.swift | 1 - iOSClient/AppDelegate.swift | 10 +-- iOSClient/Login/NCAccountSetupModel.swift | 61 +++++++++---------- .../Login/NCViewCertificateDetails.swift | 32 ++-------- iOSClient/NCGlobal.swift | 5 -- 6 files changed, 37 insertions(+), 79 deletions(-) diff --git a/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift b/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift index bba9adb754..4e5e32c745 100644 --- a/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift +++ b/Tests/NextcloudUnitTests/NCLoginServerErrorClassifierTests.swift @@ -30,7 +30,7 @@ struct NCLoginServerErrorClassifierTests { #expect(resolution == .insecureFallback(URL(string: "http://cloud.example.com:8443/nextcloud/")!)) } - @Test("No network or an unknown host is shown, as http can't help", arguments: [NSURLErrorNotConnectedToInternet, NSURLErrorCannotFindHost, NSURLErrorDNSLookupFailed]) + @Test("No network, an unknown host or a cancellation is shown, as http can't help", arguments: [NSURLErrorNotConnectedToInternet, NSURLErrorCannotFindHost, NSURLErrorDNSLookupFailed, NSURLErrorCancelled]) func unreachable(errorCode: Int) { #expect(NCLoginServerErrorClassifier.classify(NKError(errorCode: errorCode), serverURL: httpsURL) == .generic) } @@ -41,9 +41,4 @@ struct NCLoginServerErrorClassifierTests { #expect(NCLoginServerErrorClassifier.classify(NKError(errorCode: NSURLErrorCannotConnectToHost), serverURL: httpURL) == .generic) } - - @Test("Cancelled requests are shown") - func cancelled() { - #expect(NCLoginServerErrorClassifier.classify(NKError(errorCode: NSURLErrorCancelled), serverURL: httpsURL) == .generic) - } } diff --git a/iOSClient/Account/NCAccount.swift b/iOSClient/Account/NCAccount.swift index f27f7a28e8..221a94ffef 100644 --- a/iOSClient/Account/NCAccount.swift +++ b/iOSClient/Account/NCAccount.swift @@ -10,7 +10,6 @@ import NextcloudKit class NCAccount: NSObject { private static var accountsCheckingRemoteUser: Set = [] let database = NCManageDatabase.shared - let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! let global = NCGlobal.shared let utilityFileSystem = NCUtilityFileSystem() diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index bbe455f850..b284185865 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -277,7 +277,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD alertController.addAction(UIAlertAction(title: NSLocalizedString("_certificate_details_", comment: ""), style: .default, handler: { _ in if let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() as? UINavigationController, let viewController = navigationController.topViewController as? NCViewCertificateDetails { - viewController.delegate = self + viewController.onClose = { + self.trustCertificateError(host: host) + } viewController.host = host UIApplication.shared.mainAppWindow?.rootViewController?.present(navigationController, animated: true) } @@ -366,12 +368,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // MARK: - Extension -extension AppDelegate: NCViewCertificateDetailsDelegate { - func viewCertificateDetailsDismiss(host: String) { - trustCertificateError(host: host) - } -} - extension AppDelegate: NCCreateFormUploadConflictDelegate { func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) { if let metadatas { diff --git a/iOSClient/Login/NCAccountSetupModel.swift b/iOSClient/Login/NCAccountSetupModel.swift index 109bb0c685..ada1b4675a 100644 --- a/iOSClient/Login/NCAccountSetupModel.swift +++ b/iOSClient/Login/NCAccountSetupModel.swift @@ -71,7 +71,6 @@ final class NCAccountSetupModel { } configuration.upgradesInsecureHTTP = true configuration.loginURLScheme = brandOptions.webLoginAutenticationProtocol.replacingOccurrences(of: "://", with: "") - configuration.showsCancelButton = showsCancelButton // Branded apps link to neither the nextcloud.com providers nor its install page. if !brandOptions.disable_intro { @@ -84,8 +83,10 @@ final class NCAccountSetupModel { } } - configuration.onCancel = { [weak self] in - self?.presenter?.dismiss(animated: true) + if showsCancelButton { + configuration.onCancel = { [weak self] in + self?.presenter?.dismiss(animated: true) + } } configuration.onServerError = { [weak self] error, serverURL in @@ -130,7 +131,7 @@ final class NCAccountSetupModel { func addAccount(host: URL, user: String, password: String) async throws { guard let presenter else { return } - // The shared accounts sheet may still be closing, while the QR code scanner stays open and closes with the setup. + // The setup may still be sliding in, as for the managed auto-login, while the QR code scanner stays open and closes with the setup. await waitForTransitions() let controller = self.controller ?? SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) @@ -179,38 +180,34 @@ final class NCAccountSetupModel { } private func runAppConfigAutoLoginIfNeeded() async { - let serverURL: String - let user: String - let password: String - - switch appConfigAction { - case .createAccount(let url, let name, let appPassword): - serverURL = url - user = name - password = appPassword - case .requestAppPassword(let url, let name, let userPassword): - let results = await NextcloudKit.shared.getAppPasswordAsync(url: url, user: name, password: userPassword) - - guard results.error == .success, let token = results.token else { - let isUnclassified = results.error == .success || results.error.kind == nil - - await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: isUnclassified ? .invalidData : results.error, context: .login) + do { + let serverURL: String + let user: String + let password: String + + switch appConfigAction { + case .createAccount(let url, let name, let appPassword): + serverURL = url + user = name + password = appPassword + case .requestAppPassword(let url, let name, let userPassword): + let results = await NextcloudKit.shared.getAppPasswordAsync(url: url, user: name, password: userPassword) + + guard results.error == .success, let token = results.token else { + let isUnclassified = results.error == .success || results.error.kind == nil + + throw isUnclassified ? NKError.invalidData : results.error + } + + serverURL = url + user = name + password = token + case .prefill, nil: return } - serverURL = url - user = name - password = token - case .prefill, nil: - return - } + guard let host = URL(string: serverURL) else { throw NKError.urlError } - guard let host = URL(string: serverURL) else { - await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: .urlError, context: .login) - return - } - - do { try await addAccount(host: host, user: user, password: password) } catch { await showErrorBanner(windowScene: presenter?.view.window?.windowScene, error: error as? NKError ?? NKError(error: error), context: .login) diff --git a/iOSClient/Login/NCViewCertificateDetails.swift b/iOSClient/Login/NCViewCertificateDetails.swift index 36fc1b2ba1..42fb3f5f89 100644 --- a/iOSClient/Login/NCViewCertificateDetails.swift +++ b/iOSClient/Login/NCViewCertificateDetails.swift @@ -5,22 +5,14 @@ import UIKit import SwiftUI -public protocol NCViewCertificateDetailsDelegate: AnyObject { - func viewCertificateDetailsDismiss(host: String) -} - -// optional func -public extension NCViewCertificateDetailsDelegate { - func viewCertificateDetailsDismiss(host: String) {} -} - class NCViewCertificateDetails: UIViewController { @IBOutlet weak var buttonCancel: UIBarButtonItem! @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var textView: UITextView! @IBOutlet weak var privateKey: UILabel! - var delegate: NCViewCertificateDetailsDelegate? + /// Called when the details close, also when they close themselves. + var onClose: (() -> Void)? let utilityFileSystem = NCUtilityFileSystem() public var privateKeyString: String = "" @@ -84,7 +76,7 @@ class NCViewCertificateDetails: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) - self.delegate?.viewCertificateDetailsDismiss(host: host) + onClose?() } // MARK: ACTION @@ -104,10 +96,6 @@ struct certificateDetailsView: UIViewControllerRepresentable { /// Called when the details close, also when they close themselves. var onClose: (() -> Void)? - func makeCoordinator() -> Coordinator { - Coordinator(onClose: onClose) - } - func makeUIViewController(context: Context) -> UINavigationController { let storyboard = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil) let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController @@ -116,22 +104,10 @@ struct certificateDetailsView: UIViewControllerRepresentable { viewController?.privateKeyString = privateKeyString viewController?.host = host viewController?.certificateTitle = title - viewController?.delegate = context.coordinator + viewController?.onClose = onClose return navigationController! } func updateUIViewController(_ uiViewController: UINavigationController, context: Context) { } - - final class Coordinator: NCViewCertificateDetailsDelegate { - let onClose: (() -> Void)? - - init(onClose: (() -> Void)?) { - self.onClose = onClose - } - - func viewCertificateDetailsDismiss(host: String) { - onClose?() - } - } } diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index 4c5ffed945..010b5404f5 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -48,11 +48,6 @@ final class NCGlobal: Sendable { let editorOnlyOffice: String = "onlyoffice" let editorWhiteboard: String = "whiteboard" - // Intro selector - // - let introLogin: Int = 0 - let introSignUpWithProvider: Int = 1 - // Avatar // // Shared download resolution for a 128-point avatar at 3x scale, also used without a UI context. From ad4ae216933f2f62890b29a6c706e354d6fede61 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 26 Nov 2026 12:20:50 +0100 Subject: [PATCH 26/30] style: put the managed login's URL guard body on its own lines Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCAccountSetupModel.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iOSClient/Login/NCAccountSetupModel.swift b/iOSClient/Login/NCAccountSetupModel.swift index ada1b4675a..873a8b0cd8 100644 --- a/iOSClient/Login/NCAccountSetupModel.swift +++ b/iOSClient/Login/NCAccountSetupModel.swift @@ -206,7 +206,9 @@ final class NCAccountSetupModel { return } - guard let host = URL(string: serverURL) else { throw NKError.urlError } + guard let host = URL(string: serverURL) else { + throw NKError.urlError + } try await addAccount(host: host, user: user, password: password) } catch { From 4829f8b19d2e869e225be8eeee93aa181450525a Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 26 Nov 2026 12:32:04 +0100 Subject: [PATCH 27/30] chore: update NextcloudKit to the simplified shared-login-swiftui branch Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Milen Pivchev --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 1650d7df89..84511caea6 100644 --- a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -205,7 +205,7 @@ "location" : "https://github.com/nextcloud/NextcloudKit", "state" : { "branch" : "shared-login-swiftui", - "revision" : "476bab40376841ec484042b2a0dcabb5c9fa9d2a" + "revision" : "033ecef25631e79747dea05dd49eb8c8a3803d4a" } }, { From 3f3af03b4aec3185456798896ca9d05e31be0761 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 26 Nov 2026 12:36:40 +0100 Subject: [PATCH 28/30] fix: trust a server certificate only after the prompt 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 Signed-off-by: Milen Pivchev --- iOSClient/Login/NCAccountSetupModel.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/iOSClient/Login/NCAccountSetupModel.swift b/iOSClient/Login/NCAccountSetupModel.swift index 873a8b0cd8..c9b2d7aa5c 100644 --- a/iOSClient/Login/NCAccountSetupModel.swift +++ b/iOSClient/Login/NCAccountSetupModel.swift @@ -136,10 +136,7 @@ final class NCAccountSetupModel { let controller = self.controller ?? SceneManager.shared.getController(window: UIApplication.shared.mainAppWindow) - if let host = host.host { - NCNetworking.shared.writeCertificate(host: host) - } - + // A certificate is trusted only from the prompt in recover(from:serverURL:), never by adding the account. try await NCAccount().createAccount(viewController: presenter, urlBase: host.absoluteString, user: user, password: password, controller: controller) } From 6ce84927669bd948a382ca337c10cfc8b03a891c Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 26 Nov 2026 12:44:34 +0100 Subject: [PATCH 29/30] chore: update NextcloudKit for the enforced server check on QR code logins Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Milen Pivchev --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 84511caea6..f7dff6976a 100644 --- a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -205,7 +205,7 @@ "location" : "https://github.com/nextcloud/NextcloudKit", "state" : { "branch" : "shared-login-swiftui", - "revision" : "033ecef25631e79747dea05dd49eb8c8a3803d4a" + "revision" : "bc0aec8e3548406a32a74078d8cb57ffca82b68a" } }, { From 15f1191487da535f1f270b0677dac2d18b96b670 Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Thu, 26 Nov 2026 12:57:17 +0100 Subject: [PATCH 30/30] chore: use NextcloudKit 7.7.0 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 Signed-off-by: Milen Pivchev --- Nextcloud.xcodeproj/project.pbxproj | 4 ++-- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index da011780b2..15f0d51f8d 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -7064,8 +7064,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/nextcloud/NextcloudKit"; requirement = { - branch = "shared-login-swiftui"; - kind = branch; + kind = exactVersion; + version = 7.7.0; }; }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { diff --git a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f7dff6976a..d68df51ca5 100644 --- a/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -204,8 +204,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/nextcloud/NextcloudKit", "state" : { - "branch" : "shared-login-swiftui", - "revision" : "bc0aec8e3548406a32a74078d8cb57ffca82b68a" + "revision" : "5898f5d7ea4148c3679959826cf23ed07d430fb1", + "version" : "7.7.0" } }, {