-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Box support #34
Conversation
WalkthroughThis update enhances the Cryptomator iOS app's integration with Box cloud services. Key features include OAuth authentication, secure token management, and improved file operations through the new Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Actionable comments outside the diff hunks (1)
create-integration-test-secrets-file.sh (1)
Line range hint
3-3
: Replacesource
with.
to improve the portability of the script and ensure compatibility with POSIX sh.- source ./.integration-test-secrets.sh + . ./.integration-test-secrets.sh
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCloudProviderIntegrationTests.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've probably seen that the CI failed: https://github.com/cryptomator/cloud-access-swift/actions/runs/8694502837/job/23843551721
Make sure to fix the formatting issues raised by SwiftFormat and SwiftLint. In the root of the project, I believe you can run:
swiftformat .
swiftlint --fix
If you want, you can also add a pre-commit hook so that you will notice these issues earlier: https://github.com/cryptomator/cloud-access-swift?tab=readme-ov-file#contributing
After that, I'll go through the PR more thoroughly. 😄
# Conflicts: # CryptomatorCloudAccess.xcodeproj/project.pbxproj
# Conflicts: # create-integration-test-secrets-file.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
create-integration-test-secrets-file.sh (1)
Line range hint
3-3
: Replace 'source' with '.' for better POSIX compliance.- source ./.integration-test-secrets.sh + . ./.integration-test-secrets.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All in all, I'm quite happy with the implementation. Just did some minor changes between 79bb7cd...eb9a34d.
This is almost ready for a merge, but I'd like to request updated READMEs (both in the root directory and in the integration tests).
We should make sure that the integration tests work reliably with the current BoxCredentialMock
implementation, which requires an access token and refresh token. I think you mentioned that there are some issues with that? As a fallback, we can require the usage of a developer token, but I'm not that happy with the 60 minutes limitation, to be honest.
Edit: You can try to set expiresIn
to 59
or something lower (I think 60
is the tokenRefreshThreshold
) instead of 3600
, so that the SDK instantly tries to refresh the token. In that case, I would even argue that we don't need to specify an access token, because you'll always get a new access token, similar to the integration tests of Google Drive and OneDrive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
…egrate developer token.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Out of diff range and nitpick comments (1)
create-integration-test-secrets-file.sh (1)
Line range hint
3-3
: Replace 'source' with '.' for POSIX compliance.- source ./.integration-test-secrets.sh + . ./.integration-test-secrets.sh
...oudAccessIntegrationTests/CryptoDecorator/VaultFormat6/VaultFormat6BoxIntegrationTests.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- CryptomatorCloudAccess.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (2 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/BoxIntegrationTests.xcscheme (1 hunks)
Files not reviewed due to errors (2)
- CryptomatorCloudAccess.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (no review received)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/BoxIntegrationTests.xcscheme (no review received)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swift (1 hunks)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (1 hunks)
- Sources/CryptomatorCloudAccess/Box/BoxCredential.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift (1 hunks)
Files not reviewed due to errors (1)
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift (no review received)
Additional context used
Learnings (2)
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift (1)
User: tobihagemann URL: https://github.com/cryptomator/cloud-access-swift/pull/34 Timestamp: 2024-04-16T06:03:14.688Z Learning: The `BoxAuthenticatorError` enum in `BoxAuthenticator.swift` includes a case `invalidContext` for handling scenarios where a `UIViewController` cannot be cast to `ASWebAuthenticationPresentationContextProviding`.
Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swift (1)
User: tobihagemann URL: https://github.com/cryptomator/cloud-access-swift/pull/34 Timestamp: 2024-04-16T06:03:14.688Z Learning: The `BoxAuthenticatorError` enum in `BoxAuthenticator.swift` includes a case `invalidContext` for handling scenarios where a `UIViewController` cannot be cast to `ASWebAuthenticationPresentationContextProviding`.
SwiftLint
Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift
[Warning] 320-320: Function body should span 50 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
[Warning] 382-382: Function body should span 50 lines or less excluding comments and whitespace: currently spans 59 lines (function_body_length)
[Warning] 382-382: Function should have 5 parameters or less: it currently has 7 (function_parameter_count)
Additional comments not posted (1)
Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swift (1)
23-54
: Review ofBoxAuthenticator.authenticate
methodThis method is well-structured and uses modern Swift concurrency features. It correctly handles different error scenarios, including invalid context and login cancellation. The use of
ASWebAuthenticationSessionError
for specific error handling is a good practice. However, ensure that all possible errors from theASWebAuthenticationSession
are handled appropriately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- Tests/CryptomatorCloudAccessIntegrationTests/README.md (2 hunks)
Additional context used
Learnings (1)
Common learnings
User: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
LanguageTool
Tests/CryptomatorCloudAccessIntegrationTests/README.md
[style] ~32-~32: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym. (ENGLISH_WORD_REPEAT_BEGINNING_RULE)
Context: ...on, you have to run that script again. If you are building via a CI system, set t...
Markdownlint
Tests/CryptomatorCloudAccessIntegrationTests/README.md
172-172: null (MD047, single-trailing-newline)
Files should end with a single newline character
Additional comments not posted (3)
Tests/CryptomatorCloudAccessIntegrationTests/README.md (3)
39-41
: Review the new instructions for Box developer tokens.The instructions are clear and emphasize the practicality of using developer tokens for integration tests. Please verify that the external link to the Box OAuth 2.0 Documentation is correct and accessible to ensure users can follow these steps without issues.
Line range hint
32-32
: Consider varying sentence structure.To enhance readability, consider rewording the sentences to avoid repetitive beginnings. This is a minor style improvement that could make the instructions clearer.
Line range hint
172-172
: Add a trailing newline at the end of the file.To comply with Markdown formatting standards, please ensure the file ends with a single newline character.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- CryptomatorCloudAccess.xcodeproj/project.pbxproj (17 hunks)
Additional context used
Learnings (1)
Common learnings
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Additional comments not posted (7)
CryptomatorCloudAccess.xcodeproj/project.pbxproj (7)
189-190
: Integration Tests Added for Box Support.The addition of
VaultFormat7BoxIntegrationTests.swift
andVaultFormat6BoxIntegrationTests.swift
indicates enhanced testing capabilities for Box integration. Ensure these tests cover all necessary scenarios for Box support.
191-193
: Box Source Files Added.The addition of
BoxCredentialMock.swift
,BoxError.swift
, andBoxAuthenticator.swift
enhances the Box integration by providing necessary mocks and error handling. Verify that these files are correctly utilized in the Box integration logic.
421-421
: Box SDK Framework Added.The inclusion of
BoxSdkGen
in the Frameworks section suggests the use of Box SDK functionalities. Ensure compatibility with existing frameworks and verify that it meets the project's requirements.
999-1013
: Box Group Added for Source Organization.The addition of the "Box" group helps organize Box-related source files, improving project structure. Ensure all relevant files are included and correctly referenced within this group.
1014-1022
: Box Group Added for Integration Tests.The addition of the "Box" group for integration tests enhances the organization of test files related to Box. Ensure all relevant test files are included and correctly referenced within this group.
1969-1973
: Box SDK Package Dependency Added.The addition of
BoxSdkGen
as a Swift package dependency indicates its integration into the project. Verify that the package version and configuration align with project requirements.
1883-1890
: Box Swift SDK Remote Package Reference Added.The
box-swift-sdk-gen
package is referenced remotely, with a version requirement specified. Ensure the repository URL is correct and the versioning strategy aligns with project policies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- CryptomatorCloudAccess.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (1 hunks)
Additional context used
Learnings (1)
Common learnings
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Additional comments not posted (1)
CryptomatorCloudAccess.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (1)
30-38
: Addition ofbox-swift-sdk-gen
dependency is consistent.The new entry for the
box-swift-sdk-gen
package has been correctly added with the specified revision and version. Ensure that this package is compatible with the rest of the project dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (12)
- CryptomatorCloudAccess.xcodeproj/project.pbxproj (17 hunks)
- CryptomatorCloudAccess.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (1 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/DropboxIntegrationTests.xcscheme (3 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/GoogleDriveIntegrationTests.xcscheme (3 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/LocalFileSystemIntegrationTests.xcscheme (3 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/OneDriveIntegrationTests.xcscheme (3 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/PCloudIntegrationTests.xcscheme (3 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/S3IntegrationTests.xcscheme (3 hunks)
- CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/WebDAVIntegrationTests.xcscheme (3 hunks)
- Package.resolved (1 hunks)
- Package.swift (3 hunks)
- README.md (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- CryptomatorCloudAccess.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Additional context used
Learnings (1)
Common learnings
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Additional comments not posted (24)
Package.swift (4)
54-54
: Added BoxSdkGen to CryptomatorCloudAccessCore dependencies.Including
BoxSdkGen
in the dependencies ofCryptomatorCloudAccessCore
is essential for Box functionalities. Ensure that all necessary components of the SDK are utilized properly.Verification successful
Integration of BoxSdkGen is verified.
The
BoxSdkGen
package is properly integrated and utilized in theCryptomatorCloudAccessCore
module, as evidenced by its imports in several source files. This confirms the necessity of its inclusion for Box functionalities.
- Files utilizing BoxSdkGen:
Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swift
Sources/CryptomatorCloudAccess/Box/BoxItem.swift
Sources/CryptomatorCloudAccess/Box/BoxCredential.swift
Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of BoxSdkGen in the project. # Test: Check for the usage of BoxSdkGen in the project files. rg --type swift 'BoxSdkGen' -A 5Length of output: 2980
46-46
: Reinstated JOSESwift dependency.Reinstating the JOSESwift dependency suggests a return to handling JSON Web Tokens, which is crucial for secure API interactions. Ensure that this version meets your security and functionality needs.
18-18
: Added Box authenticator source.The addition of
"Box/BoxAuthenticator.swift"
toappExtensionUnsafeSources
is consistent with integrating Box support. Ensure that this source file is correctly implemented and secured.Verification successful
BoxAuthenticator.swift Implementation Verified
The
BoxAuthenticator.swift
file is correctly implemented with a focus on OAuth authentication and error handling. The use ofPromises
and specific error types ensures a structured approach to managing authentication flows. Ensure that the handling of client secrets and token storage remains secure.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence and implementation of BoxAuthenticator.swift. # Test: Check for the existence of BoxAuthenticator.swift. fd BoxAuthenticator.swift # Test: Check for the implementation details of BoxAuthenticator. rg --type swift 'class BoxAuthenticator' -A 10Length of output: 134
Script:
#!/bin/bash # Description: Examine the contents of BoxAuthenticator.swift for implementation details. # Display the first 50 lines of BoxAuthenticator.swift to understand its structure and implementation. head -n 50 Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swiftLength of output: 1836
33-33
: Added Box SDK dependency.The new dependency for Box SDK (
box-swift-sdk-gen
) aligns with the PR's objective to integrate Box Cloud. Verify that the version specified is compatible with your project's requirements.Verification successful
Box SDK Version Compatibility Verified
The specified version constraint for the Box SDK (
box-swift-sdk-gen
) inPackage.swift
is.upToNextMinor(from: "0.3.0")
. There are no conflicting version requirements or constraints found elsewhere in the project. This version range appears to align with the project's needs.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the Box SDK version compatibility. # Test: Check for the specified version in the Package.swift file. rg --type swift 'box-swift-sdk-gen' -A 2Length of output: 638
Script:
#!/bin/bash # Search for any mentions of Box SDK version requirements or constraints in the project documentation and configuration files. rg 'Box SDK|box-swift-sdk-gen' -g '*.md' -g '*.swift' -g '*.config' -A 3Length of output: 921
CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/LocalFileSystemIntegrationTests.xcscheme (3)
25-27
: Added BoxCloudProviderIntegrationTests to skipped tests.The addition of
BoxCloudProviderIntegrationTests
to the skipped tests may indicate that these tests are not ready or are intentionally excluded. Ensure that this is a deliberate decision and consider documenting the reason for skipping.
55-57
: Added VaultFormat6BoxIntegrationTests to skipped tests.The inclusion of
VaultFormat6BoxIntegrationTests
in the skipped tests suggests they are not currently executed. Confirm that this is intentional and consider any potential impacts on test coverage.
76-78
: Added VaultFormat7BoxIntegrationTests to skipped tests.The addition of
VaultFormat7BoxIntegrationTests
to the skipped tests may indicate readiness issues or intentional exclusion. Verify that this is a deliberate choice and consider documenting the rationale.CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/GoogleDriveIntegrationTests.xcscheme (3)
25-27
: Added BoxCloudProviderIntegrationTests to skipped tests.The addition of
BoxCloudProviderIntegrationTests
to the skipped tests may indicate that these tests are not ready or are intentionally excluded. Ensure that this is a deliberate decision and consider documenting the reason for skipping.
55-57
: Added VaultFormat6BoxIntegrationTests to skipped tests.The inclusion of
VaultFormat6BoxIntegrationTests
in the skipped tests suggests they are not currently executed. Confirm that this is intentional and consider any potential impacts on test coverage.
76-78
: Added VaultFormat7BoxIntegrationTests to skipped tests.The addition of
VaultFormat7BoxIntegrationTests
to the skipped tests may indicate readiness issues or intentional exclusion. Verify that this is a deliberate choice and consider documenting the rationale.CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/OneDriveIntegrationTests.xcscheme (3)
25-27
: Added BoxCloudProviderIntegrationTests to skipped tests.The addition of
BoxCloudProviderIntegrationTests
to the skipped tests may indicate that these tests are not ready or are intentionally excluded. Ensure that this is a deliberate decision and consider documenting the reason for skipping.
55-57
: Added VaultFormat6BoxIntegrationTests to skipped tests.The inclusion of
VaultFormat6BoxIntegrationTests
in the skipped tests suggests they are not currently executed. Confirm that this is intentional and consider any potential impacts on test coverage.
76-78
: Added VaultFormat7BoxIntegrationTests to skipped tests.The addition of
VaultFormat7BoxIntegrationTests
to the skipped tests may indicate readiness issues or intentional exclusion. Verify that this is a deliberate choice and consider documenting the rationale.CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/DropboxIntegrationTests.xcscheme (1)
25-27
: Confirm the intention of skipping Box-related tests.The new Box-related tests are added to the
<SkippedTests>
section. Ensure this is intentional and aligns with the current testing strategy.Also applies to: 55-57, 76-78
CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/PCloudIntegrationTests.xcscheme (1)
25-27
: Confirm the intention of skipping Box-related tests.The new Box-related tests are added to the
<SkippedTests>
section. Ensure this is intentional and aligns with the current testing strategy.Also applies to: 55-57, 76-78
CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/WebDAVIntegrationTests.xcscheme (1)
25-27
: Confirm the intention of skipping Box-related tests.The new Box-related tests are added to the
<SkippedTests>
section. Ensure this is intentional and aligns with the current testing strategy.Also applies to: 58-60, 79-81
CryptomatorCloudAccess.xcodeproj/xcshareddata/xcschemes/S3IntegrationTests.xcscheme (1)
25-27
: Confirm the intention of skipping Box-related tests.The new Box-related tests are added to the
<SkippedTests>
section. Ensure this is intentional and aligns with the current testing strategy.Also applies to: 55-57, 76-78
Package.resolved (1)
30-38
: Dependency Addition: Box Swift SDKThe addition of the Box Swift SDK as a remote source control dependency looks correct. Ensure that the version
0.3.0
is compatible with your project's requirements and other dependencies.README.md (1)
72-108
: Documentation Enhancement: Box IntegrationThe new section on Box integration provides a comprehensive guide for setting up and using Box services with clear code examples. This addition significantly improves the usability and developer experience.
CryptomatorCloudAccess.xcodeproj/project.pbxproj (5)
189-200
: Integration Tests and Source Files for BoxThe addition of integration tests and source files for Box, such as
VaultFormat7BoxIntegrationTests.swift
,BoxCredentialMock.swift
, and others, is well-organized. Ensure these files are correctly implemented and tested.
389-399
: New Source Files for BoxThe new source files for Box, including
BoxCloudProvider.swift
andBoxItem.swift
, are correctly added to the project. Verify that these files are implemented according to the project's standards and requirements.
999-1022
: Project Grouping: BoxThe creation of a new group labeled "Box" within the project structure helps in organizing related files. This enhances the maintainability of the project.
1883-1890
: Remote Swift Package Reference: Box Swift SDKThe new remote Swift package reference for
box-swift-sdk-gen
is correctly added. Ensure that this package is compatible with your build environment and other dependencies.
1969-1973
: Swift Package Product Dependency: BoxSdkGenThe addition of
BoxSdkGen
as a product dependency aligns with the integration of the Box SDK. This should facilitate the use of Box services within the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (4)
Sources/CryptomatorCloudAccess/Box/BoxCredential.swift (1)
27-35
: Enhance error handling with detailed logging.Consider adding more detailed logging in error handling blocks to aid in debugging and maintenance.
- pendingPromise.reject(error) + CloudAccessDDLogDebug("Error occurred: \(error.localizedDescription)") + pendingPromise.reject(error)Also applies to: 41-52, 58-65
Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (3)
59-82
: Handle potential errors in file upload logic.The
uploadFile
method includes error handling for file existence and type mismatches. Consider logging more detailed information about the errors for better debugging.- throw CloudProviderError.itemAlreadyExists + CloudAccessDDLogDebug("BoxCloudProvider: uploadFile error - item already exists at \(cloudPath)") + throw CloudProviderError.itemAlreadyExists
486-520
: Error handling in file deletion is comprehensive.The
deleteFile
method includes detailed error handling for various scenarios. Consider adding more specific logging for different error types to aid in troubleshooting.- CloudAccessDDLogDebug("BoxCloudProvider: deleteFile(for: \(item.identifier)) failed with error: \(error.localizedDescription)") + CloudAccessDDLogDebug("BoxCloudProvider: deleteFile error for \(item.identifier) - \(error.localizedDescription)")
631-645
: Path resolution logic is efficient.The
resolvePath
method efficiently resolves cloud paths using the cache. Consider adding logging to trace the path resolution process for debugging purposes.+ CloudAccessDDLogDebug("BoxCloudProvider: Resolving path for item at \(cloudPath)")
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swift (1 hunks)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (1 hunks)
- Sources/CryptomatorCloudAccess/Box/BoxCredential.swift (1 hunks)
- Sources/CryptomatorCloudAccess/Box/BoxItem.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/README.md (1 hunks)
- create-integration-test-secrets-file.sh (1 hunks)
Additional context used
Learnings (5)
Common learnings
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Sources/CryptomatorCloudAccess/Box/BoxItem.swift (1)
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swift (1)
Learnt from: tobihagemann URL: https://github.com/cryptomator/cloud-access-swift/pull/34 Timestamp: 2024-04-16T06:03:14.688Z Learning: The `BoxAuthenticatorError` enum in `BoxAuthenticator.swift` includes a case `invalidContext` for handling scenarios where a `UIViewController` cannot be cast to `ASWebAuthenticationPresentationContextProviding`.
Sources/CryptomatorCloudAccess/Box/BoxCredential.swift (1)
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (1)
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Additional comments not posted (11)
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift (1)
18-25
: Mock class setup is appropriate for testing.The
BoxCredentialMock
class is correctly set up for integration tests. It usesInMemoryTokenStorage
, which is suitable for testing environments.Sources/CryptomatorCloudAccess/Box/BoxItem.swift (1)
13-42
: BoxItem struct is well-implemented for database operations.The
BoxItem
struct is correctly set up to interact with a database using GRDB. It includes necessary initializers and encoding methods for persistence.create-integration-test-secrets-file.sh (1)
20-22
: Integration test secrets script is correctly implemented.The script properly sources environment variables to populate the
IntegrationTestSecrets
enum, which is a standard practice for managing sensitive information in tests.Sources/CryptomatorCloudAccess/Box/BoxAuthenticator.swift (1)
17-45
: BoxAuthenticator implementation is robust with comprehensive error handling.The
BoxAuthenticator
effectively uses Promises and async/await for handling OAuth authentication. Error handling for invalid contexts and user cancellations is well-implemented.Tests/CryptomatorCloudAccessIntegrationTests/README.md (1)
11-13
: Additions for Box integration look good.The new environment variables
BOX_CLIENT_ID
,BOX_CLIENT_SECRET
, andBOX_ENTERPRISE_ID
are correctly added for Box integration. Ensure that users have clear instructions on how to obtain these credentials.Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (6)
14-25
: Constructor implementation is clear and correct.The constructor initializes the
BoxCloudProvider
with necessary dependencies and configurations. The use of default values and validation formaxPageSize
is appropriate.
49-57
: Ensure local file path is valid before proceeding.The
downloadFile
method checks if the local file path is valid and if the file already exists. This is a good practice to prevent overwriting existing files.
382-460
: Chunked upload implementation is efficient.The
chunkedFileUpload
method efficiently handles large file uploads by dividing them into chunks. Ensure that the chunk size and other parameters are configurable for different use cases.Tools
SwiftLint
[Warning] 382-382: Function body should span 50 lines or less excluding comments and whitespace: currently spans 59 lines
(function_body_length)
[Warning] 382-382: Function should have 5 parameters or less: it currently has 7
(function_parameter_count)
462-484
: Folder creation logic is robust.The
createFolder
method correctly handles folder creation and updates the cache. Ensure that any errors during cache updates are logged for debugging purposes.
559-592
: Move file logic is well-implemented.The
moveFile
method handles file movement with appropriate error handling and cache updates. Ensure that the cache invalidation logic is tested thoroughly.
675-717
: Item retrieval logic is clear.The
getBoxItem
method retrieves items from Box with appropriate error handling. Ensure that the logic for handlingnextMarker
is implemented once available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (1 hunks)
- Sources/CryptomatorCloudAccess/Box/BoxCredential.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift
- Sources/CryptomatorCloudAccess/Box/BoxCredential.swift
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift
Additional context used
Learnings (1)
Common learnings
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCloudProviderIntegrationTests.swift (1)
22-30
: Consider handling errors explicitly in test setup.While using
try!
is acceptable in tests, handling errors explicitly can provide clearer error messages and improve maintainability.Consider this approach for future test implementations.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- CryptomatorCloudAccess.xcodeproj/project.pbxproj (20 hunks)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxAuthenticationMock.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCloudProviderIntegrationTests.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift (1 hunks)
- Tests/CryptomatorCloudAccessIntegrationTests/Dropbox/DropboxCredentialMock.swift (1 hunks)
Files skipped from review due to trivial changes (1)
- Tests/CryptomatorCloudAccessIntegrationTests/Dropbox/DropboxCredentialMock.swift
Files skipped from review as they are similar to previous changes (2)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift
- Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCredentialMock.swift
Additional context used
Learnings (2)
Common learnings
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCloudProviderIntegrationTests.swift (1)
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Additional comments not posted (7)
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxAuthenticationMock.swift (1)
12-32
: Ensure mock methods align with expected behavior.The
BoxAuthenticationMock
class provides default implementations for authentication methods. Ensure these methods align with the expected behavior for your tests.If the mock behavior needs to simulate specific scenarios, consider adding logic to reflect those cases.
Tests/CryptomatorCloudAccessIntegrationTests/Box/BoxCloudProviderIntegrationTests.swift (1)
32-35
: Ensure provider setup matches test requirements.The provider setup in
setUpWithError
should align with the specific requirements of your tests. Verify that the mock credentials and provider are correctly configured.Ensure that any changes to the provider setup are reflected in the test logic.
CryptomatorCloudAccess.xcodeproj/project.pbxproj (5)
151-151
: Verify the inclusion ofBoxAuthenticationMock.swift
.Ensure that
BoxAuthenticationMock.swift
is correctly referenced in the project structure and included in the appropriate target.Check that this file is necessary for the integration tests and correctly configured.
Also applies to: 355-355
190-201
: Confirm the addition of Box-related test files.The addition of
VaultFormat7BoxIntegrationTests.swift
andVaultFormat6BoxIntegrationTests.swift
indicates expanded testing for Box integration. Ensure these tests are correctly configured and necessary for your testing strategy.Verify that these tests align with the overall testing objectives for Box integration.
391-401
: Check the organization of Box-related source files.The organization of Box-related files under a new group enhances project structure. Ensure all necessary files are included and correctly referenced.
Confirm that the organization aligns with the project's architectural goals.
1001-1025
: Review the creation of new Box groups.The creation of new groups for Box-related files in both sources and tests improves organization. Ensure these groups are consistent with the project's structure.
Verify that all Box-related functionalities are correctly grouped and accessible.
1163-1163
: Validate the addition of the Box SDK package reference.The addition of
box-swift-sdk-gen
as a package reference is crucial for Box integration. Ensure this package is correctly configured and compatible with the project's requirements.Check for any potential conflicts or issues with other dependencies.
Also applies to: 1887-1894
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift
Additional context used
Learnings (1)
Common learnings
Learnt from: iammajid PR: cryptomator/cloud-access-swift#34 File: Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift:320-320 Timestamp: 2024-06-21T13:51:55.259Z Learning: iammajid prefers to keep the function lengths and parameter counts as they are in the `BoxCloudProvider` for now.
Introduces Box Cloud as a new cloud provider in cloud-access-swift
This PR integrates Box Cloud into the cloud-access-swift framework. It includes the implementation of the CloudProvider functionalities, OAuth2 authentication, addition of necessary credentials, and the creation of integration tests.
All integration tests are running successfully without any errors.