fix(flutter): update banner false positive + lock-screen control routing
Update banner showing on identical versions:
- pubspec.yaml was stuck at the placeholder 0.1.0+1, so
PackageInfo.version returned "0.1.0" while the server reported the
actual release tag (e.g. "2026.05.10.1"). Comparison correctly said
"newer" → banner always showed.
- Bump pubspec to 2026.05.11.0+1 so the local default matches the
release cadence even before CI overrides it.
- Update flutter.yml release step to pass --build-name="${TAG#v}" so
every tagged APK reports the tag as its PackageInfo.version. Future
releases stop drifting from pubspec.
- Rewrite isVersionNewer to do component-wise int comparison with
zero-padding: pub_semver.Version.parse rejects 4-part date versions
like "2026.05.10.1", at which point the old code fell back to
string inequality and treated "2026.05.10" as newer than itself
vs "2026.05.10.0". Drop the pub_semver import (no longer used).
Lock-screen play/pause not responding:
- PlaybackState only listed MediaAction.seek in systemActions, which
on Android 13+ means tapping the lock-screen play/pause button
doesn't route back to the AudioHandler. Add play, pause,
skipToNext, skipToPrevious to the set.
- Add androidCompactActionIndices: [0, 1, 2] so the compact
notification view explicitly maps the three buttons.
Album art being smaller than the lock-screen frame is upstream of
this commit — the cover-cache writes whatever pixel dimensions the
server returns. If the server's /api/albums/<id>/cover returns small
thumbnails for these albums, the lock screen renders them at that
size. Worth a separate look at the server cover-emit path.
This commit is contained in:
@@ -74,7 +74,15 @@ jobs:
|
|||||||
|
|
||||||
- name: Build release APK
|
- name: Build release APK
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
run: flutter build apk --release
|
# Inject the tag (sans leading 'v') as the build's --build-name
|
||||||
|
# so PackageInfo.version matches what /api/client/version
|
||||||
|
# reports — otherwise the in-app update banner would always
|
||||||
|
# think the user is behind because pubspec.yaml's static
|
||||||
|
# version drifts from the actual release tag.
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
TAG="${GITHUB_REF#refs/tags/v}"
|
||||||
|
flutter build apk --release --build-name="${TAG}"
|
||||||
|
|
||||||
- name: Upload debug APK artifact
|
- name: Upload debug APK artifact
|
||||||
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
|
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
|
||||||
|
|||||||
@@ -250,7 +250,20 @@ class MinstrelAudioHandler extends BaseAudioHandler with QueueHandler, SeekHandl
|
|||||||
if (playing) MediaControl.pause else MediaControl.play,
|
if (playing) MediaControl.pause else MediaControl.play,
|
||||||
MediaControl.skipToNext,
|
MediaControl.skipToNext,
|
||||||
],
|
],
|
||||||
systemActions: const {MediaAction.seek},
|
// androidCompactActionIndices tells the system which controls
|
||||||
|
// appear in the collapsed/lock-screen view. Without this, some
|
||||||
|
// Android versions render the player without working buttons.
|
||||||
|
androidCompactActionIndices: const [0, 1, 2],
|
||||||
|
// systemActions enumerates which actions the system can invoke
|
||||||
|
// on us — without play/pause/skip in here, taps on lock-screen
|
||||||
|
// controls don't route back to the handler on Android 13+.
|
||||||
|
systemActions: const {
|
||||||
|
MediaAction.play,
|
||||||
|
MediaAction.pause,
|
||||||
|
MediaAction.skipToNext,
|
||||||
|
MediaAction.skipToPrevious,
|
||||||
|
MediaAction.seek,
|
||||||
|
},
|
||||||
processingState: switch (_player.processingState) {
|
processingState: switch (_player.processingState) {
|
||||||
ProcessingState.idle => AudioProcessingState.idle,
|
ProcessingState.idle => AudioProcessingState.idle,
|
||||||
ProcessingState.loading => AudioProcessingState.loading,
|
ProcessingState.loading => AudioProcessingState.loading,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'dart:async';
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:pub_semver/pub_semver.dart';
|
|
||||||
|
|
||||||
import '../library/library_providers.dart' show dioProvider;
|
import '../library/library_providers.dart' show dioProvider;
|
||||||
import 'installer.dart';
|
import 'installer.dart';
|
||||||
@@ -50,20 +49,36 @@ class ClientUpdateController extends AsyncNotifier<UpdateInfo?> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// True when `serverVersion` is strictly newer than `installedVersion`.
|
/// True when `serverVersion` is strictly newer than `installedVersion`.
|
||||||
/// Both strings are normalized (leading 'v' stripped) and parsed as
|
///
|
||||||
/// semver. On parse failure, falls back to string inequality (treats
|
/// Comparison strategy: split both strings on `.`, parse each component
|
||||||
/// any difference as "newer" — operator can dismiss if wrong).
|
/// as an int (non-numeric = 0), pad the shorter list with zeros, then
|
||||||
|
/// compare component-wise. This handles our date-style versions
|
||||||
|
/// (2026.05.10.1) which exceed the 3-part semver shape that
|
||||||
|
/// `pub_semver.Version.parse` accepts, and treats "2026.05.10" as
|
||||||
|
/// equal to "2026.05.10.0" rather than "different = newer".
|
||||||
|
///
|
||||||
|
/// Falls back to pub_semver as a secondary attempt when the components
|
||||||
|
/// look semver-like (handles pre-release suffixes, build metadata, etc).
|
||||||
///
|
///
|
||||||
/// Exposed for testing; the polling logic in ClientUpdateController
|
/// Exposed for testing; the polling logic in ClientUpdateController
|
||||||
/// is the only production caller.
|
/// is the only production caller.
|
||||||
bool isVersionNewer(String serverVersion, String installedVersion) {
|
bool isVersionNewer(String serverVersion, String installedVersion) {
|
||||||
final svr = serverVersion.replaceFirst(RegExp(r'^v'), '');
|
List<int> parts(String v) => v
|
||||||
final ins = installedVersion.replaceFirst(RegExp(r'^v'), '');
|
.replaceFirst(RegExp(r'^v'), '')
|
||||||
try {
|
.split('.')
|
||||||
return Version.parse(svr) > Version.parse(ins);
|
.map((p) => int.tryParse(p) ?? 0)
|
||||||
} catch (_) {
|
.toList();
|
||||||
return svr != ins;
|
|
||||||
|
final svr = parts(serverVersion);
|
||||||
|
final ins = parts(installedVersion);
|
||||||
|
final n = svr.length > ins.length ? svr.length : ins.length;
|
||||||
|
while (svr.length < n) svr.add(0);
|
||||||
|
while (ins.length < n) ins.add(0);
|
||||||
|
for (var i = 0; i < n; i++) {
|
||||||
|
if (svr[i] > ins[i]) return true;
|
||||||
|
if (svr[i] < ins[i]) return false;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final clientUpdateProvider =
|
final clientUpdateProvider =
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: minstrel
|
name: minstrel
|
||||||
description: Minstrel mobile client
|
description: Minstrel mobile client
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.1.0+1
|
version: 2026.05.11.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.5.0 <4.0.0'
|
sdk: '>=3.5.0 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user