Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Feb 14, 2024
2 parents fc834a7 + 5692775 commit 46b6c5a
Show file tree
Hide file tree
Showing 32 changed files with 1,127 additions and 292 deletions.
Binary file added assets/images/live/default_bg.webp
Binary file not shown.
7 changes: 7 additions & 0 deletions lib/http/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ class Api {
// https://api.bilibili.com/x/relation/tags
static const String followingsClass = '/x/relation/tags';

// 搜索follow
static const followSearch = '/x/relation/followings/search';

// 粉丝
// vmid 用户id pn 页码 ps 每页个数,最大50 order: desc
// order_type 排序规则 最近访问传空,最常访问传 attention
Expand All @@ -230,6 +233,10 @@ class Api {
static const String liveRoomInfo =
'${HttpString.liveBaseUrl}/xlive/web-room/v2/index/getRoomPlayInfo';

// 直播间详情 H5
static const String liveRoomInfoH5 =
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getH5InfoByRoom';

// 用户信息 需要Wbi签名
// https://api.bilibili.com/x/space/wbi/acc/info?mid=503427686&token=&platform=web&web_location=1550101&w_rid=d709892496ce93e3d94d6d37c95bde91&wts=1689301482
static const String memberInfo = '/x/space/wbi/acc/info';
Expand Down
19 changes: 19 additions & 0 deletions lib/http/live.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '../models/live/item.dart';
import '../models/live/room_info.dart';
import '../models/live/room_info_h5.dart';
import 'api.dart';
import 'init.dart';

Expand Down Expand Up @@ -46,4 +47,22 @@ class LiveHttp {
};
}
}

static Future liveRoomInfoH5({roomId, qn}) async {
var res = await Request().get(Api.liveRoomInfoH5, data: {
'room_id': roomId,
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': RoomInfoH5Model.fromJson(res.data['data'])
};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
}
37 changes: 37 additions & 0 deletions lib/http/member.dart
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,41 @@ class MemberHttp {
};
}
}

// 搜索follow
static Future getfollowSearch({
required int mid,
required int ps,
required int pn,
required String name,
}) async {
Map<String, dynamic> data = {
'vmid': mid,
'pn': pn,
'ps': ps,
'order': 'desc',
'order_type': 'attention',
'gaia_source': 'main_web',
'name': name,
'web_location': 333.999,
};
Map params = await WbiSign().makSign(data);
var res = await Request().get(Api.followSearch, data: {
...data,
'w_rid': params['w_rid'],
'wts': params['wts'],
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': FollowDataModel.fromJson(res.data['data'])
};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
}
8 changes: 4 additions & 4 deletions lib/http/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class VideoHttp {
(i['owner'] != null &&
!blackMidsList.contains(i['owner']['mid']))) {
RecVideoItemModel videoItem = RecVideoItemModel.fromJson(i);
if (!RecommendFilter.filter(videoItem)){
if (!RecommendFilter.filter(videoItem)) {
list.add(videoItem);
}
}
Expand Down Expand Up @@ -99,7 +99,7 @@ class VideoHttp {
(i['args'] != null &&
!blackMidsList.contains(i['args']['up_mid']))) {
RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i);
if (!RecommendFilter.filter(videoItem)){
if (!RecommendFilter.filter(videoItem)) {
list.add(videoItem);
}
}
Expand Down Expand Up @@ -218,7 +218,7 @@ class VideoHttp {
List<HotVideoItemModel> list = [];
for (var i in res.data['data']) {
HotVideoItemModel videoItem = HotVideoItemModel.fromJson(i);
if (!RecommendFilter.filter(videoItem, relatedVideos: true)){
if (!RecommendFilter.filter(videoItem, relatedVideos: true)) {
list.add(videoItem);
}
}
Expand Down Expand Up @@ -323,7 +323,7 @@ class VideoHttp {
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {'status': false, 'data': []};
return {'status': false, 'data': [], 'msg': res.data['message']};
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ void main() async {
statusBarColor: Colors.transparent,
));
Data.init();
GStrorage.lazyInit();
PiliSchame.init();
}

Expand Down
130 changes: 130 additions & 0 deletions lib/models/live/room_info_h5.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
class RoomInfoH5Model {
RoomInfoH5Model({
this.roomInfo,
this.anchorInfo,
this.isRoomFeed,
this.watchedShow,
this.likeInfoV3,
this.blockInfo,
});

RoomInfo? roomInfo;
AnchorInfo? anchorInfo;
int? isRoomFeed;
Map? watchedShow;
LikeInfoV3? likeInfoV3;
Map? blockInfo;

RoomInfoH5Model.fromJson(Map<String, dynamic> json) {
roomInfo = RoomInfo.fromJson(json['room_info']);
anchorInfo = AnchorInfo.fromJson(json['anchor_info']);
isRoomFeed = json['is_room_feed'];
watchedShow = json['watched_show'];
likeInfoV3 = LikeInfoV3.fromJson(json['like_info_v3']);
blockInfo = json['block_info'];
}
}

class RoomInfo {
RoomInfo({
this.uid,
this.roomId,
this.title,
this.cover,
this.description,
this.liveStatus,
this.liveStartTime,
this.areaId,
this.areaName,
this.parentAreaId,
this.parentAreaName,
this.online,
this.background,
this.appBackground,
this.liveId,
});

int? uid;
int? roomId;
String? title;
String? cover;
String? description;
int? liveStatus;
int? liveStartTime;
int? areaId;
String? areaName;
int? parentAreaId;
String? parentAreaName;
int? online;
String? background;
String? appBackground;
String? liveId;

RoomInfo.fromJson(Map<String, dynamic> json) {
uid = json['uid'];
roomId = json['room_id'];
title = json['title'];
cover = json['cover'];
description = json['description'];
liveStatus = json['liveS_satus'];
liveStartTime = json['live_start_time'];
areaId = json['area_id'];
areaName = json['area_name'];
parentAreaId = json['parent_area_id'];
parentAreaName = json['parent_area_name'];
online = json['online'];
background = json['background'];
appBackground = json['app_background'];
liveId = json['live_id'];
}
}

class AnchorInfo {
AnchorInfo({
this.baseInfo,
this.relationInfo,
});

BaseInfo? baseInfo;
RelationInfo? relationInfo;

AnchorInfo.fromJson(Map<String, dynamic> json) {
baseInfo = BaseInfo.fromJson(json['base_info']);
relationInfo = RelationInfo.fromJson(json['relation_info']);
}
}

class BaseInfo {
BaseInfo({
this.uname,
this.face,
});

String? uname;
String? face;

BaseInfo.fromJson(Map<String, dynamic> json) {
uname = json['uname'];
face = json['face'];
}
}

class RelationInfo {
RelationInfo({this.attention});

int? attention;

RelationInfo.fromJson(Map<String, dynamic> json) {
attention = json['attention'];
}
}

class LikeInfoV3 {
LikeInfoV3({this.totalLikes});

int? totalLikes;

LikeInfoV3.fromJson(Map<String, dynamic> json) {
totalLikes = json['total_likes'];
}
}
40 changes: 33 additions & 7 deletions lib/pages/about/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:pilipala/http/index.dart';
import 'package:pilipala/models/github/latest.dart';
import 'package:pilipala/utils/utils.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../utils/cache_manage.dart';

class AboutPage extends StatefulWidget {
const AboutPage({super.key});
Expand All @@ -17,6 +18,19 @@ class AboutPage extends StatefulWidget {

class _AboutPageState extends State<AboutPage> {
final AboutController _aboutController = Get.put(AboutController());
String cacheSize = '';

@override
void initState() {
super.initState();
// 读取缓存占用
getCacheSize();
}

Future<void> getCacheSize() async {
final res = await CacheManage().loadApplicationCache();
setState(() => cacheSize = res);
}

@override
Widget build(BuildContext context) {
Expand All @@ -29,18 +43,19 @@ class _AboutPageState extends State<AboutPage> {
),
body: ListView(
children: [
ConstrainedBox(constraints:
const BoxConstraints(
maxHeight: 150),
child:
Image.asset(
ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 150),
child: Image.asset(
'assets/images/logo/logo_android_2.png',
),
),
ListTile(
title: Text('PiliPala',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleMedium!.copyWith(height: 2)),
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(height: 2)),
subtitle: Text(
'使用Flutter开发的哔哩哔哩第三方客户端',
textAlign: TextAlign.center,
Expand Down Expand Up @@ -141,6 +156,17 @@ class _AboutPageState extends State<AboutPage> {
title: const Text('错误日志'),
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
),
ListTile(
onTap: () async {
var cleanStatus = await CacheManage().clearCacheAll();
if (cleanStatus) {
getCacheSize();
}
},
title: const Text('清除缓存'),
subtitle: Text('图片及网络缓存 $cacheSize', style: subTitleStyle),
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
),
],
),
);
Expand Down
Loading

0 comments on commit 46b6c5a

Please sign in to comment.