Skip to content

Implement rename function#112

Open
TranceLove wants to merge 2 commits intomainfrom
feature/rename
Open

Implement rename function#112
TranceLove wants to merge 2 commits intomainfrom
feature/rename

Conversation

@TranceLove
Copy link
Collaborator

Summary

Implement rename function for storage providers.

At its initial implementation, no filename duplication checking is implemented since Google allows same filenames even in the same folder. Comments welcomed to see if filename duplication check should be the default.

Manual test OK on Google, Dropbox and Onedrive, using storage-sample app.

Demo

Rename function had been added to storage-sample app.

Screen_recording_20250604_230303.webm

Checklist:

  • Documentation is up to date to reflect these changes
  • Created Unit tests

Signed-off-by: Raymond Lai <airwave209gt@gmail.com>
@TranceLove TranceLove requested a review from Copilot June 4, 2025 15:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds rename support across storage providers, updates documentation, unit tests, and the sample app UI to demonstrate file renaming.

  • Introduce a rename method in the core interface and implement it for Google Drive and Dropbox
  • Add a unit test for Dropbox renaming and update CLI scripts and wrapper properties
  • Extend sample app: new rename dialog, view model logic, events/actions, docs, and README

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/core/.../OmhStorageClient.kt Added abstract rename method and docs
packages/plugin-googledrive-gms/.../GoogleDriveGmsOmhStorageClient.kt Override rename in Google Drive client
packages/plugin-dropbox/.../DropboxFileRepository.kt Add rename method delegation
packages/plugin-dropbox/.../DropboxOmhStorageClient.kt Override rename in Dropbox client
packages/plugin-dropbox/.../DropboxFileRepositoryTest.kt Add unit test for renaming
docs/markdown/getting-started.md Document rename usage
apps/storage-sample/.../strings.xml New strings for rename
apps/storage-sample/.../dialog_rename_file.xml Layout for rename dialog
apps/storage-sample/.../dialog_file_menu.xml Include rename option in file menu
apps/storage-sample/.../rename_outline.xml Icon resource for rename
apps/storage-sample/.../FileViewerViewEvent.kt New RenameFile and RenameFileClicked
apps/storage-sample/.../FileViewerViewAction.kt New ShowRename action
apps/storage-sample/.../FileMenuDialog.kt Wire up rename menu item
apps/storage-sample/.../FileViewerViewModel.kt Handle rename events and dispatch rename
apps/storage-sample/.../FileViewerFragment.kt Show rename dialog and wiring
README.md Update capabilities table with rename
gradlew, gradlew.bat, gradle-wrapper.properties Bump Gradle version and script improvements
Comments suppressed due to low confidence (4)

docs/markdown/getting-started.md:108

  • The client API defines rename(...), not renameFile(...). Update docs to call omhStorageClient.rename(...) for consistency.
val renamedFile = omhStorageClient.renameFile(

packages/plugin-dropbox/src/test/java/com/openmobilehub/android/storage/plugin/dropbox/data/repository/DropboxFileRepositoryTest.kt:1130

  • This test only stubs and verifies repository.rename itself, not the underlying renameFile API call. Consider mocking apiService or invoking the real renameFile implementation to validate correct behavior.
fun `Test renaming a file`() {

apps/storage-sample/src/main/java/com/openmobilehub/android/storage/sample/presentation/file_viewer/model/FileViewerViewAction.kt:24

  • [nitpick] Consider renaming this action to ShowRenameDialog or ShowFileRename to match other Show* actions and clarify its intent.
object ShowRename: FileViewerViewAction()

apps/storage-sample/src/main/java/com/openmobilehub/android/storage/sample/presentation/file_viewer/dialog/menu/FileMenuDialog.kt:110

  • [nitpick] The variable rename shadows the method name and is ambiguous; consider renaming it to renameMenuItem or similar.
rename.icon.setImageResource(R.drawable.rename_outline)

Grammar fix (chore)
Null check before rename dialog pops up

Signed-off-by: Raymond Lai <airwave209gt@gmail.com>
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.

1 participant