Polish mobile inbox and media flows (#4512)

## Summary

- make mobile unread state visible with bold channel names, an animated
Inbox badge, and swipe-to-toggle Inbox rows
- add directional transitions for top-level mobile navigation
- let mobile send while media uploads, with cancellable progress UI
- normalize iOS and Android video uploads, attach poster frames, and
improve native video playback

## Validation

- `just mobile-check`
- `just mobile-test`
- `cargo test -p buzz-media`
- Pixel smoke test
- iPhone smoke test

Desktop background uploads moved to #4522 so the two platforms can be
reviewed independently.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: leader <71e9f2c44a6932b6772caaaccda1911d010463c3e2c6c40410b8329956046801@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@block.xyz>
This commit is contained in:
klopez4212
2026-08-04 08:05:13 +01:00
committed by GitHub
parent 631b05c883
commit feccf4eabc
79 changed files with 5233 additions and 1929 deletions

View File

@@ -6,6 +6,7 @@ import android.graphics.Canvas
import android.graphics.ColorSpace
import android.graphics.ImageDecoder
import android.media.MediaExtractor
import android.media.MediaMetadataRetriever
import android.media.MediaMuxer
import android.os.Build
import androidx.annotation.RequiresApi
@@ -97,6 +98,9 @@ class MainActivity : FlutterActivity() {
TRANSCODE_VIDEO_TO_MP4_METHOD -> {
handleTranscodeVideoToMp4(call.arguments, result)
}
GENERATE_VIDEO_POSTER_METHOD -> {
handleGenerateVideoPoster(call.arguments, result)
}
REQUIRES_LEGACY_MEDIA_STORAGE_PERMISSION_METHOD -> {
result.success(Build.VERSION.SDK_INT <= Build.VERSION_CODES.P)
}
@@ -275,6 +279,55 @@ class MainActivity : FlutterActivity() {
}.start()
}
private fun handleGenerateVideoPoster(
arguments: Any?,
result: MethodChannel.Result,
) {
val sourcePath = arguments as? String ?: run {
invalidArguments(result, "Expected source file path as String.")
return
}
Thread {
val retriever = MediaMetadataRetriever()
try {
retriever.setDataSource(sourcePath)
val source = retriever.getFrameAtTime(
0,
MediaMetadataRetriever.OPTION_CLOSEST_SYNC,
) ?: retriever.getFrameAtTime(
100_000,
MediaMetadataRetriever.OPTION_CLOSEST_SYNC,
) ?: throw IllegalArgumentException("Unable to decode a video frame.")
val scale = minOf(1f, 720f / maxOf(source.width, source.height))
val frame = if (scale < 1f) {
Bitmap.createScaledBitmap(
source,
(source.width * scale).toInt(),
(source.height * scale).toInt(),
true,
).also { source.recycle() }
} else {
source
}
val bytes = AndroidImageProcessor.encodeAndScrub(
frame,
Bitmap.CompressFormat.JPEG,
) ?: throw IllegalArgumentException("Unable to encode a video preview.")
frame.recycle()
result.success(bytes)
} catch (e: Exception) {
result.error(
"poster_failed",
"Unable to create a video preview.",
e.message,
)
} finally {
retriever.release()
}
}.start()
}
private fun invalidArguments(
result: MethodChannel.Result,
message: String,
@@ -287,6 +340,7 @@ class MainActivity : FlutterActivity() {
private const val SANITIZE_IMAGE_FOR_UPLOAD_METHOD = "sanitizeImageForUpload"
private const val TRANSCODE_IMAGE_TO_JPEG_METHOD = "transcodeImageToJpeg"
private const val TRANSCODE_VIDEO_TO_MP4_METHOD = "transcodeVideoToMp4"
private const val GENERATE_VIDEO_POSTER_METHOD = "generateVideoPoster"
private const val REQUIRES_LEGACY_MEDIA_STORAGE_PERMISSION_METHOD =
"requiresLegacyMediaStoragePermission"
}