Fix: app update issue on MIUI

This commit is contained in:
LollipopKit
2021-11-21 19:36:07 +08:00
parent 89ef2cb95c
commit 9ef59f4c12
4 changed files with 21 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:r_upgrade/r_upgrade.dart';
import 'package:toolbox/core/utils.dart'; import 'package:toolbox/core/utils.dart';
import 'package:toolbox/data/provider/app.dart'; import 'package:toolbox/data/provider/app.dart';
import 'package:toolbox/data/res/build_data.dart'; import 'package:toolbox/data/res/build_data.dart';
@@ -41,6 +42,12 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
update.min > BuildData.build update.min > BuildData.build
? 'Your version is too old. \nPlease update to v1.0.${update.newest}.' ? 'Your version is too old. \nPlease update to v1.0.${update.newest}.'
: 'Update: v1.0.${update.newest} available. \n${update.changelog}', : 'Update: v1.0.${update.newest} available. \n${update.changelog}',
'Update', 'Update', () async {
() => openUrl(Platform.isAndroid ? update.android : update.ios)); if (Platform.isAndroid) {
await RUpgrade.upgrade(update.android,
fileName: update.android.split('/').last, isAutoRequestInstall: true);
} else if (Platform.isIOS) {
showSnackBar(context, const Text('Not support iOS now.'));
}
});
} }

View File

@@ -2,9 +2,8 @@
class BuildData { class BuildData {
static const String name = "ToolBox"; static const String name = "ToolBox";
static const int build = 61; static const int build = 63;
static const String engine = static const String engine = "Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (5 weeks ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n";
"Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (3 weeks ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n"; static const String buildAt = "2021-11-21 19:35:22.997443";
static const String buildAt = "2021-11-05 12:58:33.427838"; static const int modifications = 4;
static const int modifications = 15;
} }

View File

@@ -363,6 +363,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.1" version: "6.0.1"
r_upgrade:
dependency: "direct main"
description:
name: r_upgrade
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.6"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter

View File

@@ -51,6 +51,7 @@ dependencies:
url: https://github.com/LollipopKit/circle_chart url: https://github.com/LollipopKit/circle_chart
ref: main ref: main
clipboard: ^0.1.3 clipboard: ^0.1.3
r_upgrade: ^0.3.6
dev_dependencies: dev_dependencies: