mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: update request onerror
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
// ignore_for_file: avoid_print
|
||||
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -49,7 +47,9 @@ class ApiInterceptor extends Interceptor {
|
||||
// 屏蔽弹幕、心跳、人数请求的错误提示
|
||||
if (!url.contains('heartbeat') &&
|
||||
!url.contains('seg.so') &&
|
||||
!url.contains('online/total')) {
|
||||
!url.contains('online/total') &&
|
||||
!url.contains('github') &&
|
||||
(!url.contains('skipSegments') && err.requestOptions.method != 'GET')) {
|
||||
SmartDialog.showToast(
|
||||
await dioError(err) + url,
|
||||
displayType: SmartToastType.onlyRefresh,
|
||||
|
||||
@@ -83,7 +83,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
),
|
||||
Obx(
|
||||
() => ListTile(
|
||||
onTap: Utils.checkUpdate,
|
||||
onTap: () => Utils.checkUpdate(false),
|
||||
onLongPress: () =>
|
||||
Utils.copyText(_aboutController.currentVersion.value),
|
||||
title: const Text('当前版本'),
|
||||
|
||||
@@ -1896,7 +1896,7 @@ List<SettingsModel> get extraSettings => [
|
||||
defaultVal: true,
|
||||
onChanged: (val) {
|
||||
if (val) {
|
||||
Utils.checkUpdate();
|
||||
Utils.checkUpdate(false);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'package:PiliPlus/models/common/search_type.dart';
|
||||
import 'package:PiliPlus/pages/home/controller.dart';
|
||||
import 'package:PiliPlus/pages/media/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/group_panel.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/login.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -793,12 +794,14 @@ class Utils {
|
||||
}
|
||||
|
||||
// 检查更新
|
||||
static Future checkUpdate() async {
|
||||
static Future checkUpdate([bool isAuto = true]) async {
|
||||
SmartDialog.dismiss();
|
||||
try {
|
||||
dynamic res = await Request().get(Api.latestApp, extra: {'ua': 'mob'});
|
||||
if (res.data.isEmpty) {
|
||||
SmartDialog.showToast('检查更新失败,GitHub接口未返回数据,请检查网络');
|
||||
if (isAuto.not) {
|
||||
SmartDialog.showToast('检查更新失败,GitHub接口未返回数据,请检查网络');
|
||||
}
|
||||
return;
|
||||
}
|
||||
DateTime latest = DateTime.parse(res.data[0]['created_at']);
|
||||
|
||||
Reference in New Issue
Block a user