fix(android): ota_update → url_launcher (résout lStar/compileSdk) → APK signée OK
Build APK / build (push) Successful in 2m33s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
neckfire
2026-07-13 09:53:14 +02:00
co-authored by Claude Opus 4.8
parent fac757d9a0
commit 3471c82c61
5 changed files with 81 additions and 26 deletions
+6 -10
View File
@@ -78,19 +78,15 @@ class _ServersScreenState extends State<ServersScreen> {
],
),
);
if (go == true) _applyUpdate(info);
}
void _applyUpdate(UpdateInfo info) {
UpdateService(widget.api.baseUrl).apply(info).listen((_) {}, onError: (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('MAJ échouée : $e')));
}
});
if (go == true) {
final ok = await UpdateService(widget.api.baseUrl).apply(info);
if (mounted && !ok) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Téléchargement de la mise à jour…')),
const SnackBar(content: Text('Impossible d\'ouvrir le téléchargement.')),
);
}
}
}
Future<void> _openSettings() async {
await Navigator.push(context,
+8 -5
View File
@@ -1,11 +1,12 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:ota_update/ota_update.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
/// Vérifie s'il existe une version plus récente (API `/version`) et, si oui,
/// télécharge + installe l'APK (hors Play Store).
/// ouvre l'URL de l'APK (le navigateur télécharge, l'utilisateur installe —
/// robuste, sans dépendance de packaging fragile).
class UpdateService {
UpdateService(this._baseUrl);
final Future<String> _baseUrl;
@@ -30,9 +31,11 @@ class UpdateService {
return null;
}
/// Lance le téléchargement + l'installation ; renvoie le flux de progression.
Stream<OtaEvent> apply(UpdateInfo info) =>
OtaUpdate().execute(info.apkUrl, destinationFilename: 'gamemanager.apk');
Future<bool> apply(UpdateInfo info) async {
final uri = Uri.parse(info.apkUrl);
if (!await canLaunchUrl(uri)) return false;
return launchUrl(uri, mode: LaunchMode.externalApplication);
}
}
class UpdateInfo {
+1 -1
View File
@@ -25,7 +25,7 @@ class AppTheme {
letterSpacing: -0.5,
),
),
cardTheme: CardThemeData(
cardTheme: CardTheme(
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(22)),
elevation: 0,
+64 -8
View File
@@ -187,14 +187,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.15.0"
ota_update:
dependency: "direct main"
description:
name: ota_update
sha256: "8c47531b655f8fcf9961dc7758a933a9ccbcbe1c77a7ec52e5c5cfc2ec367ba7"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
package_info_plus:
dependency: "direct main"
description:
@@ -376,6 +368,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.4.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603"
url: "https://pub.dev"
source: hosted
version: "6.3.1"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
url: "https://pub.dev"
source: hosted
version: "6.3.14"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb"
url: "https://pub.dev"
source: hosted
version: "6.3.3"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
url: "https://pub.dev"
source: hosted
version: "3.2.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
url: "https://pub.dev"
source: hosted
version: "3.2.2"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
url: "https://pub.dev"
source: hosted
version: "3.1.4"
vector_math:
dependency: transitive
description:
+1 -1
View File
@@ -14,7 +14,7 @@ dependencies:
flutter_secure_storage: ^9.2.2
shared_preferences: ^2.3.2
package_info_plus: ^8.1.1
ota_update: ^6.0.0
url_launcher: ^6.3.1
cupertino_icons: ^1.0.8
dev_dependencies: