Skip to content

Commit

Permalink
#34 Fix detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Nesterov committed May 2, 2024
1 parent 425c22f commit ccf893d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ internal class FilePickerDelegate {
return@register
}

if (uri.path == null) {
val path = uri.path
if (path == null) {
callback.invoke(Result.failure(java.lang.IllegalStateException("File is null")))
return@register
}
Expand All @@ -50,18 +51,15 @@ internal class FilePickerDelegate {
}
} else null

uri.path?.let { path ->
val file = File(path)
val name = file.name
callback(
Result.success(
FileMedia(
fileNameWithExtension ?: name,
uri.toString(),
)
)
val file = File(path)
val name = file.name
val result = Result.success(
FileMedia(
fileNameWithExtension ?: name,
uri.toString(),
)
}
)
callback.invoke(result)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ internal class MediaPickerControllerImpl(
* (Look here: https://youtrack.jetbrains.com/issue/KT-37331)
*/
override suspend fun pickImage(source: MediaSource, maxWidth: Int, maxHeight: Int): Bitmap {

@Suppress("NewApi")
source.requiredPermissions().forEach { permission ->
permissionsController.providePermission(permission)
}
Expand Down

0 comments on commit ccf893d

Please sign in to comment.