Skip to content

Commit

Permalink
Merge branch 'release/2.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Sep 13, 2024
2 parents f3de4e0 + b1335c5 commit 59d83fe
Show file tree
Hide file tree
Showing 94 changed files with 1,374 additions and 397 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build

on:
[push]
push:
pull_request_target:
types: [labeled]

jobs:
build:
Expand Down
4 changes: 4 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
disabled_rules:
- file_length
- line_length
- redundant_void_return
- todo
- type_body_length

Expand All @@ -14,6 +15,9 @@ included:
- FileProviderExtension
- FileProviderExtensionUI

excluded:
- CryptomatorCommon/.build

identifier_name:
min_length: 1
max_length: 50
Expand Down
14 changes: 12 additions & 2 deletions Cryptomator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,10 @@
748BF20F2B571BB4006304AD /* fil */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fil; path = fil.lproj/Intents.strings; sourceTree = "<group>"; };
748BF2102B571C0C006304AD /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = "<group>"; };
748BF2112B571C11006304AD /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Intents.strings; sourceTree = "<group>"; };
749D911D2C93089D00FAD1A4 /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Localizable.strings; sourceTree = "<group>"; };
749D911E2C9308A700FAD1A4 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
749D912C2C9308DD00FAD1A4 /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Intents.strings; sourceTree = "<group>"; };
749D912D2C9308DE00FAD1A4 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Intents.strings; sourceTree = "<group>"; };
74A1B13D2726A9E60098224B /* hi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hi; path = hi.lproj/Localizable.strings; sourceTree = "<group>"; };
74AE94EF27A0282300D71AEC /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = "<group>"; };
74AE94F027A0283500D71AEC /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2332,9 +2336,11 @@
ro,
ru,
sk,
sl,
sv,
"sw-TZ",
tr,
uk,
"zh-Hans",
"zh-Hant",
"zh-HK",
Expand Down Expand Up @@ -3090,9 +3096,11 @@
74275AE128478E0F0058AD25 /* ro */,
74275AE228478E100058AD25 /* ru */,
74275AE328478E120058AD25 /* sk */,
749D912C2C9308DD00FAD1A4 /* sl */,
74275AE628478E140058AD25 /* sv */,
74275AE528478E140058AD25 /* sw-TZ */,
74275AE728478E160058AD25 /* tr */,
749D912D2C9308DE00FAD1A4 /* uk */,
74275AD128478DFF0058AD25 /* zh-Hans */,
74275AD228478E000058AD25 /* zh-Hant */,
74275AD028478DFF0058AD25 /* zh-HK */,
Expand Down Expand Up @@ -3139,9 +3147,11 @@
74DFF9DA26DF87A0009981ED /* ro */,
74267A1626A5798C004C61BC /* ru */,
74267A1726A57990004C61BC /* sk */,
749D911D2C93089D00FAD1A4 /* sl */,
74267A1A26A5799A004C61BC /* sv */,
74397A852832A09B00CB9410 /* sw-TZ */,
74267A1C26A5799F004C61BC /* tr */,
749D911E2C9308A700FAD1A4 /* uk */,
74267A1D26A579A4004C61BC /* zh-Hans */,
74397A842832A05E00CB9410 /* zh-Hant */,
74626665283BD2D20070924B /* zh-HK */,
Expand Down Expand Up @@ -3310,7 +3320,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 2.5.2;
MARKETING_VERSION = 2.6.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -3372,7 +3382,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 2.5.2;
MARKETING_VERSION = 2.6.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/leif-ibsen/ASN1",
"state" : {
"revision" : "8a5cb6ce9b4a009a5b8d82465caf1aafb720096e",
"version" : "2.5.0"
"revision" : "4b4e82513e3b4d51a7573972fd7123222dd3a3bd",
"version" : "2.6.0"
}
},
{
"identity" : "asn1swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tikhop/ASN1Swift",
"state" : {
"revision" : "177417b6bf89431a0750ee640012b6aed8961c6a",
"version" : "1.2.5"
"revision" : "403cd95194e6a962e16db7c0d373d89fce83e0f7",
"version" : "1.2.7"
}
},
{
"identity" : "aws-sdk-ios-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/aws-amplify/aws-sdk-ios-spm.git",
"state" : {
"revision" : "cfcf97f6994b6ffd9a3244dc638458f5822aba56",
"version" : "2.34.0"
"revision" : "8ff8bebfe24271f7b16c5abaeb78daf82bee3a80",
"version" : "2.34.2"
}
},
{
Expand All @@ -50,17 +50,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/leif-ibsen/BigInt",
"state" : {
"revision" : "ba54c8b51392627d4cc9b05a672cce558be56e04",
"version" : "1.17.0"
"revision" : "bf55e4ce076a5e2dde0db13d9b03d820cfad420d",
"version" : "1.19.0"
}
},
{
"identity" : "box-swift-sdk-gen",
"kind" : "remoteSourceControl",
"location" : "https://github.com/box/box-swift-sdk-gen.git",
"state" : {
"revision" : "a6b5793ab4053f9b55b840245ad07c9e3fdae344",
"version" : "0.5.0"
}
},
{
"identity" : "cloud-access-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/cryptomator/cloud-access-swift.git",
"state" : {
"revision" : "cd7a18abcaf09349f066363c7524b738f4f4ad79",
"version" : "1.10.1"
"revision" : "ff48ad0c1c0f8493ef6eeed172752cf0c03b509e",
"version" : "1.11.1"
}
},
{
Expand All @@ -86,8 +95,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/leif-ibsen/Digest",
"state" : {
"revision" : "1202dcb976e481e7c228492c5a8d5159cfa4ea97",
"version" : "1.4.0"
"revision" : "bb5de567a7b109a473ef5fddd3f02f1e5b9e2a41",
"version" : "1.7.0"
}
},
{
Expand Down Expand Up @@ -149,8 +158,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/AzureAD/microsoft-authentication-library-for-objc.git",
"state" : {
"revision" : "9d15d7980a52945dd17ea529bcf4c92f2c0d9a12",
"version" : "1.3.1"
"revision" : "d2f81ded070ac6452b2a6acb5bc45eb566427fe7",
"version" : "1.3.3"
}
},
{
Expand All @@ -176,8 +185,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pCloud/pcloud-sdk-swift.git",
"state" : {
"revision" : "6da4ca6bb4e7068145d9325988e29862d26300ba",
"version" : "3.2.0"
"revision" : "ad1a7d8b3a59f12185d7bc89ff7a1b8c087ed0c0",
"version" : "3.2.2"
}
},
{
Expand All @@ -203,8 +212,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log",
"state" : {
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version" : "1.5.4"
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
},
{
Expand Down Expand Up @@ -239,8 +248,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "b13b1d1a8e787a5ffc71ac19dcaf52183ab27ba2",
"version" : "1.1.1"
"revision" : "bc2a151366f2cd0e347274544933bc2acb00c9fe",
"version" : "1.4.0"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Cryptomator/AddVault/AddVaultSuccessViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private class VaultSuccessFooterView: UITableViewHeaderFooterView {

let text = NSMutableAttributedString(string: LocalizedString.getValue("addVault.success.footer"), attributes: [NSAttributedString.Key.foregroundColor: UIColor.secondaryLabel])
text.append(NSAttributedString(string: " "))
let learnMoreLink = NSAttributedString(string: LocalizedString.getValue("common.footer.learnMore"), attributes: [NSAttributedString.Key.link: URL(string: "https://docs.cryptomator.org/en/1.6/ios/access-vault/#enable-cryptomator-in-files-app")!])
let learnMoreLink = NSAttributedString(string: LocalizedString.getValue("common.footer.learnMore"), attributes: [NSAttributedString.Key.link: URL(string: "https://docs.cryptomator.org/en/latest/ios/access-vault/#enable-cryptomator-in-files-app")!])
text.append(learnMoreLink)
textView.attributedText = text
textView.isUserInteractionEnabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CreateNewVaultCoordinator: AccountListing, CloudChoosing, DefaultShowEditA
}

func start() {
let viewModel = ChooseCloudViewModel(clouds: [.localFileSystem(type: .iCloudDrive), .dropbox, .googleDrive, .oneDrive, .pCloud, .webDAV(type: .custom), .s3(type: .custom), .localFileSystem(type: .custom)], headerTitle: LocalizedString.getValue("addVault.createNewVault.chooseCloud.header"))
let viewModel = ChooseCloudViewModel(clouds: [.localFileSystem(type: .iCloudDrive), .dropbox, .googleDrive, .oneDrive, .pCloud, .box, .webDAV(type: .custom), .s3(type: .custom), .localFileSystem(type: .custom)], headerTitle: LocalizedString.getValue("addVault.createNewVault.chooseCloud.header"))
let chooseCloudVC = ChooseCloudViewController(viewModel: viewModel)
chooseCloudVC.title = LocalizedString.getValue("addVault.createNewVault.title")
chooseCloudVC.coordinator = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class LocalFileSystemAuthenticationInfoFooterViewModel: AttributedTextHeaderFoot
let infoText = LocalizedString.getValue("localFileSystemAuthentication.info.footer")
let text = NSMutableAttributedString(string: infoText)
text.append(NSAttributedString(string: " "))
let learnMoreLink = NSAttributedString(string: LocalizedString.getValue("common.footer.learnMore"), attributes: [NSAttributedString.Key.link: URL(string: "https://docs.cryptomator.org/en/1.6/ios/cloud-management/#other-file-provider")!])
let learnMoreLink = NSAttributedString(string: LocalizedString.getValue("common.footer.learnMore"), attributes: [NSAttributedString.Key.link: URL(string: "https://docs.cryptomator.org/en/latest/ios/cloud-management/#other-file-provider")!])
text.append(learnMoreLink)
super.init(attributedText: text)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OpenExistingVaultCoordinator: AccountListing, CloudChoosing, DefaultShowEd
}

func start() {
let viewModel = ChooseCloudViewModel(clouds: [.localFileSystem(type: .iCloudDrive), .dropbox, .googleDrive, .oneDrive, .pCloud, .webDAV(type: .custom), .s3(type: .custom), .localFileSystem(type: .custom)], headerTitle: LocalizedString.getValue("addVault.openExistingVault.chooseCloud.header"))
let viewModel = ChooseCloudViewModel(clouds: [.localFileSystem(type: .iCloudDrive), .dropbox, .googleDrive, .oneDrive, .pCloud, .box, .webDAV(type: .custom), .s3(type: .custom), .localFileSystem(type: .custom)], headerTitle: LocalizedString.getValue("addVault.openExistingVault.chooseCloud.header"))
let chooseCloudVC = ChooseCloudViewController(viewModel: viewModel)
chooseCloudVC.title = LocalizedString.getValue("addVault.openExistingVault.title")
chooseCloudVC.coordinator = self
Expand Down
1 change: 1 addition & 0 deletions Cryptomator/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
DDLogError("Setting up OneDrive failed with error: \(error)")
}
PCloudSetup.constants = PCloudSetup(appKey: CloudAccessSecrets.pCloudAppKey, sharedContainerIdentifier: nil)
BoxSetup.constants = BoxSetup(clientId: CloudAccessSecrets.boxClientId, clientSecret: CloudAccessSecrets.boxClientSecret, sharedContainerIdentifier: nil)

// Set up payment queue
SKPaymentQueue.default().add(StoreObserver.shared)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
// Copyright © 2021 Skymatic GmbH. All rights reserved.
//

import AuthenticationServices
import CocoaLumberjackSwift
import CryptomatorCommon
import CryptomatorCommonCore
import Foundation
import Promises
import UIKit

class AccountListViewController: ListViewController<AccountCellContent> {
class AccountListViewController: ListViewController<AccountCellContent>, ASWebAuthenticationPresentationContextProviding {
weak var coordinator: (Coordinator & AccountListing)?
private let viewModel: AccountListViewModelProtocol

Expand Down Expand Up @@ -103,6 +105,16 @@ class AccountListViewController: ListViewController<AccountCellContent> {
}
}

// MARK: - ASWebAuthenticationPresentationContextProviding

func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
guard let window = UIApplication.shared.windows.first else {
DDLogInfo("No window could be found as presentation anchor.")
return ASPresentationAnchor()
}
return window
}

// MARK: - Internal

private func handleLogout(_ sender: AccountCellButton) {
Expand Down Expand Up @@ -130,7 +142,7 @@ class AccountListViewController: ListViewController<AccountCellContent> {

private func supportsEditing(_ cloudProviderType: CloudProviderType) -> Bool {
switch cloudProviderType {
case .dropbox, .googleDrive, .localFileSystem, .oneDrive, .pCloud:
case .box, .dropbox, .googleDrive, .localFileSystem, .oneDrive, .pCloud:
return false
case .s3, .webDAV:
return true
Expand Down
51 changes: 34 additions & 17 deletions Cryptomator/Common/CloudAccountList/AccountListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,46 +66,55 @@ class AccountListViewModel: AccountListViewModelProtocol {
}
}

func refreshBoxItems() -> Promise<Void> {
return all(accountInfos
.map { BoxCredential(tokenStorage: BoxTokenStorage(userID: $0.accountUID)) }
.map { self.createAccountCellContent(for: $0) }
).then { accounts in
self.accounts = accounts
}
}

func createAccountCellContent(from accountInfo: AccountInfo) throws -> AccountCellContent {
switch cloudProviderType {
case .box:
return createAccountCellContentPlaceholder()
case .dropbox:
let credential = DropboxCredential(tokenUID: accountInfo.accountUID)
return createAccountCellContentPlaceholder(for: credential)
return createAccountCellContentPlaceholder()
case .googleDrive:
let credential = GoogleDriveCredential(userID: accountInfo.accountUID)
return try createAccountCellContent(for: credential)
case .localFileSystem:
throw AccountListError.unsupportedCloudProviderType
case .oneDrive:
let credential = try OneDriveCredential(with: accountInfo.accountUID)
return try createAccountCellContent(for: credential)
case .pCloud:
let credential = try PCloudCredential(userID: accountInfo.accountUID)
return createAccountCellContentPlaceholder(for: credential)
case .webDAV:
guard let credential = WebDAVCredentialManager.shared.getCredentialFromKeychain(with: accountInfo.accountUID) else {
throw CloudProviderAccountError.accountNotFoundError
}
return createAccountCellContent(for: credential)
case .localFileSystem:
throw AccountListError.unsupportedCloudProviderType
return createAccountCellContentPlaceholder()
case .s3:
guard let credential = S3CredentialManager.shared.getCredential(with: accountInfo.accountUID) else {
throw CloudProviderAccountError.accountNotFoundError
}
let displayName = try S3CredentialManager.shared.getDisplayName(for: credential)
return createAccountCellContent(for: credential, displayName: displayName)
case .webDAV:
guard let credential = WebDAVCredentialManager.shared.getCredentialFromKeychain(with: accountInfo.accountUID) else {
throw CloudProviderAccountError.accountNotFoundError
}
return createAccountCellContent(for: credential)
}
}

private func createAccountCellContentPlaceholder() -> AccountCellContent {
return AccountCellContent(mainLabelText: "(…)", detailLabelText: nil)
}

private func createAccountCellContent(for credential: DropboxCredential) -> Promise<AccountCellContent> {
return credential.getUsername().then { username in
AccountCellContent(mainLabelText: username, detailLabelText: nil)
}
}

private func createAccountCellContentPlaceholder(for credential: DropboxCredential) -> AccountCellContent {
return AccountCellContent(mainLabelText: "(…)", detailLabelText: nil)
}

private func createAccountCellContent(for credential: GoogleDriveCredential) throws -> AccountCellContent {
let username = try credential.getUsername()
return AccountCellContent(mainLabelText: username, detailLabelText: nil)
Expand All @@ -122,8 +131,10 @@ class AccountListViewModel: AccountListViewModelProtocol {
}
}

private func createAccountCellContentPlaceholder(for credential: PCloudCredential) -> AccountCellContent {
return AccountCellContent(mainLabelText: "(…)", detailLabelText: nil)
func createAccountCellContent(for credential: BoxCredential) -> Promise<AccountCellContent> {
return credential.getUsername().then { username in
AccountCellContent(mainLabelText: username, detailLabelText: nil)
}
}

func createAccountCellContent(for credential: WebDAVCredential) -> AccountCellContent {
Expand Down Expand Up @@ -203,6 +214,12 @@ class AccountListViewModel: AccountListViewModelProtocol {
}.catch { error in
self.databaseChangedPublisher.send(.failure(error))
}
} else if self.cloudProviderType == .box {
self.refreshBoxItems().then {
self.databaseChangedPublisher.send(.success(self.accounts))
}.catch { error in
self.databaseChangedPublisher.send(.failure(error))
}
}
})
return databaseChangedPublisher.eraseToAnyPublisher()
Expand Down
Loading

0 comments on commit 59d83fe

Please sign in to comment.