fix(android): ota_update → url_launcher (résout lStar/compileSdk) → APK signée OK
Build APK / build (push) Successful in 2m33s
Build APK / build (push) Successful in 2m33s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
fac757d9a0
commit
3471c82c61
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user