上传版本号集成在增加版本号脚本中

pull/1/head
张萌 2 years ago
parent 9496071917
commit fd45bfda92

@ -1,4 +1,4 @@
import 'package:aku_app_upgrade/aku_app_upgrade.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -111,6 +111,7 @@ class _SplashPageState extends State<SplashPage> {
// await Permission.locationWhenInUse.request(); // await Permission.locationWhenInUse.request();
// } // }
// //
await AppUpgrade().checkUpgrade(context);
MainInitialize.initJPush(); MainInitialize.initJPush();
EquatableConfig.stringify = true; EquatableConfig.stringify = true;
AMapFlutterLocation.updatePrivacyShow(true, true); AMapFlutterLocation.updatePrivacyShow(true, true);

@ -15,6 +15,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
aku_app_upgrade:
dependency: "direct main"
description:
path: "../aku_app_upgrade"
relative: true
source: path
version: "0.0.1"
amap_flutter_base: amap_flutter_base:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1391,7 +1398,7 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.20" version: "6.1.2"
url_launcher_android: url_launcher_android:
dependency: transitive dependency: transitive
description: description:

@ -86,7 +86,7 @@ dependencies:
amap_flutter_map: ^3.0.0 amap_flutter_map: ^3.0.0
amap_flutter_location: ^3.0.0 amap_flutter_location: ^3.0.0
amap_flutter_base: ^3.0.0 amap_flutter_base: ^3.0.0
# amap_search_fluttify: 0.17.0-dev.0 # amap_search_fluttify: 0.17.0-dev.0
#动态文字 #动态文字
animated_text_kit: ^4.2.1 animated_text_kit: ^4.2.1
#分享功能 #分享功能
@ -117,8 +117,8 @@ dependencies:
scroll_to_index: ^2.1.1 scroll_to_index: ^2.1.1
#验证码自动填充 #验证码自动填充
sms_autofill: ^2.2.0 sms_autofill: ^2.2.0
# #提取图片主色 # #提取图片主色
# palette_generator: ^0.3.2 # palette_generator: ^0.3.2
#音频播放 #音频播放
just_audio: ^0.9.20 just_audio: ^0.9.20
#录音 #录音
@ -131,6 +131,9 @@ dependencies:
sp_util: ^2.0.0 sp_util: ^2.0.0
#系统通知栏消息 #系统通知栏消息
flutter_local_notifications: ^9.5.3+1 flutter_local_notifications: ^9.5.3+1
#app更新
aku_app_upgrade:
path: ../aku_app_upgrade
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -140,7 +143,7 @@ dev_dependencies:
hive_generator: ^1.1.0 hive_generator: ^1.1.0
#脚本工具 #脚本工具
grinder: ^0.9.0 grinder: ^0.9.0
# flutter_native_splash: ^1.1.8+4 # flutter_native_splash: ^1.1.8+4
#model自动生成 #model自动生成
json_serializable: ^6.1.3 json_serializable: ^6.1.3
build_runner: ^2.0.2 build_runner: ^2.0.2

@ -17,6 +17,8 @@ main(args) => grind(args);
@Task('add minor version number') @Task('add minor version number')
void addVersion() async { void addVersion() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -28,10 +30,14 @@ void addVersion() async {
String result = yamlContent.replaceFirst(version, resultVersion.toString()); String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result); await File(yamlPath).writeAsString(result);
stdout.write('version has been add 👍\n');
await uploadVersion(force);
} }
@Task('add path version number') @Task('add path version number')
void addVersionPatch() async { void addVersionPatch() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -43,10 +49,14 @@ void addVersionPatch() async {
String result = yamlContent.replaceFirst(version, resultVersion.toString()); String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result); await File(yamlPath).writeAsString(result);
stdout.write('version has been add 👍');
await uploadVersion(force);
} }
@Task('add major version number') @Task('add major version number')
void addVersionMajor() async { void addVersionMajor() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -58,10 +68,14 @@ void addVersionMajor() async {
String result = yamlContent.replaceFirst(version, resultVersion.toString()); String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result); await File(yamlPath).writeAsString(result);
stdout.write('version has been add 👍');
await uploadVersion(force);
} }
@Task() @Task()
Future<String> getVersion() async { Future<String> getVersion() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -71,14 +85,12 @@ Future<String> getVersion() async {
} }
@Task() @Task()
Future uploadVersion() async { Future uploadVersion(bool force) async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
var version = await getVersion(); var version = await getVersion();
List<String> spVersion = version.split('+'); List<String> spVersion = version.split('+');
stdout.write('版本号:' + spVersion[0]+'\n'); stdout.write('版本号:' + spVersion[0] + '\n');
stdout.write('构建号:' + spVersion[1]+'\n'); stdout.write('构建号:' + spVersion[1] + '\n');
stdout.write('强制更新:' + force.toString()+'\n'); stdout.write('强制更新:' + force.toString() + '\n');
var response = var response =
await Dio().post('http://121.41.26.225:8006/app/version/insert', data: { await Dio().post('http://121.41.26.225:8006/app/version/insert', data: {
'versionNumber': spVersion[0], 'versionNumber': spVersion[0],

Loading…
Cancel
Save