Merge branch 'design'

This commit is contained in:
guozhigq
2024-10-20 22:59:18 +08:00
36 changed files with 1353 additions and 640 deletions

View File

@ -24,30 +24,30 @@ class PiliSchame {
appScheme.getInitScheme().then((SchemeEntity? value) {
if (value != null) {
_routePush(value);
routePush(value);
}
});
appScheme.getLatestScheme().then((SchemeEntity? value) {
if (value != null) {
_routePush(value);
routePush(value);
}
});
appScheme.registerSchemeListener().listen((SchemeEntity? event) {
if (event != null) {
_routePush(event);
routePush(event);
}
});
}
/// 路由跳转
static void _routePush(value) async {
static void routePush(value) async {
final String scheme = value.scheme;
if (scheme == 'bilibili') {
biliScheme(value);
}
if (scheme == 'https') {
if (['http', 'https'].contains(scheme)) {
httpsScheme(value);
}
}
@ -79,16 +79,16 @@ class PiliSchame {
}
}
static Future<void> httpsScheme(SchemeEntity value) async {
static Future<void> httpsScheme(Uri value) async {
// https://m.bilibili.com/bangumi/play/ss39708
// https | m.bilibili.com | /bangumi/play/ss39708
// final String scheme = value.scheme!;
final String host = value.host!;
final String? path = value.path;
Map<String, String>? query = value.query;
final String host = value.host;
final String path = value.path;
Map<String, String>? query = value.queryParameters;
RegExp regExp = RegExp(r'^((www\.)|(m\.))?bilibili\.com$');
if (regExp.hasMatch(host)) {
final String lastPathSegment = path!.split('/').last;
final String lastPathSegment = path.split('/').last;
if (path.startsWith('/video')) {
Map matchRes = IdUtils.matchAvorBv(input: path);
if (matchRes.containsKey('AV')) {
@ -113,13 +113,13 @@ class PiliSchame {
_videoPush(Utils.matchNum(path.split('?').first).first, null);
}
} else if (host.contains('live')) {
int roomId = int.parse(path!.split('/').last);
int roomId = int.parse(path.split('/').last);
Get.toNamed(
'/liveRoom?roomid=$roomId',
arguments: {'liveItem': null, 'heroTag': roomId.toString()},
);
} else if (host.contains('space')) {
var mid = path!.split('/').last;
var mid = path.split('/').last;
Get.toNamed('/member?mid=$mid', arguments: {'face': ''});
return;
} else if (host == 'b23.tv') {
@ -154,7 +154,7 @@ class PiliSchame {
parameters: {'url': redirectUrl, 'type': 'url', 'pageTitle': ''},
);
}
} else if (path != null) {
} else {
final String area = path.split('/').last;
switch (area) {
case 'bangumi':
@ -178,12 +178,12 @@ class PiliSchame {
break;
case 'read':
print('专栏');
String id = Utils.matchNum(query!['id']!).first.toString();
String id = Utils.matchNum(query['id']!).first.toString();
Get.toNamed('/read', parameters: {
'url': value.dataString!,
'url': value.toString(),
'title': '',
'id': id,
'articleType': 'read'
'articleType': 'read',
});
break;
case 'space':
@ -201,9 +201,9 @@ class PiliSchame {
Get.toNamed(
'/webview',
parameters: {
'url': value.dataString ?? "",
'url': value.toString(),
'type': 'url',
'pageTitle': ''
'pageTitle': '',
},
);
}

View File

@ -49,6 +49,10 @@ class GlobalDataCache {
late List historyCacheList;
//
late bool enableSearchSuggest = true;
// 简介默认展开
late bool enableAutoExpand = false;
//
late bool enableDynamicSwitch = true;
// 私有构造函数
GlobalDataCache._();
@ -112,5 +116,9 @@ class GlobalDataCache {
historyCacheList = localCache.get('cacheList', defaultValue: []);
enableSearchSuggest =
setting.get(SettingBoxKey.enableSearchSuggest, defaultValue: true);
enableAutoExpand =
setting.get(SettingBoxKey.enableAutoExpand, defaultValue: false);
enableDynamicSwitch =
setting.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
}
}

View File

@ -113,6 +113,7 @@ class SettingBoxKey {
enableSearchWord = 'enableSearchWord',
enableSystemProxy = 'enableSystemProxy',
enableAi = 'enableAi',
enableAutoExpand = 'enableAutoExpand',
defaultHomePage = 'defaultHomePage',
enableRelatedVideo = 'enableRelatedVideo';
@ -130,6 +131,7 @@ class SettingBoxKey {
tabbarSort = 'tabbarSort', // 首页tabbar
dynamicBadgeMode = 'dynamicBadgeMode',
enableGradientBg = 'enableGradientBg',
enableDynamicSwitch = 'enableDynamicSwitch',
navBarSort = 'navBarSort',
actionTypeSort = 'actionTypeSort';
}