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
[media-library] Refactor to Kotlin 3 - Album migration #14564
Conversation
7eaf56e
to
0fe430b
Compare
0fe430b
to
aae9ecc
Compare
71e3655
to
d1839c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job 🥇
).use { albumCursor -> | ||
if (albumCursor != null && albumCursor.moveToNext()) { | ||
val dataColumnIndex = albumCursor.getColumnIndex(MediaStore.Images.Media.DATA) | ||
val fileInAlbum = File(albumCursor.getString(dataColumnIndex)) | ||
if (fileInAlbum.isFile) { | ||
return File(fileInAlbum.parent ?: return null) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
).use { albumCursor -> | |
if (albumCursor != null && albumCursor.moveToNext()) { | |
val dataColumnIndex = albumCursor.getColumnIndex(MediaStore.Images.Media.DATA) | |
val fileInAlbum = File(albumCursor.getString(dataColumnIndex)) | |
if (fileInAlbum.isFile) { | |
return File(fileInAlbum.parent ?: return null) | |
} | |
} | |
} | |
)?.use { albumCursor -> | |
if (albumCursor.moveToNext()) { | |
val dataColumnIndex = albumCursor.getColumnIndex(MediaStore.Images.Media.DATA) | |
val fileInAlbum = File(albumCursor.getString(dataColumnIndex)) | |
if (fileInAlbum.isFile) { | |
return File(fileInAlbum.parent ?: return null) | |
} | |
} | |
} |
You can remove the null check, but I'm not sure if that looks better 🤷♂️
private val albumDirName: String, | ||
private val promise: Promise | ||
) : AsyncTask<Void?, Void?, Void?>() { | ||
override fun doInBackground(vararg voids: Void?): Void? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do something with that type to make it looks better. If you use a different type here (Unit or Any), you don't have to return null. However, I know, you're going to rewrite that using corutines. So leave it as it's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, no objections
Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines. I've found some issues in your pull request that should be addressed (click on them for more details) 👇
|
Why, How etc...
See #14562 description for details.
This is part of a PR stack:
expo.modules.medialibrary.albums.migration
package