Skip to content
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

Add Features + GitHub Actions Workflows + Dependency Manager Contract Files #1

Merged
merged 31 commits into from
Feb 5, 2025

Conversation

OS-ricardomoreirasilva
Copy link
Contributor

@OS-ricardomoreirasilva OS-ricardomoreirasilva commented Jan 15, 2025

Implement the following features:

  • read operations:
    • readEntireFile(atURL:withEncoding:);
    • readFileInChunks(atURL:withEncoding:andChunkSize:);
    • listDirectory(atURL:):
    • getItemAttributes(atPath:);
    • getFileURL(atPath: withSearchPath:);
  • write operations:
    • saveFile(atURL:withEncodingAndData:includeIntermediateDirectories:);
    • appendData(_:atURL:includeIntermediateDirectories:);
  • directory operations:
    • createDirectory(atURL:includeIntermediateDirectories:);
    • removeDirectory(atURL:includeIntermediateDirectories:);
  • file management operations:
    • deleteFile(atURL:);
    • renameItem(fromURL:toURL:);
    • copyItem(fromURL:toURL:).

Add GitHub Actions workflows
Add Podspec file
Add Swift Package Manage file.

Since it's the first feature to be implemented, it includes adding the new files.
Includes a few refactors on create directory to keep structure as similar as possible.
Create a URLFactory that, depending on the current build iOS version, uses the new or current (to be deprecated) version of creating an URL based on a path string.
Refactor existing implementation to use the new method.
Refactor project to make it easier to navigate.
Add new swiftlint disabled rule.
Exchange URLFactory with an extension as there are now 2 methods being used and it makes sense to group it all.
Split OSFLSTFileManagerTests file into different extensions to avoid SwiftLint warnings.
For Xcode 15, 'switch' statements may only be used as expression in return, throw, or as the source of an assignment.
This makes the whole library simpler to use.
Adapt tests accordingly.
Remove redundant code.
Add two missing tests, one for rename and another for copy, where the FileManager fails its operations.
These new values accommodate values required by the Cordova plugin. By having this, the name "SearchPath" doesn't make sense anymore, which justifies its update to DirectoryType.
Add tests for these new types.
Apply some additional refactoring.
rename the old readFile method to readEntireFile for easier separation of concerns.
Byte buffers, since they're Base64 data, need to be encoding in multiple of 3 sizes.
This is added to the OSFILEChunkSubscription flow.
Add unit test to validate scenario.
Adopt the ION name instead of OS.
Update Gemfile bundles.
@OS-ricardomoreirasilva OS-ricardomoreirasilva force-pushed the feat/directory-file-features branch 5 times, most recently from 5742333 to 8422aed Compare January 30, 2025 16:57
@OS-ricardomoreirasilva OS-ricardomoreirasilva force-pushed the feat/directory-file-features branch from 1925027 to a7f98f5 Compare January 30, 2025 17:23
Removed a readFileInChunks test as it proved unreliable for versions below iOS 18.
@OS-ricardomoreirasilva OS-ricardomoreirasilva force-pushed the feat/directory-file-features branch from a7f98f5 to 6048412 Compare January 30, 2025 17:52
@OS-ricardomoreirasilva OS-ricardomoreirasilva changed the title Feat/directory file features Add Features + GitHub Actions Workflows + Dependency Manager Contract Files Jan 31, 2025
@OS-ricardomoreirasilva OS-ricardomoreirasilva marked this pull request as ready for review January 31, 2025 09:37
@alexgerardojacinto
Copy link

alexgerardojacinto commented Jan 31, 2025

Not super important right now, but maybe we can already change the repository name to match the convention we defined? So it would be ion-ios-filesystem

@OS-ricardomoreirasilva
Copy link
Contributor Author

Not super important right now, but maybe we can already change the repository name to match the convention we defined? So it would be ion-ios-filesystem

Done ☑️

This aligns the read methods with the approach already used for write.
IONFilesystemLib/IONFILEChunkPublisher.swift Outdated Show resolved Hide resolved
IONFilesystemLibTests/MockFileManager.swift Outdated Show resolved Hide resolved
IONFilesystemLibTests/IONFILEDirectoryManagerTests.swift Outdated Show resolved Hide resolved
IONFilesystemLib/IONFILEManager.swift Outdated Show resolved Hide resolved
IONFilesystemLib/IONFILEManager.swift Show resolved Hide resolved
IONFilesystemLib/IONFILEManager.swift Outdated Show resolved Hide resolved
IONFilesystemLibTests/IONFILEFileManagerTests.swift Outdated Show resolved Hide resolved
OS-pedrogustavobilro added a commit to ionic-team/ion-android-filesystem that referenced this pull request Jan 31, 2025
Remove the return statement from saveFile.
Align getItemAttributes with the rest of the protocol's methods: to receive a URL instead of a plain-text path.
Add the withSecurityScopedAccess verification to all operations.
Add read file validations to validate the behaviour when the file doesn't exists.
Refactor the code a bit, to remove unnecessary protocol logic.
This introduced a change in the logic so it reverts it.
@OS-ricardomoreirasilva OS-ricardomoreirasilva merged commit 055e50b into development Feb 5, 2025
1 check passed
@OS-ricardomoreirasilva OS-ricardomoreirasilva deleted the feat/directory-file-features branch February 5, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants