Compare commits
15 Commits
v1.0.16.01
...
feature-ca
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a71798055 | |||
| 7c82193f22 | |||
| f5d928e0f3 | |||
| e0aeefa203 | |||
| d75d560d32 | |||
| 7d9edc5f40 | |||
| 5a337fb145 | |||
| 6983c40f5f | |||
| 50a46aa89d | |||
| e79cd2df25 | |||
| cd2b7c62ee | |||
| 483f02c7d2 | |||
| ec58fbc3cc | |||
| e910f5b7e7 | |||
| 6591d35c74 |
@ -65,13 +65,11 @@
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<data android:scheme="bilibili" android:host="forward" />
|
||||
<data android:scheme="bilibili" android:host="comment"
|
||||
android:pathPattern="/detail/.*/.*/.*" />
|
||||
|
||||
@ -126,6 +126,12 @@ class MyApp extends StatelessWidget {
|
||||
? lightColorScheme
|
||||
: darkColorScheme,
|
||||
useMaterial3: true,
|
||||
snackBarTheme: const SnackBarThemeData(
|
||||
actionTextColor: Colors.white,
|
||||
backgroundColor: Colors.black,
|
||||
contentTextStyle: TextStyle(color: Colors.white),
|
||||
elevation: 20,
|
||||
),
|
||||
),
|
||||
localizationsDelegates: const [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
||||
@ -77,14 +77,14 @@ class Stat {
|
||||
this.danmu,
|
||||
});
|
||||
@HiveField(0)
|
||||
int? view;
|
||||
String? view;
|
||||
@HiveField(1)
|
||||
int? like;
|
||||
@HiveField(2)
|
||||
int? danmu;
|
||||
|
||||
Stat.fromJson(Map<String, dynamic> json) {
|
||||
view = json["view"];
|
||||
view = Utils.numFormat(json["view"]);
|
||||
like = json["like"];
|
||||
danmu = json['danmaku'];
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class StatAdapter extends TypeAdapter<Stat> {
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return Stat(
|
||||
view: fields[0] as int?,
|
||||
view: fields[0] as String?,
|
||||
like: fields[1] as int?,
|
||||
danmu: fields[2] as int?,
|
||||
);
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/search.dart';
|
||||
|
||||
// 富文本
|
||||
InlineSpan richNode(item, context) {
|
||||
@ -191,6 +193,39 @@ InlineSpan richNode(item, context) {
|
||||
),
|
||||
);
|
||||
}
|
||||
// 投稿
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_BV') {
|
||||
spanChilds.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Icon(
|
||||
Icons.play_circle_outline_outlined,
|
||||
size: 16,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
spanChilds.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
try {
|
||||
int cid = await SearchHttp.ab2c(bvid: i.rid);
|
||||
Get.toNamed('/video?bvid=${i.rid}&cid=$cid',
|
||||
arguments: {'pic': null, 'heroTag': i.rid});
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'${i.text} ',
|
||||
style: authorStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// if (contentType == 'major' &&
|
||||
// item.modules.moduleDynamic.major.opus.pics.isNotEmpty) {
|
||||
|
||||
@ -43,7 +43,7 @@ class _SearchPanelState extends State<SearchPanel>
|
||||
keyword: widget.keyword,
|
||||
searchType: widget.searchType,
|
||||
),
|
||||
tag: widget.searchType!.type,
|
||||
tag: widget.searchType!.type + widget.keyword!,
|
||||
);
|
||||
scrollController = _searchPanelController.scrollController;
|
||||
scrollController.addListener(() async {
|
||||
@ -74,36 +74,48 @@ class _SearchPanelState extends State<SearchPanel>
|
||||
future: _futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
Map data = snapshot.data;
|
||||
var ctr = _searchPanelController;
|
||||
RxList list = ctr.resultList;
|
||||
if (data['status']) {
|
||||
return Obx(() {
|
||||
switch (widget.searchType) {
|
||||
case SearchType.video:
|
||||
return SearchVideoPanel(
|
||||
ctr: _searchPanelController,
|
||||
// ignore: invalid_use_of_protected_member
|
||||
list: list.value,
|
||||
);
|
||||
case SearchType.media_bangumi:
|
||||
return searchMbangumiPanel(context, ctr, list);
|
||||
case SearchType.bili_user:
|
||||
return searchUserPanel(context, ctr, list);
|
||||
case SearchType.live_room:
|
||||
return searchLivePanel(context, ctr, list);
|
||||
case SearchType.article:
|
||||
return searchArticlePanel(context, ctr, list);
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
});
|
||||
if (snapshot.data != null) {
|
||||
Map data = snapshot.data;
|
||||
var ctr = _searchPanelController;
|
||||
RxList list = ctr.resultList;
|
||||
if (data['status']) {
|
||||
return Obx(() {
|
||||
switch (widget.searchType) {
|
||||
case SearchType.video:
|
||||
return SearchVideoPanel(
|
||||
ctr: _searchPanelController,
|
||||
// ignore: invalid_use_of_protected_member
|
||||
list: list.value,
|
||||
);
|
||||
case SearchType.media_bangumi:
|
||||
return searchMbangumiPanel(context, ctr, list);
|
||||
case SearchType.bili_user:
|
||||
return searchUserPanel(context, ctr, list);
|
||||
case SearchType.live_room:
|
||||
return searchLivePanel(context, ctr, list);
|
||||
case SearchType.article:
|
||||
return searchArticlePanel(context, ctr, list);
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return CustomScrollView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () => setState(() {}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return CustomScrollView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
HttpError(
|
||||
errMsg: data['msg'],
|
||||
errMsg: '没有相关数据',
|
||||
fn: () => setState(() {}),
|
||||
),
|
||||
],
|
||||
|
||||
@ -411,8 +411,12 @@ class VideoIntroController extends GetxController {
|
||||
content: Text(currentStatus == 0 ? '关注UP主?' : '取消关注UP主?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => SmartDialog.dismiss(),
|
||||
child: const Text('点错了')),
|
||||
onPressed: () => SmartDialog.dismiss(),
|
||||
child: Text(
|
||||
'点错了',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
var result = await VideoHttp.relationMod(
|
||||
|
||||
@ -628,9 +628,16 @@ InlineSpan buildContent(
|
||||
// 匹配@用户
|
||||
String matchMember = str;
|
||||
if (content.atNameToMid.isNotEmpty) {
|
||||
RegExp reg = RegExp(r"@.*( |:)");
|
||||
if (content.atNameToMid.length == 1 &&
|
||||
content.message == '@${content.members.first.uname}') {
|
||||
List atNameToMidKeys = content.atNameToMid.keys.toList();
|
||||
RegExp reg = RegExp(atNameToMidKeys.map((key) => key).join('|'));
|
||||
// if (!content.message.contains(':')) {
|
||||
// reg = RegExp(r"@.*( |:)");
|
||||
// }
|
||||
|
||||
// 只@用户没有内容
|
||||
if (!content.message.contains(':') ||
|
||||
(content.atNameToMid.length == 1 &&
|
||||
content.message == '@${content.members.first.uname}')) {
|
||||
reg = RegExp(r"@.*( |:|$)");
|
||||
}
|
||||
matchMember = str.splitMapJoin(
|
||||
@ -639,9 +646,20 @@ InlineSpan buildContent(
|
||||
if (match[0] != null) {
|
||||
hasMatchMember = false;
|
||||
content.atNameToMid.forEach((key, value) {
|
||||
if (str.contains('回复')) {
|
||||
spanChilds.add(
|
||||
TextSpan(
|
||||
text: '回复 ',
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
spanChilds.add(
|
||||
TextSpan(
|
||||
text: '@$key ',
|
||||
text: '@$key',
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||
@ -681,6 +699,12 @@ InlineSpan buildContent(
|
||||
if (i.contains('?')) {
|
||||
urlKeys[index] = i.replaceAll('?', '\\?');
|
||||
}
|
||||
if (i.contains('+')) {
|
||||
urlKeys[index] = i.replaceAll('+', '\\+');
|
||||
}
|
||||
if (i.contains('*')) {
|
||||
urlKeys[index] = i.replaceAll('*', '\\*');
|
||||
}
|
||||
}
|
||||
matchUrl = matchMember.splitMapJoin(
|
||||
/// RegExp.escape() 转义特殊字符
|
||||
|
||||
@ -294,7 +294,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(0),
|
||||
child: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.background,
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
),
|
||||
),
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class ChatItem extends StatelessWidget {
|
||||
dynamic item;
|
||||
@ -14,7 +15,7 @@ class ChatItem extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool isOwner = item.senderUid == 17340771;
|
||||
bool isOwner = item.senderUid == GStrorage.userInfo.get('userInfoCache').mid;
|
||||
bool isPic = item.msgType == 2; // 图片
|
||||
bool isText = item.msgType == 1; // 文本
|
||||
bool isAchive = item.msgType == 11; // 投稿
|
||||
|
||||
@ -12,7 +12,7 @@ class PiliSchame {
|
||||
static AppScheme appScheme = AppSchemeImpl.getInstance() as AppScheme;
|
||||
static void init() async {
|
||||
///
|
||||
SchemeEntity? value = await appScheme.getInitScheme();
|
||||
final SchemeEntity? value = await appScheme.getInitScheme();
|
||||
if (value != null) {
|
||||
_routePush(value);
|
||||
}
|
||||
@ -34,9 +34,9 @@ class PiliSchame {
|
||||
|
||||
/// 路由跳转
|
||||
static void _routePush(value) async {
|
||||
String scheme = value.scheme;
|
||||
String host = value.host;
|
||||
String path = value.path;
|
||||
final String scheme = value.scheme;
|
||||
final String host = value.host;
|
||||
final String path = value.path;
|
||||
|
||||
if (scheme == 'bilibili') {
|
||||
// bilibili://root
|
||||
@ -55,9 +55,19 @@ class PiliSchame {
|
||||
|
||||
// bilibili://video/{aid}
|
||||
else if (host == 'video') {
|
||||
var pathQuery = path.split('/').last;
|
||||
int aid = int.parse(pathQuery);
|
||||
_videoPush(aid, null);
|
||||
String pathQuery = path.split('/').last;
|
||||
final numericRegex = RegExp(r'^[0-9]+$');
|
||||
if (numericRegex.hasMatch(pathQuery)) {
|
||||
pathQuery = 'AV$pathQuery';
|
||||
}
|
||||
Map map = IdUtils.matchAvorBv(input: pathQuery);
|
||||
if (map.containsKey('AV')) {
|
||||
_videoPush(map['AV'], null);
|
||||
} else if (map.containsKey('BV')) {
|
||||
_videoPush(null, map['BV']);
|
||||
} else {
|
||||
SmartDialog.showToast('投稿匹配失败');
|
||||
}
|
||||
}
|
||||
|
||||
// bilibili://live/{roomid}
|
||||
@ -74,6 +84,22 @@ class PiliSchame {
|
||||
_bangumiPush(int.parse(seasonId));
|
||||
}
|
||||
}
|
||||
// 专栏 bilibili://opus/detail/883089655985078289
|
||||
else if (host == 'opus') {
|
||||
if (path.startsWith('/detail')) {
|
||||
var opusId = path.split('/').last;
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url': 'https://www.bilibili.com/opus/$opusId',
|
||||
'type': 'url',
|
||||
'pageTitle': '',
|
||||
},
|
||||
);
|
||||
}
|
||||
} else if (host == 'search') {
|
||||
Get.toNamed('/searchResult', parameters: {'keyword': ''});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,9 +135,9 @@ class PiliSchame {
|
||||
var result = await SearchHttp.bangumiInfo(seasonId: seasonId, epId: null);
|
||||
if (result['status']) {
|
||||
var bangumiDetail = result['data'];
|
||||
int cid = bangumiDetail.episodes!.first.cid;
|
||||
String bvid = IdUtils.av2bv(bangumiDetail.episodes!.first.aid);
|
||||
String heroTag = Utils.makeHeroTag(cid);
|
||||
final int cid = bangumiDetail.episodes!.first.cid;
|
||||
final String bvid = IdUtils.av2bv(bangumiDetail.episodes!.first.aid);
|
||||
final String heroTag = Utils.makeHeroTag(cid);
|
||||
var epId = bangumiDetail.episodes!.first.id;
|
||||
SmartDialog.dismiss().then(
|
||||
(e) => Get.toNamed(
|
||||
@ -132,9 +158,9 @@ class PiliSchame {
|
||||
static void _fullPathPush(value) async {
|
||||
// https://m.bilibili.com/bangumi/play/ss39708
|
||||
// https | m.bilibili.com | /bangumi/play/ss39708
|
||||
String scheme = value.scheme!;
|
||||
String host = value.host!;
|
||||
String? path = value.path;
|
||||
final String scheme = value.scheme!;
|
||||
final String host = value.host!;
|
||||
final String? path = value.path;
|
||||
// Map<String, String> query = value.query!;
|
||||
if (host.startsWith('live.bilibili')) {
|
||||
int roomId = int.parse(path!.split('/').last);
|
||||
@ -148,11 +174,11 @@ class PiliSchame {
|
||||
return;
|
||||
}
|
||||
if (path != null) {
|
||||
String area = path.split('/')[1];
|
||||
final String area = path.split('/')[1];
|
||||
switch (area) {
|
||||
case 'bangumi':
|
||||
// print('番剧');
|
||||
String seasonId = path.split('/').last;
|
||||
final String seasonId = path.split('/').last;
|
||||
_bangumiPush(matchNum(seasonId).first);
|
||||
break;
|
||||
case 'video':
|
||||
@ -177,9 +203,9 @@ class PiliSchame {
|
||||
}
|
||||
|
||||
static List<int> matchNum(String str) {
|
||||
RegExp regExp = RegExp(r'\d+');
|
||||
Iterable<Match> matches = regExp.allMatches(str);
|
||||
final RegExp regExp = RegExp(r'\d+');
|
||||
final Iterable<Match> matches = regExp.allMatches(str);
|
||||
|
||||
return matches.map((match) => int.parse(match.group(0)!)).toList();
|
||||
return matches.map((Match match) => int.parse(match.group(0)!)).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class IdUtils {
|
||||
result['BV'] = bvs[0].substring(0, 2).toUpperCase() + bvs[0].substring(2);
|
||||
}
|
||||
if (avs.isNotEmpty) {
|
||||
result['AV'] = avs[0].substring(2);
|
||||
result['AV'] = int.parse(avs[0].substring(2));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user