当前位置: 首页 > wzjs >正文

网站集群建设的意义网络营销的新特点

网站集群建设的意义,网络营销的新特点,做电影网站需要空间吗,wordpress吾爱因为windows应用一般大家都是从网上下载的,后期版本肯定会更新,那用flutter开发windows应用,怎么实现应用内版本更新功能了?可以使用auto_updater库, 这个插件允许 Flutter 桌面 应用自动更新自己 (基于 sparkle 和 wi…

因为windows应用一般大家都是从网上下载的,后期版本肯定会更新,那用flutter开发windows应用,怎么实现应用内版本更新功能了?可以使用auto_updater库,
这个插件允许 Flutter 桌面 应用自动更新自己 (基于 sparkle 和 winsparkle)
地址如下:

pub仓库地址:auto_updater | Flutter Package
github仓库地址:https://github.com/leanflutter/auto_updater
中文文档地址:https://github.com/leanflutter/auto_updater/blob/main/README-ZH.md

开始使用

先添加依赖,将此添加到你的软件包的 pubspec.yaml 文件:

dependencies:auto_updater: ^0.1.7

windows使用需要安装openssl:

安装教程:windows安装Chocolatey方法注意事项,以及安装openssl方法-CSDN博客 

然后在main.dart中添加下面代码:

import 'package:auto_updater/auto_updater.dart';void main() async {// 必须加上这一行。WidgetsFlutterBinding.ensureInitialized();String feedURL = 'http://localhost:5002/appcast.xml';await autoUpdater.setFeedURL(feedURL);await autoUpdater.checkForUpdates();await autoUpdater.setScheduledCheckInterval(3600);runApp(MyApp());
}

生成私钥

运行以下命令:需要分别在 macOS 和 Windows 系统中运行该命令。

dart run auto_updater:generate_keys

命令将为你生成私钥(dsa_priv.pem)及公钥(dsa_pub.pem),请备份你的私钥并确保其安全,并将公钥作为 Windows 资源添加到项目中。 

macOS运行命令后输出:

A key has been generated and saved in your keychain. Add the `SUPublicEDKey` key to
the Info.plist of each app for which you intend to use Sparkle for distributing
updates. It should appear like this:<key>SUPublicEDKey</key><string>pfIShU4dEXqPd5ObYNfDBiQWcXozk7estwzTnF9BamQ=</string>

更改文件 macos/Runner/Info.plist 如下: 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>...+	<key>SUPublicEDKey</key>
+	<string>bHaXClrRGMmKoKP/3HJnr/jn2ODTRPAM3VZhhkI9ZvY=</string>
</dict>
</plist>

Windows运行命令后输出:

Generated two files:
dsa_priv.pem: your private key. Keep it secret and don't share it!
dsa_pub.pem: public counterpart to include in youe app.
BACK UP YOUR PRIVATE KEY AND KEEP IT SAFE!
If you lose it, your users will be unable to upgrade!

更改文件 windows/runner/Runner.rc 如下:


...+/
+//
+// WinSparkle
+//+// And verify signature using DSA public key:
+DSAPub      DSAPEM      "../../dsa_pub.pem"

打包应用

为了简化打包的过程,这里使用了 Flutter Distributor ,一个专门用于打包和发布 Flutter 应用的完整工具。官方网站:Getting Started | Flutter Distributor

安装flutter_distributor:

#安装命令
dart pub global activate flutter_distributor

安装Inno setup

必须安装Inno Setup 6 并且添加中文语言包,且安装目录要使用默认的C盘里面,否则打包失败。因为Flutter Distributor打包exe是基于inno setup 6实现的,默认官网是英文版本的,打包exe之后点击安装都是英文,所以我找到了中文版的inno setup 6和中文语言包,下载地址如下

Inno Setup 6和中文安装包下载地址:inno setup 带中文包.zip - 蓝奏云

添加distribute_options.yaml添加到你的项目根目录 

output: dist/
releases:- name: devjobs:- name: release-windowspackage:platform: windowstarget: exebuild_args:dart-define:APP_ENV: dev

添加 make_config.yaml 到你的项目 windows/packaging/exe (需要手动创建)目录:

make_config.yaml内容: (安装目录和快捷方式的名字,发布者名称配置等)

# AppId 的值唯一标识此应用。
# 不要在其他应用的安装程序中使用相同的 AppId 值。
# 以下为示例代码,实际根据你的项目进行替换
app_id: 5B566538-42B1-4826-A479-AF079F24A65D
publisher: Jory Cai
display_name: Hello Hado
create_desktop_icon: true
install_dir_name: hado_world
locales:- en- zh

开始生成exe文件:

flutter_distributor package --platform windows --targets exe

编译成功后:

对生成的exe文件进行升级签名:后面的路径要是你自己生成的文件路径

dart run auto_updater:sign_update dist/1.1.1/flutter_windows-1.1.1+1.1.1-windows-setup.exe

签名后的输入要添加到appcast.xml后面的dsaSignature属性里面:

appcast.xml内容:(配置更新版本和更新说明,还有更新文件下载链接等内容)

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"><channel><title>auto_updater_example</title><description>Most recent updates to auto_updater_example</description><language>en</language><item><title>Version 1.1.0</title>#发行说明-读取html方式(2选1)<sparkle:releaseNotesLink>https://your_domain/your_path/release_notes.html</sparkle:releaseNotesLink>#发行说明-写死方式(2选1)<description><![CDATA[<ul><li>1、新增XX功能</li><li>2、新增XX功能</li></ul>]]></description><pubDate>Sun, 16 Feb 2022 12:00:00 +0800</pubDate>#你更新程序的地址<enclosure url="http://wwww.xxx.com/1.1.0+2/auto_updater_example-1.1.0+2-macos.zip"sparkle:edSignature="pbdyPt92pnPkzLfQ7BhS9hbjcV9/ndkzSIlWjFQIUMcaCNbAFO2fzl0tISMNJApG2POTkZY0/kJQ2yZYOSVgAA=="sparkle:version="1.1.0"sparkle:os="macos"length="13400992"type="application/octet-stream" /></item><item><title>Version 1.1.0</title>#发行说明-读取html方式(2选1)<sparkle:releaseNotesLink>https://your_domain/your_path/release_notes.html</sparkle:releaseNotesLink>#发行说明-写死方式(2选1)<description><![CDATA[<ul><li>1、新增XX功能</li><li>2、新增XX功能</li></ul>]]></description><pubDate>Sun, 16 Feb 2022 12:00:00 +0800</pubDate>#你更新程序的地址<enclosure url="http://www.xx.com/1.1.0+2/auto_updater_example-1.1.0+2-windows.exe"sparkle:dsaSignature="MEUCIQCVbVzVID7H3aUzAY5znpi+ySZKznkukV8whlMFzKh66AIgREUGOmvavlcg6hwAwkb2o4IqVE/D56ipIBshIqCH8rk="sparkle:version="1.1.0+2"sparkle:os="windows"length="0"type="application/octet-stream" /></item></channel>
</rss>

新版本更新操作

如果你的程序后续更新了,版本升级了,就修改项目根目录里面的 pubspec.yaml文件版本:

修改完之后,再执行命令重新打包: 

flutter_distributor package --platform windows --targets exe

打包后就会在项目根目录dist下面出现响应版本的exe:

然后运行命令对这个exe进行签名: 

dart run auto_updater:sign_update dist/1.1.0/flutter_windows-1.1.0+1.1.0-windows-setup.exe

将签名后的结果添加到appcast.xml里面:

并且修改appcast.xml里面响应的版本和更新说明:

然后启动历史版本的程序,检查更新:

点击安装更新后:

等待下载完成:点击安装更新

就会杀死现在的进程,然后重新执行安装操作:

http://www.dtcms.com/wzjs/160843.html

相关文章:

  • jsp与asp做的网站晚上国网app
  • 网站建设怎么赚钱宣传推广文案
  • 真人性做爰官方网站磁力多多
  • 深圳外贸营销型网站建设长沙正规竞价优化推荐
  • 三亚兼职招聘信息网站今天疫情最新消息
  • 坪山网站建设多少钱常见的推广平台有哪些
  • 电子商务网站开发工具网络推广吧
  • 网站建设制作fashseo网站系统
  • 个人网站怎么做支付宝接口网站优化外包多少钱
  • 江苏专业做网站的公司品牌营销策略分析
  • 济南哪家公司做网站好百度收录网站链接入口
  • 购物网站排名前十北京seo公司工作
  • 前端开发模板seo关键词排名查询
  • 个人自媒体有哪些平台如何做好关键词的优化
  • 怎么制作网站弹出广告今天最近的新闻
  • 六安做网站seo裂变营销
  • 想做个网站报价蔬菜价格怎么做网上怎么推销自己的产品
  • 引航博景网站做的好吗网站排名优化培训哪家好
  • 做网站还有意义专业网站快速
  • 一年级贺卡制作图片 简单优化公司排行榜
  • 小白一步步做网站关键词优化顾问
  • 上海电商网站建设优化的近义词
  • 网线制作机申泽seo
  • 北京优秀网站建设北京seo网络优化师
  • 网站建设提成方案武汉推广服务
  • 创新网站建设方案书网站优化主要优化哪些地方
  • 购物网站怎么做SEO西安网约车平台
  • 酒店网站建设论文北京百度科技有限公司电话
  • 怎么做发卡网站网站关键词公司
  • 动态网站开发的环境成都百度推广公司联系电话