Windows自动跟新

This commit is contained in:
1147192855@qq.com 2024-07-24 17:45:09 +08:00
parent b1c95c0cbd
commit 22d3065892
8 changed files with 24 additions and 22 deletions

View File

@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application <application
android:label="making_school_asignment_app" android:label="点智学"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity

View File

@ -29,7 +29,7 @@
type="application/octet-stream" /> type="application/octet-stream" />
</item> --> </item> -->
<item> <item>
<title>Version 1.0.1</title> <title>Version 1.0.0</title>
#发行说明-读取html方式(2选1) #发行说明-读取html方式(2选1)
<!-- <sparkle:releaseNotesLink> <!-- <sparkle:releaseNotesLink>
https://your_domain/your_path/release_notes.html https://your_domain/your_path/release_notes.html
@ -45,9 +45,9 @@
</description> </description>
<pubDate>Sun, 16 Feb 2022 12:00:00 +0800</pubDate> <pubDate>Sun, 16 Feb 2022 12:00:00 +0800</pubDate>
#你更新程序的地址 #你更新程序的地址
<enclosure url="https://dpc-job-oss.23544.com/infra-app/job/1.0.1/3/making_school_asignment_app-1.0.1+2-windows-setup.exe" <enclosure url="https://dpc-job-oss.23544.com/infra-app/making_school_asignment_app/1.0.0/3/making_school_asignment_app-1.0.0+1-windows-setup.exe"
sparkle:dsaSignature="MEUCIDbfAOA8SB80Hv2oczzYORVr2FF7PjvLZsQF4BTTFPeqAiEAoLQGiqFQekQyV6Xko1U8yM6bl5/lqK6a6poppG6d4x8=" sparkle:dsaSignature="MEUCICOob1N5PNhjRDWh2gHHOuJayep41hP+BMyF26BoYjQLAiEA2dG22KMc2HCQTUyWe1pxWmCJqVmdNQU+Mmfvojg0K2M="
sparkle:version="1.0.1+2" sparkle:version="1.0.0+1"
sparkle:os="windows" sparkle:os="windows"
length="0" length="0"
type="application/octet-stream" /> type="application/octet-stream" />

View File

@ -28,7 +28,7 @@ class AppVersion extends Object {
int ftuType; int ftuType;
@JsonKey(name: 'downloadUrl') @JsonKey(name: 'downloadUrl')
String downloadUrl; String? downloadUrl;
@JsonKey(name: 'description') @JsonKey(name: 'description')
String? description; String? description;
@ -44,7 +44,7 @@ class AppVersion extends Object {
this.downloadUrl, this.downloadUrl,
this.description, this.description,
) { ) {
downloadUrl = RequestConfig.imgUrl + downloadUrl; if (downloadUrl != null) downloadUrl = RequestConfig.imgUrl + downloadUrl!;
} }
factory AppVersion.fromJson(Map<String, dynamic> srcJson) => _$AppVersionFromJson(srcJson); factory AppVersion.fromJson(Map<String, dynamic> srcJson) => _$AppVersionFromJson(srcJson);

View File

@ -169,15 +169,19 @@ class DownloadButton extends StatelessWidget {
final count = logic.downloadRatio.value; final count = logic.downloadRatio.value;
if (count > 0) return Container(); if (count > 0) return Container();
var primaryColor = Theme.of(context).primaryColor; var primaryColor = Theme.of(context).primaryColor;
if (updateAppEvent.equipment == Equipment.windows) {
return SizedBox(
child: quickText('若没有弹出更新弹框可关闭APP重新打开执行更新...', size: 16.sp),
);
}
return Container( return Container(
height: 38.h, height: 38.h,
width: 245.w, width: 245.w,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(42.h)), borderRadius: BorderRadius.all(Radius.circular(42.h)),
gradient: LinearGradient(colors: [ gradient: LinearGradient(colors: [primaryColor, primaryColor.withOpacity(0.7)]),
primaryColor,
primaryColor.withOpacity(0.7),
]),
), ),
child: MaterialButton( child: MaterialButton(
onPressed: () => easyThrottle('DownloadButton_App_Upgrade', duration: const Duration(milliseconds: 1000), () async { onPressed: () => easyThrottle('DownloadButton_App_Upgrade', duration: const Duration(milliseconds: 1000), () async {

View File

@ -33,12 +33,10 @@ class UpgradeLogic extends GetxController with RequestToolMixin {
} else if (Platform.isIOS) { } else if (Platform.isIOS) {
deviceInfo = "ios"; deviceInfo = "ios";
deviceType = 2; deviceType = 2;
} } else if (Platform.isWindows) {
// else if (Platform.isWindows) { deviceInfo = "windows";
// deviceInfo = "windows"; deviceType = 3;
// deviceType = 3; } else {
// }
else {
return; return;
} }
@ -53,7 +51,7 @@ class UpgradeLogic extends GetxController with RequestToolMixin {
// String buildNumber = packageInfo.buildNumber; // // String buildNumber = packageInfo.buildNumber; //
Map json = { Map json = {
'downloadPath': result.downloadUrl, 'downloadPath': Platform.isWindows ? '' : result.downloadUrl,
'version': result.version, 'version': result.version,
'systemType': deviceType, 'systemType': deviceType,
'description': result.description ?? 'APP新版本更新' 'description': result.description ?? 'APP新版本更新'

View File

@ -30,8 +30,8 @@ void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
// Windows // Windows
if(Platform.isWindows){ if (Platform.isWindows) {
String feedURL = '${RequestConfig.imgUrl}infra-app/job/3/appcast.xml'; String feedURL = '${RequestConfig.imgUrl}infra-app/making_school_asignment_app/3/appcast.xml';
await autoUpdater.setFeedURL(feedURL); await autoUpdater.setFeedURL(feedURL);
await autoUpdater.checkForUpdates(); await autoUpdater.checkForUpdates();
await autoUpdater.setScheduledCheckInterval(3600); await autoUpdater.setScheduledCheckInterval(3600);

View File

@ -18,7 +18,7 @@ import 'package:making_school_asignment_app/page/work_page/work_view.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart'; import 'package:making_school_asignment_app/routes/app_pages.dart';
class StartPage extends StatefulWidget { class StartPage extends StatefulWidget {
const StartPage({Key? key}) : super(key: key); const StartPage({super.key});
@override @override
State<StartPage> createState() => _StartPageState(); State<StartPage> createState() => _StartPageState();

View File

@ -3,7 +3,7 @@
app_id: 9EBCC58D-39D5-4A4A-92B6-966DFFD6CA22 app_id: 9EBCC58D-39D5-4A4A-92B6-966DFFD6CA22
publisher: LeanFlutter publisher: LeanFlutter
publisher_url: https://github.com/leanflutter/flutter_distributor publisher_url: https://github.com/leanflutter/flutter_distributor
display_name: 作业批阅 display_name: 点智学
create_desktop_icon: true create_desktop_icon: true
# See: https://jrsoftware.org/ishelp/index.php?topic=setup_defaultdirname # See: https://jrsoftware.org/ishelp/index.php?topic=setup_defaultdirname
# install_dir_name: "D:\\HELLO-WORLD" # install_dir_name: "D:\\HELLO-WORLD"