mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
2
.github/workflows/win.yml
vendored
2
.github/workflows/win.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
- name: Upload windows file release
|
- name: Upload windows file release
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: windows-file-release
|
name: windows-release
|
||||||
path: Release
|
path: Release
|
||||||
|
|
||||||
- name: Upload windows setup release
|
- name: Upload windows setup release
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:PiliPlus/http/api.dart';
|
|||||||
import 'package:PiliPlus/http/init.dart';
|
import 'package:PiliPlus/http/init.dart';
|
||||||
import 'package:PiliPlus/http/ua_type.dart';
|
import 'package:PiliPlus/http/ua_type.dart';
|
||||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||||
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/storage.dart';
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
import 'package:PiliPlus/utils/storage_key.dart';
|
import 'package:PiliPlus/utils/storage_key.dart';
|
||||||
@@ -46,6 +47,10 @@ abstract class Update {
|
|||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
final ThemeData theme = Theme.of(context);
|
final ThemeData theme = Theme.of(context);
|
||||||
|
Widget downloadBtn(String text, {String? ext}) => TextButton(
|
||||||
|
onPressed: () => onDownload(res.data[0], ext: ext),
|
||||||
|
child: Text(text),
|
||||||
|
);
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('🎉 发现新版本 '),
|
title: const Text('🎉 发现新版本 '),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
@@ -76,18 +81,19 @@ abstract class Update {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
if (isAuto)
|
||||||
onPressed: () {
|
TextButton(
|
||||||
SmartDialog.dismiss();
|
onPressed: () {
|
||||||
GStorage.setting.put(SettingBoxKey.autoUpdate, false);
|
SmartDialog.dismiss();
|
||||||
},
|
GStorage.setting.put(SettingBoxKey.autoUpdate, false);
|
||||||
child: Text(
|
},
|
||||||
'不再提醒',
|
child: Text(
|
||||||
style: TextStyle(
|
'不再提醒',
|
||||||
color: theme.colorScheme.outline,
|
style: TextStyle(
|
||||||
|
color: theme.colorScheme.outline,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: SmartDialog.dismiss,
|
onPressed: SmartDialog.dismiss,
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -97,10 +103,14 @@ abstract class Update {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
if (Platform.isWindows) ...[
|
||||||
onPressed: () => onDownload(res.data[0]),
|
downloadBtn('zip', ext: 'zip'),
|
||||||
child: const Text('Github'),
|
downloadBtn('exe', ext: 'exe'),
|
||||||
),
|
] else if (Platform.isLinux) ...[
|
||||||
|
downloadBtn('deb', ext: 'deb'),
|
||||||
|
downloadBtn('targz', ext: 'tar.gz'),
|
||||||
|
] else
|
||||||
|
downloadBtn('Github'),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -112,13 +122,15 @@ abstract class Update {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 下载适用于当前系统的安装包
|
// 下载适用于当前系统的安装包
|
||||||
static Future<void> onDownload(Map data) async {
|
static Future<void> onDownload(Map data, {String? ext}) async {
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
try {
|
try {
|
||||||
void download(String plat) {
|
void download(String plat) {
|
||||||
if (data['assets'].isNotEmpty) {
|
if (data['assets'].isNotEmpty) {
|
||||||
for (Map<String, dynamic> i in data['assets']) {
|
for (Map<String, dynamic> i in data['assets']) {
|
||||||
if (i['name'].contains(plat)) {
|
final String name = i['name'];
|
||||||
|
if (name.contains(plat) &&
|
||||||
|
(ext.isNullOrEmpty ? true : name.endsWith(ext!))) {
|
||||||
PageUtils.launchURL(i['browser_download_url']);
|
PageUtils.launchURL(i['browser_download_url']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user