From 3e066c0a9961e18bb8ab543ded9671f508d9938d Mon Sep 17 00:00:00 2001 From: tajniak81 <13187254+tajniak81@users.noreply.github.com> Date: Thu, 16 Jul 2026 15:32:27 +0200 Subject: [PATCH] Hide bogus duration badges on Album stills MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Album showed durations like -36:35, -136:23 and 545:26 on a Mavic Pro's photos. MediaItem.durationLabel only checked for null, but the SDK fills durationInSeconds for every file, so stills carry junk that was formatted straight into a badge. Require isVideo and a positive duration. Stills now get no badge and nonsense values are rejected; real clips are unaffected. Display-only — durationLabel renders in one place and nothing else reads it. Pre-existing, unrelated to the identity work; spotted while testing the Album against a real aircraft. Co-Authored-By: Claude Opus 4.8 --- Fly App/lib/flight_model.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Fly App/lib/flight_model.dart b/Fly App/lib/flight_model.dart index 7509713..6f6f2cd 100644 --- a/Fly App/lib/flight_model.dart +++ b/Fly App/lib/flight_model.dart @@ -36,9 +36,13 @@ class MediaItem { /// On-disk path of the fully downloaded original, once available. String? localPath; + /// `null` for anything that shouldn't carry a duration. The SDK reports + /// `durationInSeconds` for *every* file, so stills come back with junk — + /// a Mavic Pro's photos yielded -36:35, -136:23 and 545:26 on the SD card. String? get durationLabel { - if (durationSeconds == null) return null; - final int s = durationSeconds!; + if (!isVideo) return null; + final int? s = durationSeconds; + if (s == null || s <= 0) return null; final String mm = (s ~/ 60).toString(); final String ss = (s % 60).toString().padLeft(2, '0'); return '$mm:$ss';