Skip to content

Commit

Permalink
fix: 更新检查错误 & 每次启动都提示更新信息
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaoMint committed Jul 5, 2023
1 parent 6e308c3 commit 520c2b8
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 6 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
<img align="right" width="300" src="./assets/icon/logo.png" alt="Miru 看板娘"/>

# Miru App

[![License](https://img.shields.io/github/license/miru-project/miru-app)](https://github.com/miru-project/miru-app/blob/main/LICENSE)
[![Stars](https://img.shields.io/github/stars/miru-project/miru-app)](https://github.com/miru-project/miru-app/stargazers)
[![GitHub all releases](https://img.shields.io/github/downloads/miru-project/miru-app/total)](https://github.com/miru-project/miru-app/releases/latest)

## 特性

- 支持 `windows`,`android`,`linux`
- 友好的扩展编写支持、调试日志
- 支持自定义扩展仓库
- 官方扩展仓库提供视频源,无需编写任何扩展即可使用.
- 支持在线观看多种视频、漫画、小说源,实现多平台的统一。
- 统一系统 UI 的设计语言

## 截图

|android|||
|---|---|---|
|![screenshot](assets/screenshot/Screenshot_20230706-001311_Miru.png)| ![screenshot](image.png)| ![screenshot](Screenshot_20230706-001258_Miru.png)|
|![screenshot](assets/screenshot/Screenshot_20230706-001254_Miru.png)| ![screenshot](Screenshot_20230706-001111_Miru.png)
|windows/linux|||
|![screenshot](assets/screenshot/592023059159.png)|![screenshot](assets/screenshot/592023059259.png)|![screenshot](assets/screenshot/592023059359.png)|
|![screenshot](assets/screenshot/592023059559.png)|![screenshot](assets/screenshot/592023059659.png)|![screenshot](assets/screenshot/592023059459.png)
Binary file added Screenshot_20230706-001111_Miru.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot_20230706-001258_Miru.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot/592023059159.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot/592023059259.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot/592023059359.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot/592023059459.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot/592023059559.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot/592023059659.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions lib/pages/main/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ class MainController extends GetxController {
}

// 更新
checkUpdate(BuildContext context) async {
checkUpdate(BuildContext context, {bool showSnackbar = false}) async {
try {
// "https://api.github.com/repos/miru-project/miru-app/releases/latest"
const url =
"https://api.github.com/repos/miru-project/miru-app/releases/latest";
final res = await Dio().get(url);
final remoteVersion = res.data["tag_name"];
final remoteVersion =
(res.data["tag_name"] as String).replaceFirst('v', '');
if (packageInfo.version != remoteVersion) {
if (Platform.isAndroid) {
showDialog(
Expand Down Expand Up @@ -88,6 +89,10 @@ class MainController extends GetxController {
},
);
} else {
if (!showSnackbar) {
return;
}

if (Platform.isAndroid) {
Get.rawSnackbar(
message: '当前已是最新版本',
Expand All @@ -102,13 +107,15 @@ class MainController extends GetxController {
});
}
} catch (e) {
if (!showSnackbar) {
return;
}
if (Platform.isAndroid) {
Get.rawSnackbar(
message: '检查更新失败,网络出现异常',
);
return;
}

fluent.displayInfoBar(context, builder: (context, close) {
return const fluent.InfoBar(
title: Text('检查更新失败,网络出现异常'),
Expand Down
10 changes: 8 additions & 2 deletions lib/pages/settings/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,19 @@ class _SettingsPageState extends State<SettingsPage> {
trailing: PlatformWidget(
androidWidget: TextButton(
onPressed: () {
Get.find<MainController>().checkUpdate(context);
Get.find<MainController>().checkUpdate(
context,
showSnackbar: true,
);
},
child: const Text("检查更新"),
),
desktopWidget: fluent.FilledButton(
onPressed: () {
Get.find<MainController>().checkUpdate(context);
Get.find<MainController>().checkUpdate(
context,
showSnackbar: true,
);
},
child: const Text("检查更新"),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: miru_app
description: A new Flutter project.
publish_to: "none"
version: 1.0.0
version: 1.0.1

environment:
sdk: ">=3.0.3 <4.0.0"
Expand Down

0 comments on commit 520c2b8

Please sign in to comment.