From 5df3d7b2eae783ffc0907cbf40cc436546285667 Mon Sep 17 00:00:00 2001 From: Maarten Vercruysse <67873169+MV-GH@users.noreply.github.com> Date: Fri, 8 Mar 2024 16:55:02 +0100 Subject: [PATCH] Fix saving videos (#1429) --- app/src/main/java/com/jerboa/Utils.kt | 4 ++-- .../jerboa/ui/components/imageviewer/ImageViewerActivity.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/jerboa/Utils.kt b/app/src/main/java/com/jerboa/Utils.kt index 56278f03b..2a1fa16cf 100644 --- a/app/src/main/java/com/jerboa/Utils.kt +++ b/app/src/main/java/com/jerboa/Utils.kt @@ -812,7 +812,7 @@ enum class PostType { return when (this) { Image -> Environment.DIRECTORY_PICTURES Video -> Environment.DIRECTORY_MOVIES - Link -> Environment.DIRECTORY_DOCUMENTS + Link -> Environment.DIRECTORY_DOWNLOADS } } } @@ -1453,7 +1453,7 @@ fun Context.getInputStream(url: String): InputStream { val videoRgx = Regex( - pattern = "(http)?s?:?(//[^\"']*\\.(?:mp4|mp3|ogg|flv|m4a|3gp|mkv|mpeg|mov))", + pattern = "(http)?s?:?(//[^\"']*\\.(?:mp4|mp3|ogg|flv|m4a|3gp|mkv|mpeg|mov|webm))", ) fun isVideo(url: String): Boolean { diff --git a/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt b/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt index 4bf41fc9d..d301eaeca 100644 --- a/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt @@ -251,7 +251,7 @@ fun ViewerHeader( IconButton( // TODO disable once it is busy onClick = { - storeMedia(appState.coroutineScope, ctx, url, PostType.Image) + storeMedia(appState.coroutineScope, ctx, url, PostType.fromURL(url)) }, ) { Icon(