ComposeActivity: add warning for too big files

main
Alibek Omarov 5 years ago
parent 919c24571d
commit b46037b546
  1. 3
      app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt
  2. 4
      app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt
  3. 1
      app/src/main/res/values/husky.xml

@ -957,6 +957,9 @@ class ComposeActivity : BaseActivity(),
is VideoSizeException -> {
R.string.error_video_upload_size
}
is MediaSizeException -> {
R.string.error_media_upload_size
}
is VideoOrImageException -> {
R.string.error_media_upload_image_or_video
}

@ -64,6 +64,7 @@ interface MediaUploader {
}
class VideoSizeException : Exception()
class MediaSizeException : Exception()
class MediaTypeException : Exception()
class CouldNotOpenFileException : Exception()
@ -129,6 +130,9 @@ class MediaUploaderImpl(
PreparedMedia(QueuedMedia.Type.IMAGE, uri, mediaSize)
}
else -> {
if (mediaSize > videoLimit) {
throw MediaSizeException()
}
PreparedMedia(QueuedMedia.Type.UNKNOWN, uri, mediaSize)
// throw MediaTypeException()
}

@ -9,5 +9,6 @@
<string name="admin">Admin</string>
<string name="moderator">Moderator</string>
<string name="error_media_upload_size">File size exceeds instance limits</string>
</resources>

Loading…
Cancel
Save