OmhStorageClient: add resolvePath() function#106
Conversation
cff8705 to
19a50e0
Compare
There was a problem hiding this comment.
Copilot reviewed 30 out of 33 changed files in this pull request and generated no comments.
Files not reviewed (3)
- apps/storage-sample/src/main/res/layout/fragment_file_viewer.xml: Language not supported
- apps/storage-sample/src/main/res/layout/row_dialog_header.xml: Language not supported
- apps/storage-sample/src/main/res/values/strings.xml: Language not supported
Comments suppressed due to low confidence (1)
packages/plugin-dropbox/src/main/java/com/openmobilehub/android/storage/plugin/dropbox/data/service/DropboxApiService.kt:267
- Ensure that 'node' is definitely one of FolderMetadata or FileMetadata before casting. If an unexpected Metadata type is encountered, consider adding an explicit type check or fallback to avoid a potential ClassCastException.
return (node as? FolderMetadata)?.id ?: (node as FileMetadata).id
|
@TranceLove This looks good. Some nitpicks from Copilot. Could you please address the last comment? Also, could you resolve the conflict in And nevermind my comment about technical debt from the #111. I see you added it to the sample app. Thanks! CC - @itsme291 |
19a50e0 to
42a5ae1
Compare
|
Hey @TranceLove, there's another conflict to be resolved as the about function now includes |
Also updated FileViewer sample app to showcase use of folder size and storage quota information previously submitted. Signed-off-by: Raymond Lai <airwave209gt@gmail.com>
42a5ae1 to
d26a10c
Compare
dzuluaga
left a comment
There was a problem hiding this comment.
Hey @TranceLove, thanks for the PR again. This is looking really good, could you check my last comments before merging? Thank you!
| return apiClient.dropboxApiService.users().spaceUsage | ||
| } | ||
|
|
||
| fun queryNodeIdHaving(path: String): String? { |
There was a problem hiding this comment.
Just a suggestion: would it be possible to simplify queryNodeIdHaving() by using the Dropbox API’s getMetadata() method directly?
Since apiClient.dropboxApiService.files().getMetadata(path) already returns a FileMetadata or FolderMetadata (depending on the path), you might be able to replace the manual traversal logic with something like:
fun queryNodeIdHaving(path: String): String? {
return try {
val metadata = apiClient.dropboxApiService.files().getMetadata(path)
when (metadata) {
is FolderMetadata -> metadata.id
is FileMetadata -> metadata.id
else -> null
}
} catch (e: Exception) {
null
}
}This would still handle files and folders, and gracefully return null if the path doesn’t exist or isn’t accessible. Curious if there’s a specific reason for the manual traversal — maybe to validate intermediate folders?
Let me know what you think!
There was a problem hiding this comment.
Good catch 👍 let's see how this change would work.
- Add slf4j-api as dependency. Should be better than android.util.Log, less reliant on Android classes and gives more flexibility. Not depend on slf4j-android directly except in tests and sample app. - Add debug log statements for path traversal and timing metric checks Signed-off-by: Raymond Lai <airwave209gt@gmail.com>
|
Thanks @TranceLove. Will submit the changes, then we need to publish the assets to Maven central. Stay tuned. |
Summary
Adds
resolvePath()function, to conveniently resolve a folder/file's node ID on cloud storage using their virtual path on the cloud storage.Also updated FileViewer sample app to showcase use of folder size and storage quota information previously submitted in #97 and #98.
Demo
N/A (
resolvePath()usually won't use directly in UI interaction)Checklist: