mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 新增无痕播放模式
This commit is contained in:
@@ -17,6 +17,7 @@ class MineController extends GetxController {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box setting = GStrorage.setting;
|
||||
Rx<ThemeType> themeType = ThemeType.system.obs;
|
||||
static bool anonymity = false;
|
||||
|
||||
@override
|
||||
onInit() {
|
||||
@@ -85,6 +86,17 @@ class MineController extends GetxController {
|
||||
userStat.value = UserStat();
|
||||
userInfoCache.delete('userInfoCache');
|
||||
userLogin.value = false;
|
||||
anonymity = false;
|
||||
}
|
||||
|
||||
static onChangeAnonymity() {
|
||||
anonymity = !anonymity;
|
||||
SmartDialog.showToast(anonymity
|
||||
? '已进入全局无痕模式\n\n'
|
||||
'将模拟未登录用户搜索、观看视频或直播,不产生查询与播放记录\n\n'
|
||||
'点赞等其它操作不受影响\n\n'
|
||||
'仅本次启动有效,可随时退出'
|
||||
: '已退出无痕模式');
|
||||
}
|
||||
|
||||
onChangeTheme() {
|
||||
|
||||
@@ -54,6 +54,18 @@ class _MinePageState extends State<MinePage> {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
MineController.onChangeAnonymity();
|
||||
setState(() {});
|
||||
},
|
||||
icon: Icon(
|
||||
MineController.anonymity
|
||||
? Icons.visibility_off_outlined
|
||||
: Icons.visibility_outlined,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => mineController.onChangeTheme(),
|
||||
icon: Icon(
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/interceptor_anonymity.dart';
|
||||
import 'package:pilipala/http/member.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
@@ -64,6 +65,29 @@ class _PrivacySettingState extends State<PrivacySetting> {
|
||||
dense: false,
|
||||
title: Text('刷新access_key', style: titleStyle),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
SmartDialog.show(
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('查看详情'),
|
||||
content: Text(AnonymityInterceptor.anonymityList.join('\n')),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
SmartDialog.dismiss();
|
||||
},
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
dense: false,
|
||||
title: Text('了解无痕模式', style: titleStyle),
|
||||
subtitle: Text('查看无痕模式作用的API列表', style: subTitleStyle),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user