mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 00:26:18 +08:00
@@ -156,7 +156,9 @@ class AccountManager extends Interceptor {
|
||||
if (path.startsWith(HttpString.appBaseUrl) || _skipCookie(path)) {
|
||||
return handler.next(response);
|
||||
} else {
|
||||
_saveCookies(response).then((_) => handler.next(response)).catchError(
|
||||
_saveCookies(response)
|
||||
.whenComplete(() => handler.next(response))
|
||||
.catchError(
|
||||
(dynamic e, StackTrace s) {
|
||||
final error = DioException(
|
||||
requestOptions: response.requestOptions,
|
||||
@@ -176,7 +178,9 @@ class AccountManager extends Interceptor {
|
||||
}
|
||||
if (err.response != null &&
|
||||
!err.response!.requestOptions.path.startsWith(HttpString.appBaseUrl)) {
|
||||
_saveCookies(err.response!).then((_) => handler.next(err)).catchError(
|
||||
_saveCookies(err.response!)
|
||||
.whenComplete(() => handler.next(err))
|
||||
.catchError(
|
||||
(dynamic e, StackTrace s) {
|
||||
final error = DioException(
|
||||
requestOptions: err.response!.requestOptions,
|
||||
|
||||
@@ -384,9 +384,7 @@ class PiliScheme {
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: '前往',
|
||||
onPressed: () {
|
||||
_onPushDynDetail(path, off);
|
||||
},
|
||||
onPressed: () => _onPushDynDetail(path, off),
|
||||
icon: const Icon(Icons.open_in_new),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -53,15 +53,13 @@ class DownloadUtils {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: const Text('存储权限未授权'),
|
||||
return const AlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text('存储权限未授权'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
openAppSettings();
|
||||
},
|
||||
child: const Text('去授权'),
|
||||
onPressed: openAppSettings,
|
||||
child: Text('去授权'),
|
||||
)
|
||||
],
|
||||
);
|
||||
@@ -178,9 +176,7 @@ class DownloadUtils {
|
||||
SmartDialog.showLoading(
|
||||
msg: '正在下载原图',
|
||||
clickMaskDismiss: true,
|
||||
onDismiss: () {
|
||||
cancelToken.cancel();
|
||||
},
|
||||
onDismiss: cancelToken.cancel,
|
||||
);
|
||||
try {
|
||||
final isAndroid = Platform.isAndroid;
|
||||
|
||||
@@ -87,6 +87,53 @@ class PageUtils {
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: StatefulBuilder(
|
||||
builder: (_, setState) {
|
||||
void onTap(int choice) {
|
||||
if (choice == -1) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
String duration = '';
|
||||
return AlertDialog(
|
||||
title: const Text('自定义时长'),
|
||||
content: TextField(
|
||||
autofocus: true,
|
||||
onChanged: (value) => duration = value,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'\d+')),
|
||||
],
|
||||
decoration: const InputDecoration(suffixText: 'min'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
int choice = int.tryParse(duration) ?? 0;
|
||||
shutdownTimerService.scheduledExitInMinutes = choice;
|
||||
shutdownTimerService.startShutdownTimer();
|
||||
setState(() {});
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Get.back();
|
||||
shutdownTimerService.scheduledExitInMinutes = choice;
|
||||
shutdownTimerService.startShutdownTimer();
|
||||
}
|
||||
}
|
||||
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return Theme(
|
||||
data: theme,
|
||||
@@ -120,58 +167,7 @@ class PageUtils {
|
||||
].map(
|
||||
(choice) => ListTile(
|
||||
dense: true,
|
||||
onTap: () {
|
||||
if (choice == -1) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
String duration = '';
|
||||
return AlertDialog(
|
||||
title: const Text('自定义时长'),
|
||||
content: TextField(
|
||||
autofocus: true,
|
||||
onChanged: (value) => duration = value,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'\d+')),
|
||||
],
|
||||
decoration: const InputDecoration(
|
||||
suffixText: 'min'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
int choice =
|
||||
int.tryParse(duration) ?? 0;
|
||||
shutdownTimerService
|
||||
.scheduledExitInMinutes = choice;
|
||||
shutdownTimerService
|
||||
.startShutdownTimer();
|
||||
setState(() {});
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Get.back();
|
||||
shutdownTimerService.scheduledExitInMinutes =
|
||||
choice;
|
||||
shutdownTimerService.startShutdownTimer();
|
||||
}
|
||||
},
|
||||
onTap: () => onTap(choice),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(choice == -1
|
||||
? '自定义'
|
||||
|
||||
@@ -536,10 +536,8 @@ class Utils {
|
||||
const SizedBox(height: 8),
|
||||
Text('${res.data[0]['body']}'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
PageUtils.launchURL(
|
||||
'https://github.com/bggRGjQaUbCoE/PiliPlus/commits/main');
|
||||
},
|
||||
onPressed: () => PageUtils.launchURL(
|
||||
'https://github.com/bggRGjQaUbCoE/PiliPlus/commits/main'),
|
||||
child: Text(
|
||||
"点此查看完整更新(即commit)内容",
|
||||
style: TextStyle(
|
||||
@@ -574,9 +572,7 @@ class Utils {
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
onDownload(res.data[0]);
|
||||
},
|
||||
onPressed: () => onDownload(res.data[0]),
|
||||
child: const Text('Github'),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user