From e1f5435fccba41b53dee918cb10f5269c0af0a1d Mon Sep 17 00:00:00 2001 From: Jing <42014615+jing332@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:32:05 +0800 Subject: [PATCH] release --- .github/workflows/release.yaml | 30 ++++-------------------------- CHANGELOG.md | 1 + lib/pages/alist/alist.dart | 6 +++--- lib/utils/UpdateChecker.dart | 29 +++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 lib/utils/UpdateChecker.dart diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f894898..30dac03 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -84,11 +84,10 @@ jobs: # 从Secrets读取无换行符Base64解码, 然后保存到到app/key.jks echo ${{ secrets.KEY_STORE }} | base64 --decode > $GITHUB_WORKSPACE/android/app/key.jks - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - id: gradle - run: ./gradlew assembleRelease -build-cache --parallel --daemon --warning-mode all + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.16.7' + - run: flutter build apk --split-per-abi --release - name: Upload missing_rules.txt if: failure() && steps.gradle.outcome != 'success' @@ -101,27 +100,6 @@ jobs: run: | echo "ver_name=$(grep -m 1 'versionName' ${{ env.output }}/output-metadata.json | cut -d\" -f4)" >> $GITHUB_ENV - - name: Upload App To Artifact arm64-v8a - if: success () || failure () - uses: actions/upload-artifact@v3 - with: - name: "AListAndroid-v${{ env.ver_name }}_arm64-v8a" - path: "${{ env.output }}/*-v8a.apk" - - - name: Upload App To Artifact arm-v7a - if: success () || failure () - uses: actions/upload-artifact@v3 - with: - name: "AListAndroid-v${{ env.ver_name }}_arm-v7a" - path: "${{ env.output }}/*-v7a.apk" - - - name: Upload App To Artifact x86 - if: success () || failure () - uses: actions/upload-artifact@v3 - with: - name: "AListAndroid-v${{ env.ver_name }}_x86" - path: "${{ env.output }}/*_x86.apk" - - uses: softprops/action-gh-release@v0.1.15 with: name: ${{ env.ver_name }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..30b81db --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +release \ No newline at end of file diff --git a/lib/pages/alist/alist.dart b/lib/pages/alist/alist.dart index e6f52ef..147a6cb 100644 --- a/lib/pages/alist/alist.dart +++ b/lib/pages/alist/alist.dart @@ -1,5 +1,3 @@ -import 'dart:developer'; - import 'package:alist_flutter/generated_api.dart'; import 'package:alist_flutter/pages/alist/pwd_edit_dialog.dart'; import 'package:alist_flutter/widgets/switch_floating_action_button.dart'; @@ -31,7 +29,9 @@ class AListScreen extends StatelessWidget { showDialog( context: context, builder: (context) => PwdEditDialog(onConfirm: (pwd) { - log("pwd: $pwd"); + Get.showSnackbar(GetSnackBar( + message: "admin 密码修改为:$pwd", + duration: const Duration(seconds: 1))); Android().setAdminPwd(pwd); })); }, diff --git a/lib/utils/UpdateChecker.dart b/lib/utils/UpdateChecker.dart new file mode 100644 index 0000000..d4db379 --- /dev/null +++ b/lib/utils/UpdateChecker.dart @@ -0,0 +1,29 @@ +import 'dart:js_interop_unsafe'; + +import 'package:get/get_connect/http/src/response/response.dart'; + +class UpdateChecker { + static Future checkForUpdate() async { + final version = Android().getVersion + final PackageInfo info = await PackageInfo.fromPlatform(); + final String currentVersion = info.version; + final String url = + 'https://raw.githubusercontent.com/iamSahdeep/liquid_swipe_flutter/master/pubspec.yaml'; + try { + final http.Response response = await http.get(url); + if (response.statusCode == 200) { + final String body = response.body; + final List list = body.split('\n'); + final String latestVersion = list + .firstWhere((String element) => element.contains('version')) + .split(': ')[1]; + if (currentVersion.compareTo(latestVersion) < 0) { + return true; + } + } + } catch (e) { + print(e); + } + return false; + } +} \ No newline at end of file