diff --git a/lib/common/widgets/video_popup_menu.dart b/lib/common/widgets/video_popup_menu.dart index e520f50a..036e3ea3 100644 --- a/lib/common/widgets/video_popup_menu.dart +++ b/lib/common/widgets/video_popup_menu.dart @@ -262,14 +262,14 @@ class VideoPopupMenu extends StatelessWidget { act: 5, reSrc: 11, ); - List blackMidsList = GStorage.setting - .get(SettingBoxKey.blackMidsList, + List blackMidsList = GStorage.localCache + .get(LocalCacheKey.blackMidsList, defaultValue: [-1]) .map((i) => i as int) .toList(); blackMidsList.insert(0, videoItem.owner.mid); - GStorage.setting - .put(SettingBoxKey.blackMidsList, blackMidsList); + GStorage.localCache + .put(LocalCacheKey.blackMidsList, blackMidsList); Get.back(); SmartDialog.showToast(res['msg'] ?? '成功'); }, diff --git a/lib/http/search.dart b/lib/http/search.dart index 5666ffd9..da3a1125 100644 --- a/lib/http/search.dart +++ b/lib/http/search.dart @@ -9,7 +9,7 @@ import '../utils/storage.dart'; import 'index.dart'; class SearchHttp { - static Box setting = GStorage.setting; + static Box localCache = GStorage.localCache; static Future hotSearchList() async { var res = await Request().get(Api.hotSearchList); if (res.data is String) { @@ -89,8 +89,8 @@ class SearchHttp { try { switch (searchType) { case SearchType.video: - List blackMidsList = setting - .get(SettingBoxKey.blackMidsList, defaultValue: [-1]) + List blackMidsList = localCache + .get(LocalCacheKey.blackMidsList, defaultValue: [-1]) .map((i) => i as int) .toList(); for (var i in res.data['data']['result']) { diff --git a/lib/http/video.dart b/lib/http/video.dart index 324c87ee..8b60638c 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -46,8 +46,8 @@ class VideoHttp { ); if (res.data['code'] == 0) { List list = []; - List blackMidsList = setting - .get(SettingBoxKey.blackMidsList, defaultValue: [-1]) + List blackMidsList = localCache + .get(LocalCacheKey.blackMidsList, defaultValue: [-1]) .map((e) => e as int) .toList(); for (var i in res.data['data']['item']) { @@ -94,8 +94,8 @@ class VideoHttp { ); if (res.data['code'] == 0) { List list = []; - List blackMidsList = setting - .get(SettingBoxKey.blackMidsList, defaultValue: [-1]) + List blackMidsList = localCache + .get(LocalCacheKey.blackMidsList, defaultValue: [-1]) .map((e) => e as int) .toList(); for (var i in res.data['data']['items']) { @@ -128,8 +128,8 @@ class VideoHttp { ); if (res.data['code'] == 0) { List list = []; - List blackMidsList = setting - .get(SettingBoxKey.blackMidsList, defaultValue: [-1]) + List blackMidsList = localCache + .get(LocalCacheKey.blackMidsList, defaultValue: [-1]) .map((e) => e as int) .toList(); for (var i in res.data['data']['list']) { @@ -711,8 +711,8 @@ class VideoHttp { var res = await Request().get(rankApi); if (res.data['code'] == 0) { List list = []; - List blackMidsList = setting - .get(SettingBoxKey.blackMidsList, defaultValue: [-1]) + List blackMidsList = localCache + .get(LocalCacheKey.blackMidsList, defaultValue: [-1]) .map((e) => e as int) .toList(); for (var i in res.data['data']['list']) { diff --git a/lib/pages/blacklist/index.dart b/lib/pages/blacklist/index.dart index d6849b2b..ab3ac402 100644 --- a/lib/pages/blacklist/index.dart +++ b/lib/pages/blacklist/index.dart @@ -22,7 +22,7 @@ class _BlackListPageState extends State { final ScrollController scrollController = ScrollController(); Future? _futureBuilderFuture; bool _isLoadingMore = false; - Box setting = GStorage.setting; + Box localCache = GStorage.localCache; @override void initState() { @@ -46,7 +46,7 @@ class _BlackListPageState extends State { void dispose() { List blackMidsList = _blackListController.blackList.map((e) => e.mid!).toList(); - setting.put(SettingBoxKey.blackMidsList, blackMidsList); + localCache.put(LocalCacheKey.blackMidsList, blackMidsList); scrollController.removeListener(() {}); super.dispose(); } diff --git a/lib/pages/danmaku_block/index.dart b/lib/pages/danmaku_block/index.dart index 56e9e025..7ba9ab4d 100644 --- a/lib/pages/danmaku_block/index.dart +++ b/lib/pages/danmaku_block/index.dart @@ -19,7 +19,7 @@ class _DanmakuBlockPageState extends State { final DanmakuBlockController _danmakuBlockController = Get.put(DanmakuBlockController()); final ScrollController scrollController = ScrollController(); - Box setting = GStorage.setting; + Box localCache = GStorage.localCache; late PlPlayerController plPlayerController; static const Map ruleLabels = { @@ -50,7 +50,7 @@ class _DanmakuBlockPageState extends State { return e.toMap(); }).toList(); print("simpleRuleList:$simpleRuleList"); - setting.put(SettingBoxKey.danmakuFilterRule, simpleRuleList); + localCache.put(LocalCacheKey.danmakuFilterRule, simpleRuleList); plPlayerController.danmakuFilterRule.value = simpleRuleList; scrollController.removeListener(() {}); scrollController.dispose(); diff --git a/lib/pages/setting/recommend_setting.dart b/lib/pages/setting/recommend_setting.dart index 6db53f39..e987be95 100644 --- a/lib/pages/setting/recommend_setting.dart +++ b/lib/pages/setting/recommend_setting.dart @@ -87,45 +87,8 @@ class _RecommendSettingState extends State { ); if (result != null) { if (result == 'app') { - // app端推荐需要access_key if (accessKeyInfo == null) { - if (!userLogin) { - SmartDialog.showToast('请先登录'); - return; - } - // 显示一个确认框,告知用户可能会导致账号被风控 - if (!context.mounted) return; - await showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: const Text('提示'), - content: const Text( - '使用app端推荐需获取access_key,有小概率触发风控导致账号退出(在官方版本app重新登录即可解除),是否继续?'), - actions: [ - TextButton( - onPressed: () { - result = null; - Get.back(); - }, - child: const Text('取消'), - ), - TextButton( - onPressed: () async { - Get.back(); - var res = await MemberHttp.cookieToKey(); - if (res['status']) { - SmartDialog.showToast(res['msg']); - } else { - SmartDialog.showToast( - '获取access_key失败:${res['msg']}'); - } - }, - child: const Text('确定'), - ), - ], - ); - }); + SmartDialog.showToast('尚未登录,无法收到个性化推荐'); } } if (result != null) { diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 037ab5df..acffc0f5 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -129,7 +129,6 @@ class SettingBoxKey { continuePlayInBackground = 'continuePlayInBackground', /// 隐私 - blackMidsList = 'blackMidsList', anonymity = 'anonymity', /// 推荐 @@ -166,7 +165,6 @@ class SettingBoxKey { danmakuDuration = 'danmakuDuration', strokeWidth = 'strokeWidth', fontWeight = 'fontWeight', - danmakuFilterRule = 'danmakuFilterRule', // 代理host port systemProxyHost = 'systemProxyHost', @@ -198,6 +196,11 @@ class SettingBoxKey { class LocalCacheKey { // 历史记录暂停状态 默认false 记录 static const String historyPause = 'historyPause', + + // 隐私设置-黑名单管理 + blackMidsList = 'blackMidsList', + // 弹幕屏蔽规则 + danmakuFilterRule = 'danmakuFilterRule', // access_key accessKey = 'accessKey',