Skip to content

Commit

Permalink
《一些修复》
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Dec 28, 2024
1 parent ac047fb commit 3ddeaa9
Show file tree
Hide file tree
Showing 25 changed files with 293 additions and 217 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ flutter --version
Android相关版本:
> JDK: 21.0.4
> gradle: 8.10.2
> kotlin: 2.0.20
> kotlin: 2.1.0
> minSdk: 21
> targetSdk: 34
> compileSdk: 34
Expand Down
8 changes: 4 additions & 4 deletions lib/common/widgets/video_popup_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ class VideoCustomActions {
act: 5,
reSrc: 11,
);
List<int> blackMidsList = GStorage.localCache
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
List<int> blackMidsList = GStorage.onlineCache
.get(OnlineCacheKey.blackMidsList, defaultValue: [-1])
.map<int>((i) => i as int)
.toList();
blackMidsList.insert(0, videoItem.owner.mid);
GStorage.localCache
.put(LocalCacheKey.blackMidsList, blackMidsList);
GStorage.onlineCache
.put(OnlineCacheKey.blackMidsList, blackMidsList);
Get.back();
SmartDialog.showToast(res['msg'] ?? '成功');
},
Expand Down
9 changes: 6 additions & 3 deletions lib/http/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import '../models/search/hot.dart';
import '../models/search/result.dart';
import '../models/search/suggest.dart';
import '../utils/storage.dart';
import '../utils/wbi_sign.dart';
import 'index.dart';

class SearchHttp {
static Box localCache = GStorage.localCache;
static Box onlineCache = GStorage.onlineCache;
static Future hotSearchList() async {
var res = await Request().get(Api.hotSearchList);
if (res.data is String) {
Expand Down Expand Up @@ -84,14 +85,16 @@ class SearchHttp {
if (order != null) 'order': order,
if (duration != null) 'duration': duration,
};
Map<String, dynamic> params = await WbiSign().makSign(reqData);
reqData.addAll(params);
var res = await Request().get(Api.searchByType, data: reqData);
if (res.data['code'] == 0 && res.data['data']['numPages'] > 0) {
Object data;
try {
switch (searchType) {
case SearchType.video:
List<int> blackMidsList = localCache
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
List<int> blackMidsList = onlineCache
.get(OnlineCacheKey.blackMidsList, defaultValue: [-1])
.map<int>((i) => i as int)
.toList();
for (var i in res.data['data']['result']) {
Expand Down
26 changes: 16 additions & 10 deletions lib/http/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import 'login.dart';
/// view层根据 status 判断渲染逻辑
class VideoHttp {
static Box localCache = GStorage.localCache;
static Box onlineCache = GStorage.onlineCache;
static Box setting = GStorage.setting;
static bool enableRcmdDynamic =
setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
Expand All @@ -48,8 +49,8 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<RecVideoItemModel> list = [];
List<int> blackMidsList = localCache
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
List<int> blackMidsList = onlineCache
.get(OnlineCacheKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['item']) {
Expand Down Expand Up @@ -138,8 +139,8 @@ class VideoHttp {
log(res.data['data'].toString());
if (res.data['code'] == 0) {
List<RecVideoItemAppModel> list = [];
List<int> blackMidsList = localCache
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
List<int> blackMidsList = onlineCache
.get(OnlineCacheKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['items']) {
Expand Down Expand Up @@ -171,8 +172,8 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
List<int> blackMidsList = localCache
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
List<int> blackMidsList = onlineCache
.get(OnlineCacheKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['list']) {
Expand Down Expand Up @@ -266,6 +267,11 @@ class VideoHttp {

// 相关视频
static Future relatedVideoList({required String bvid}) async {
print(
'RecommendFilter.disableRelatedVideos: ${RecommendFilter.disableRelatedVideos}');
if (RecommendFilter.disableRelatedVideos) {
return {'status': true, 'data': []};
}
var res = await Request().get(Api.relatedList, data: {'bvid': bvid});
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
Expand Down Expand Up @@ -778,8 +784,8 @@ class VideoHttp {
var res = await Request().get(rankApi);
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
List<int> blackMidsList = localCache
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
List<int> blackMidsList = onlineCache
.get(OnlineCacheKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['list']) {
Expand All @@ -806,8 +812,8 @@ class VideoHttp {
print("getRegionVideoList: $res");
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
List<int> blackMidsList = localCache
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
List<int> blackMidsList = onlineCache
.get(OnlineCacheKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
print(res.data['data']['archives']);
Expand Down
1 change: 1 addition & 0 deletions lib/pages/about/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class _AboutPageState extends State<AboutPage> {
GStorage.localCache.clear();
GStorage.video.clear();
GStorage.historyWord.clear();
GStorage.onlineCache.clear();
SmartDialog.showToast('重置成功');
},
child: const Text('重置所有数据(含登录信息)'),
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/blacklist/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class _BlackListPageState extends State<BlackListPage> {
final ScrollController scrollController = ScrollController();
Future? _futureBuilderFuture;
bool _isLoadingMore = false;
Box localCache = GStorage.localCache;
Box onlineCache = GStorage.onlineCache;

@override
void initState() {
Expand All @@ -46,7 +46,7 @@ class _BlackListPageState extends State<BlackListPage> {
void dispose() {
List<int> blackMidsList =
_blackListController.blackList.map<int>((e) => e.mid!).toList();
localCache.put(LocalCacheKey.blackMidsList, blackMidsList);
onlineCache.put(OnlineCacheKey.blackMidsList, blackMidsList);
scrollController.removeListener(() {});
super.dispose();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/danmaku_block/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _DanmakuBlockPageState extends State<DanmakuBlockPage> {
final DanmakuBlockController _danmakuBlockController =
Get.put(DanmakuBlockController());
final ScrollController scrollController = ScrollController();
Box localCache = GStorage.localCache;
Box onlineCache = GStorage.onlineCache;
late PlPlayerController plPlayerController;

static const Map<int, String> ruleLabels = {
Expand Down Expand Up @@ -51,7 +51,7 @@ class _DanmakuBlockPageState extends State<DanmakuBlockPage> {
return e.toMap();
}).toList();
print("simpleRuleList:$simpleRuleList");
localCache.put(LocalCacheKey.danmakuFilterRule, simpleRuleList);
onlineCache.put(OnlineCacheKey.danmakuFilterRule, simpleRuleList);
plPlayerController.danmakuFilterRule.value = simpleRuleList;
scrollController.removeListener(() {});
scrollController.dispose();
Expand Down
7 changes: 5 additions & 2 deletions lib/pages/dynamics/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ class _DynamicsPageState extends State<DynamicsPage>

@override
void dispose() {
_dynamicsController.tabController.removeListener(() {});
_dynamicsController.tabController.dispose();
// print('dynamic '
// 'dispose');
// print(StackTrace.current);
// _dynamicsController.tabController.removeListener(() {});
// _dynamicsController.tabController.dispose();
super.dispose();
}

Expand Down
Loading

0 comments on commit 3ddeaa9

Please sign in to comment.