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

Added support for Google Drive Shortcuts #84

Merged
merged 4 commits into from
Jan 10, 2023
Merged

Conversation

EnArvy
Copy link
Contributor

@EnArvy EnArvy commented Jan 8, 2023

No description provided.

@@ -196,6 +196,19 @@ class FilesFragment : BaseFragment() {
findNavController().navigate(action)
} else if (file.isVideoFile) {
launchVideoPlayer(file)
} else if (file.isShortcut) {
if (file.shortcutDetails.targetMimeType == "application/vnd.google-apps.folder") {
Copy link
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
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.

@@ -5,11 +5,12 @@ import zechs.drive.stream.utils.util.Converter

@Keep
data class DriveFile(
val id: String,
var id: String,
Copy link
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
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
@@ -21,5 +21,9 @@ data class DriveFile(

val isShortcut = mimeType == "application/vnd.google-apps.shortcut"

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

val isShortcutVideo = shortcutDetails.targetMimeType?.startsWith("video/")
Copy link
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
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.

None yet

2 participants