Skip to content

Added support for Google Drive Shortcuts#84

Merged
itszechs merged 4 commits intoitszechs:masterfrom
EnArvy:master
Jan 10, 2023
Merged

Added support for Google Drive Shortcuts#84
itszechs merged 4 commits intoitszechs:masterfrom
EnArvy:master

Conversation

@EnArvy
Copy link
Copy Markdown
Contributor

@EnArvy EnArvy commented Jan 8, 2023

No description provided.

} else if (file.isVideoFile) {
launchVideoPlayer(file)
} else if (file.isShortcut) {
if (file.shortcutDetails.targetMimeType == "application/vnd.google-apps.folder") {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Instead of doing this create variables such as here for cleaner code

val isVideoFile = mimeType.startsWith("video/")
val isFolder = mimeType == "application/vnd.google-apps.folder"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made suggested changes. Type safety is a bit messy I suppose, but should work fine due to the logic flow. I have never worked with kotlin or android before, feel free to suggest further changes.

@Keep
data class DriveFile(
val id: String,
var id: String,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I do not understand the purpose of making it non-final.

I can see its used to handle id for shortcuts for which you should rather use Kotlin copy() function and re-assign the id something like file.copy(id=shortcut.id)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made suggested edit.

@EnArvy EnArvy requested a review from itszechs January 10, 2023 15:56

val isShortcutFolder = shortcutDetails.targetMimeType == "application/vnd.google-apps.folder"

val isShortcutVideo = shortcutDetails.targetMimeType?.startsWith("video/")
Copy link
Copy Markdown
Owner

@itszechs itszechs Jan 10, 2023

Choose a reason for hiding this comment

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

Pretty sure isShortcutVideo would return Boolean?. It can be avoided by adding a default false using the elvis operator

@EnArvy EnArvy requested a review from itszechs January 10, 2023 16:23
Copy link
Copy Markdown
Owner

@itszechs itszechs left a comment

Choose a reason for hiding this comment

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

Looks good!

@itszechs itszechs merged commit 3b4edd5 into itszechs:master Jan 10, 2023
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.

2 participants