mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -10,6 +10,7 @@ import 'package:PiliPlus/utils/accounts.dart';
|
|||||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||||
import 'package:PiliPlus/utils/accounts/account_manager/account_mgr.dart';
|
import 'package:PiliPlus/utils/accounts/account_manager/account_mgr.dart';
|
||||||
import 'package:PiliPlus/utils/global_data.dart';
|
import 'package:PiliPlus/utils/global_data.dart';
|
||||||
|
import 'package:PiliPlus/utils/login_utils.dart';
|
||||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:archive/archive.dart';
|
import 'package:archive/archive.dart';
|
||||||
@@ -18,7 +19,6 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:dio/io.dart';
|
import 'package:dio/io.dart';
|
||||||
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
||||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart' as web;
|
|
||||||
|
|
||||||
class Request {
|
class Request {
|
||||||
static const _gzipDecoder = GZipDecoder();
|
static const _gzipDecoder = GZipDecoder();
|
||||||
@@ -30,25 +30,11 @@ class Request {
|
|||||||
factory Request() => _instance;
|
factory Request() => _instance;
|
||||||
|
|
||||||
/// 设置cookie
|
/// 设置cookie
|
||||||
static Future<void> setCookie() async {
|
static void setCookie() {
|
||||||
accountManager = AccountManager();
|
accountManager = AccountManager();
|
||||||
dio.interceptors.add(accountManager);
|
dio.interceptors.add(accountManager);
|
||||||
Accounts.refresh();
|
Accounts.refresh();
|
||||||
final List<Cookie> cookies = Accounts.main.cookieJar.toList();
|
LoginUtils.setWebCookie();
|
||||||
final webManager = web.CookieManager();
|
|
||||||
await Future.wait(
|
|
||||||
cookies.map(
|
|
||||||
(item) => webManager.setCookie(
|
|
||||||
url: web.WebUri(item.domain ?? ''),
|
|
||||||
name: item.name,
|
|
||||||
value: item.value,
|
|
||||||
path: item.path ?? '',
|
|
||||||
domain: item.domain,
|
|
||||||
isSecure: item.secure,
|
|
||||||
isHttpOnly: item.httpOnly,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Accounts.main.isLogin) {
|
if (Accounts.main.isLogin) {
|
||||||
final coin = Pref.userInfoCache?.money;
|
final coin = Pref.userInfoCache?.money;
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ class SearchHttp {
|
|||||||
case SearchType.article:
|
case SearchType.article:
|
||||||
data = SearchArticleData.fromJson(res.data['data']);
|
data = SearchArticleData.fromJson(res.data['data']);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return Success(data);
|
return Success(data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void main() async {
|
|||||||
HttpOverrides.global = _CustomHttpOverrides();
|
HttpOverrides.global = _CustomHttpOverrides();
|
||||||
await setupServiceLocator();
|
await setupServiceLocator();
|
||||||
Request();
|
Request();
|
||||||
await Request.setCookie();
|
Request.setCookie();
|
||||||
|
|
||||||
SmartDialog.config.toast = SmartConfigToast(
|
SmartDialog.config.toast = SmartConfigToast(
|
||||||
displayType: SmartToastType.onlyRefresh,
|
displayType: SmartToastType.onlyRefresh,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ignore_for_file: constant_identifier_names
|
// ignore_for_file: constant_identifier_names
|
||||||
enum SearchType {
|
enum SearchType {
|
||||||
// all,
|
// all('综合'),
|
||||||
// 视频:video
|
// 视频:video
|
||||||
video('视频', hasHeader: true),
|
video('视频', hasHeader: true),
|
||||||
// 番剧:media_bangumi,
|
// 番剧:media_bangumi,
|
||||||
|
|||||||
@@ -98,11 +98,11 @@ class DynamicItemModel {
|
|||||||
}
|
}
|
||||||
idStr = json['item']?['id_str'];
|
idStr = json['item']?['id_str'];
|
||||||
// type = json['type']; // int
|
// type = json['type']; // int
|
||||||
modules = json['item']?['modules'] == null
|
if (json['item']?['modules'] case List list) {
|
||||||
? ItemModulesModel()
|
modules = ItemModulesModel.fromOpusJson(list.cast());
|
||||||
: ItemModulesModel.fromOpusJson(
|
} else {
|
||||||
(json['item']['modules'] as List).cast(),
|
modules = ItemModulesModel();
|
||||||
);
|
}
|
||||||
|
|
||||||
if (json['fallback'] != null) {
|
if (json['fallback'] != null) {
|
||||||
fallback = Fallback.fromJson(json['fallback']);
|
fallback = Fallback.fromJson(json['fallback']);
|
||||||
@@ -196,7 +196,7 @@ class ItemModulesModel {
|
|||||||
: ModuleBlocked.fromJson(i['module_blocked']);
|
: ModuleBlocked.fromJson(i['module_blocked']);
|
||||||
break;
|
break;
|
||||||
case 'MODULE_TYPE_EXTEND':
|
case 'MODULE_TYPE_EXTEND':
|
||||||
moduleExtend = (i['module_extend']['items'] as List?)
|
moduleExtend = (i['module_extend']?['items'] as List?)
|
||||||
?.map((i) => ModuleTag.fromJson(i))
|
?.map((i) => ModuleTag.fromJson(i))
|
||||||
.toList();
|
.toList();
|
||||||
break;
|
break;
|
||||||
@@ -1286,9 +1286,7 @@ class RichTextNodeItem {
|
|||||||
text = json['text'];
|
text = json['text'];
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
rid = json['rid'];
|
rid = json['rid'];
|
||||||
pics = json['pics'] == null
|
pics = (json['pics'] as List?)
|
||||||
? null
|
|
||||||
: (json['pics'] as List?)
|
|
||||||
?.map((e) => OpusPicModel.fromJson(e))
|
?.map((e) => OpusPicModel.fromJson(e))
|
||||||
.toList();
|
.toList();
|
||||||
jumpUrl = json['jump_url'];
|
jumpUrl = json['jump_url'];
|
||||||
|
|||||||
@@ -22,36 +22,24 @@ class SearchAllData extends SearchNumData {
|
|||||||
|
|
||||||
SearchAllData.fromJson(Map<String, dynamic> json) {
|
SearchAllData.fromJson(Map<String, dynamic> json) {
|
||||||
numResults = (json['numResults'] as num?)?.toInt();
|
numResults = (json['numResults'] as num?)?.toInt();
|
||||||
if ((json['result'] as List?)?.isNotEmpty == true) {
|
if (json['result'] case List result) {
|
||||||
final isRefresh = json['page'] == 1;
|
final isRefresh = json['page'] == 1;
|
||||||
list = [];
|
list = [];
|
||||||
for (final item in json['result']) {
|
for (final item in result) {
|
||||||
if ((item['data'] as List?)?.isNotEmpty == true) {
|
if (item['data'] case List data) {
|
||||||
switch (item['result_type']) {
|
switch (item['result_type']) {
|
||||||
case 'media_bangumi' || 'media_bangumi':
|
case 'media_bangumi' || 'media_bangumi':
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
list!.add(
|
list!.addAll(data.map((e) => SearchPgcItemModel.fromJson(e)));
|
||||||
(item['data'] as List)
|
|
||||||
.map((e) => SearchPgcItemModel.fromJson(e))
|
|
||||||
.toList(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'bili_user':
|
case 'bili_user':
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
list!.addAll(
|
list!.addAll(data.map((e) => SearchUserItemModel.fromJson(e)));
|
||||||
(item['data'] as List)
|
|
||||||
.map((e) => SearchUserItemModel.fromJson(e))
|
|
||||||
.toList(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
list!.addAll(
|
list!.addAll(data.map((e) => SearchVideoItemModel.fromJson(e)));
|
||||||
(item['data'] as List)
|
|
||||||
.map((e) => SearchVideoItemModel.fromJson(e))
|
|
||||||
.toList(),
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class DanmakuBlockDataModel {
|
|||||||
rule = <SimpleRule>[];
|
rule = <SimpleRule>[];
|
||||||
rule1 = <SimpleRule>[];
|
rule1 = <SimpleRule>[];
|
||||||
rule2 = <SimpleRule>[];
|
rule2 = <SimpleRule>[];
|
||||||
if ((json['rule'] as List?)?.isNotEmpty == true) {
|
if (json['rule'] case List list) {
|
||||||
for (var e in json['rule']) {
|
for (var e in list) {
|
||||||
SimpleRule item = SimpleRule.fromJson(e);
|
SimpleRule item = SimpleRule.fromJson(e);
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
|
|||||||
'img_size': data.imgSize,
|
'img_size': data.imgSize,
|
||||||
'img_src': data.imageUrl,
|
'img_src': data.imageUrl,
|
||||||
};
|
};
|
||||||
}).toList(),
|
}),
|
||||||
eagerError: true,
|
eagerError: true,
|
||||||
);
|
);
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
|
|||||||
@@ -202,11 +202,10 @@ class LiveRoomController extends GetxController {
|
|||||||
if (messages.isEmpty) {
|
if (messages.isEmpty) {
|
||||||
LiveHttp.liveRoomDanmaPrefetch(roomId: roomId).then((v) {
|
LiveHttp.liveRoomDanmaPrefetch(roomId: roomId).then((v) {
|
||||||
if (v['status']) {
|
if (v['status']) {
|
||||||
if ((v['data'] as List?)?.isNotEmpty == true) {
|
if (v['data'] case List list) {
|
||||||
try {
|
try {
|
||||||
messages.addAll(
|
messages.addAll(
|
||||||
(v['data'] as List)
|
list.map(
|
||||||
.map(
|
|
||||||
(obj) => {
|
(obj) => {
|
||||||
'name': obj['user']['base']['name'],
|
'name': obj['user']['base']['name'],
|
||||||
'uid': obj['user']['uid'],
|
'uid': obj['user']['uid'],
|
||||||
@@ -216,8 +215,7 @@ class LiveRoomController extends GetxController {
|
|||||||
? obj['emoticon']
|
? obj['emoticon']
|
||||||
: null,
|
: null,
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
.toList(),
|
|
||||||
);
|
);
|
||||||
WidgetsBinding.instance.addPostFrameCallback(
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
(_) => scrollToBottom(),
|
(_) => scrollToBottom(),
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class MemberFavoriteCtr
|
|||||||
firstEnd.value = res.data['data']['has_more'] == false;
|
firstEnd.value = res.data['data']['has_more'] == false;
|
||||||
if (res.data['data'] != null) {
|
if (res.data['data'] != null) {
|
||||||
List<SpaceFavItemModel> list =
|
List<SpaceFavItemModel> list =
|
||||||
(res.data['data']['list'] as List<dynamic>?)
|
(res.data['data']?['list'] as List<dynamic>?)
|
||||||
?.map((item) => SpaceFavItemModel.fromJson(item))
|
?.map((item) => SpaceFavItemModel.fromJson(item))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
<SpaceFavItemModel>[];
|
<SpaceFavItemModel>[];
|
||||||
@@ -107,7 +107,7 @@ class MemberFavoriteCtr
|
|||||||
secondEnd.value = res.data['data']['has_more'] == false;
|
secondEnd.value = res.data['data']['has_more'] == false;
|
||||||
if (res.data['data'] != null) {
|
if (res.data['data'] != null) {
|
||||||
List<SpaceFavItemModel> list =
|
List<SpaceFavItemModel> list =
|
||||||
(res.data['data']['list'] as List<dynamic>?)
|
(res.data['data']?['list'] as List<dynamic>?)
|
||||||
?.map((item) => SpaceFavItemModel.fromJson(item))
|
?.map((item) => SpaceFavItemModel.fromJson(item))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
<SpaceFavItemModel>[];
|
<SpaceFavItemModel>[];
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
|||||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_fav/data.dart';
|
import 'package:PiliPlus/models_new/space/space_fav/data.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_fav/list.dart';
|
|
||||||
import 'package:PiliPlus/pages/member_favorite/controller.dart';
|
import 'package:PiliPlus/pages/member_favorite/controller.dart';
|
||||||
import 'package:PiliPlus/pages/member_favorite/widget/item.dart';
|
import 'package:PiliPlus/pages/member_favorite/widget/item.dart';
|
||||||
import 'package:PiliPlus/utils/grid.dart';
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
@@ -123,7 +122,7 @@ class _MemberFavoriteState extends State<MemberFavorite>
|
|||||||
),
|
),
|
||||||
controlAffinity: ListTileControlAffinity.leading,
|
controlAffinity: ListTileControlAffinity.leading,
|
||||||
children: [
|
children: [
|
||||||
...(data.mediaListResponse?.list as List<SpaceFavItemModel>).map(
|
...?data.mediaListResponse?.list?.map(
|
||||||
(item) => SizedBox(
|
(item) => SizedBox(
|
||||||
height: 98,
|
height: 98,
|
||||||
child: MemberFavItem(
|
child: MemberFavItem(
|
||||||
|
|||||||
@@ -53,9 +53,7 @@ class _SearchAllPanelState
|
|||||||
(item) => switch (item) {
|
(item) => switch (item) {
|
||||||
SearchVideoItemModel() => SizedBox(
|
SearchVideoItemModel() => SizedBox(
|
||||||
height: 120,
|
height: 120,
|
||||||
child: VideoCardH(
|
child: VideoCardH(videoItem: item),
|
||||||
videoItem: item,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
List<SearchPgcItemModel>() =>
|
List<SearchPgcItemModel>() =>
|
||||||
item.length == 1
|
item.length == 1
|
||||||
|
|||||||
@@ -535,9 +535,9 @@ List<SettingsModel> get extraSettings => [
|
|||||||
return SelectDialog<SuperResolutionType>(
|
return SelectDialog<SuperResolutionType>(
|
||||||
title: '超分辨率',
|
title: '超分辨率',
|
||||||
value: SuperResolutionType.values[Pref.superResolutionType],
|
value: SuperResolutionType.values[Pref.superResolutionType],
|
||||||
values: SuperResolutionType.values.map((e) {
|
values: SuperResolutionType.values
|
||||||
return (e, e.title);
|
.map((e) => (e, e.title))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -935,9 +935,9 @@ List<SettingsModel> get extraSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '评论展示',
|
title: '评论展示',
|
||||||
value: Pref.replySortType,
|
value: Pref.replySortType,
|
||||||
values: ReplySortType.values.map((e) {
|
values: ReplySortType.values
|
||||||
return (e.index, e.title);
|
.map((e) => (e.index, e.title))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -961,9 +961,10 @@ List<SettingsModel> get extraSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '动态展示',
|
title: '动态展示',
|
||||||
value: Pref.defaultDynamicType,
|
value: Pref.defaultDynamicType,
|
||||||
values: DynamicsTabType.values.sublist(0, 4).map((e) {
|
values: DynamicsTabType.values
|
||||||
return (e.index, e.label);
|
.sublist(0, 4)
|
||||||
}).toList(),
|
.map((e) => (e.index, e.label))
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -986,9 +987,7 @@ List<SettingsModel> get extraSettings => [
|
|||||||
return SelectDialog<MemberTabType>(
|
return SelectDialog<MemberTabType>(
|
||||||
title: '用户页默认展示TAB',
|
title: '用户页默认展示TAB',
|
||||||
value: Pref.memberTab,
|
value: Pref.memberTab,
|
||||||
values: MemberTabType.values.map((e) {
|
values: MemberTabType.values.map((e) => (e, e.title)).toList(),
|
||||||
return (e, e.title);
|
|
||||||
}).toList(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -223,9 +223,9 @@ List<SettingsModel> get playSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '默认全屏方向',
|
title: '默认全屏方向',
|
||||||
value: Pref.fullScreenMode,
|
value: Pref.fullScreenMode,
|
||||||
values: FullScreenMode.values.map((e) {
|
values: FullScreenMode.values
|
||||||
return (e.index, e.desc);
|
.map((e) => (e.index, e.desc))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -248,9 +248,9 @@ List<SettingsModel> get playSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '底部进度条展示',
|
title: '底部进度条展示',
|
||||||
value: Pref.btmProgressBehavior,
|
value: Pref.btmProgressBehavior,
|
||||||
values: BtmProgressBehavior.values.map((e) {
|
values: BtmProgressBehavior.values
|
||||||
return (e.index, e.desc);
|
.map((e) => (e.index, e.desc))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -104,9 +104,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
return SelectDialog<Transition>(
|
return SelectDialog<Transition>(
|
||||||
title: '页面过渡动画',
|
title: '页面过渡动画',
|
||||||
value: CustomGetPage.pageTransition,
|
value: CustomGetPage.pageTransition,
|
||||||
values: Transition.values.map((e) {
|
values: Transition.values.map((e) => (e, e.name)).toList(),
|
||||||
return (e, e.name);
|
|
||||||
}).toList(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -203,9 +201,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
return SelectDialog<UpPanelPosition>(
|
return SelectDialog<UpPanelPosition>(
|
||||||
title: '动态页UP主显示位置',
|
title: '动态页UP主显示位置',
|
||||||
value: Pref.upPanelPosition,
|
value: Pref.upPanelPosition,
|
||||||
values: UpPanelPosition.values.map((e) {
|
values: UpPanelPosition.values.map((e) => (e, e.label)).toList(),
|
||||||
return (e, e.label);
|
|
||||||
}).toList(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -239,9 +235,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
return SelectDialog<DynamicBadgeMode>(
|
return SelectDialog<DynamicBadgeMode>(
|
||||||
title: '动态未读标记',
|
title: '动态未读标记',
|
||||||
value: Pref.dynamicBadgeType,
|
value: Pref.dynamicBadgeType,
|
||||||
values: DynamicBadgeMode.values.map((e) {
|
values: DynamicBadgeMode.values.map((e) => (e, e.desc)).toList(),
|
||||||
return (e, e.desc);
|
|
||||||
}).toList(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -272,9 +266,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
return SelectDialog<DynamicBadgeMode>(
|
return SelectDialog<DynamicBadgeMode>(
|
||||||
title: '消息未读标记',
|
title: '消息未读标记',
|
||||||
value: Pref.msgBadgeMode,
|
value: Pref.msgBadgeMode,
|
||||||
values: DynamicBadgeMode.values.map((e) {
|
values: DynamicBadgeMode.values.map((e) => (e, e.desc)).toList(),
|
||||||
return (e, e.desc);
|
|
||||||
}).toList(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -557,11 +549,7 @@ List<SettingsModel> get styleSettings => [
|
|||||||
return SelectDialog<ThemeType>(
|
return SelectDialog<ThemeType>(
|
||||||
title: '主题模式',
|
title: '主题模式',
|
||||||
value: Pref.themeType,
|
value: Pref.themeType,
|
||||||
values: ThemeType.values.map(
|
values: ThemeType.values.map((e) => (e, e.desc)).toList(),
|
||||||
(e) {
|
|
||||||
return (e, e.desc);
|
|
||||||
},
|
|
||||||
).toList(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -608,9 +596,9 @@ List<SettingsModel> get styleSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '首页启动页',
|
title: '首页启动页',
|
||||||
value: Pref.defaultHomePage,
|
value: Pref.defaultHomePage,
|
||||||
values: NavigationBarType.values.map((e) {
|
values: NavigationBarType.values
|
||||||
return (e.index, e.label);
|
.map((e) => (e.index, e.label))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -132,9 +132,9 @@ List<SettingsModel> get videoSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '蜂窝网络画质',
|
title: '蜂窝网络画质',
|
||||||
value: Pref.defaultVideoQaCellular,
|
value: Pref.defaultVideoQaCellular,
|
||||||
values: VideoQuality.values.reversed.map((e) {
|
values: VideoQuality.values.reversed
|
||||||
return (e.code, e.desc);
|
.map((e) => (e.code, e.desc))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -185,9 +185,9 @@ List<SettingsModel> get videoSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '蜂窝网络音质',
|
title: '蜂窝网络音质',
|
||||||
value: Pref.defaultAudioQaCellular,
|
value: Pref.defaultAudioQaCellular,
|
||||||
values: AudioQuality.values.reversed.map((e) {
|
values: AudioQuality.values.reversed
|
||||||
return (e.code, e.desc);
|
.map((e) => (e.code, e.desc))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -238,9 +238,9 @@ List<SettingsModel> get videoSettings => [
|
|||||||
return SelectDialog<int>(
|
return SelectDialog<int>(
|
||||||
title: '直播默认画质',
|
title: '直播默认画质',
|
||||||
value: Pref.liveQualityCellular,
|
value: Pref.liveQualityCellular,
|
||||||
values: LiveQuality.values.map((e) {
|
values: LiveQuality.values
|
||||||
return (e.code, e.description);
|
.map((e) => (e.code, e.description))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -288,9 +288,9 @@ List<SettingsModel> get videoSettings => [
|
|||||||
return SelectDialog<String>(
|
return SelectDialog<String>(
|
||||||
title: '次选解码格式',
|
title: '次选解码格式',
|
||||||
value: Pref.secondDecode,
|
value: Pref.secondDecode,
|
||||||
values: VideoDecodeFormatType.values.map((e) {
|
values: VideoDecodeFormatType.values
|
||||||
return (e.code, e.description);
|
.map((e) => (e.code, e.description))
|
||||||
}).toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -330,8 +330,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
return SelectDialog<String>(
|
return SelectDialog<String>(
|
||||||
title: '视频同步',
|
title: '视频同步',
|
||||||
value: Pref.videoSync,
|
value: Pref.videoSync,
|
||||||
values:
|
values: const [
|
||||||
[
|
|
||||||
'audio',
|
'audio',
|
||||||
'display-resample',
|
'display-resample',
|
||||||
'display-resample-vdrop',
|
'display-resample-vdrop',
|
||||||
@@ -341,9 +340,7 @@ List<SettingsModel> get videoSettings => [
|
|||||||
'display-adrop',
|
'display-adrop',
|
||||||
'display-desync',
|
'display-desync',
|
||||||
'desync',
|
'desync',
|
||||||
].map((e) {
|
].map((e) => (e, e)).toList(),
|
||||||
return (e, e);
|
|
||||||
}).toList(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -365,9 +362,13 @@ List<SettingsModel> get videoSettings => [
|
|||||||
return SelectDialog<String>(
|
return SelectDialog<String>(
|
||||||
title: '硬解模式',
|
title: '硬解模式',
|
||||||
value: Pref.hardwareDecoding,
|
value: Pref.hardwareDecoding,
|
||||||
values: ['auto', 'auto-copy', 'auto-safe', 'no', 'yes'].map((e) {
|
values: const [
|
||||||
return (e, e);
|
'auto',
|
||||||
}).toList(),
|
'auto-copy',
|
||||||
|
'auto-safe',
|
||||||
|
'no',
|
||||||
|
'yes',
|
||||||
|
].map((e) => (e, e)).toList(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -98,9 +98,7 @@ class _SettingsSearchPageState extends SearchState<SettingsSearchPage> {
|
|||||||
? const HttpError()
|
? const HttpError()
|
||||||
: SliverWaterfallFlow.extent(
|
: SliverWaterfallFlow.extent(
|
||||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||||
children: [
|
children: _list.map((item) => item.widget).toList(),
|
||||||
..._list.map((item) => item.widget),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -110,8 +110,7 @@ class _AiDetailState extends CommonCollapseSlidePageState<AiConclusionPanel> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
if (item.partOutline?.isNotEmpty == true)
|
...?item.partOutline?.map(
|
||||||
...item.partOutline!.map(
|
|
||||||
(item) => Wrap(
|
(item) => Wrap(
|
||||||
children: [
|
children: [
|
||||||
SelectableText.rich(
|
SelectableText.rich(
|
||||||
|
|||||||
@@ -764,8 +764,7 @@ class VideoDetailController extends GetxController
|
|||||||
|
|
||||||
return segmentModel;
|
return segmentModel;
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
.toList(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// _segmentProgressList
|
// _segmentProgressList
|
||||||
@@ -774,7 +773,7 @@ class VideoDetailController extends GetxController
|
|||||||
double start = (e.segment.first / duration).clamp(0.0, 1.0);
|
double start = (e.segment.first / duration).clamp(0.0, 1.0);
|
||||||
double end = (e.segment.second / duration).clamp(0.0, 1.0);
|
double end = (e.segment.second / duration).clamp(0.0, 1.0);
|
||||||
return Segment(start, end, _getColor(e.segmentType));
|
return Segment(start, end, _getColor(e.segmentType));
|
||||||
}).toList(),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (positionSubscription == null &&
|
if (positionSubscription == null &&
|
||||||
|
|||||||
@@ -393,7 +393,6 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
if (replyItem.replyControl.cardLabels
|
if (replyItem.replyControl.cardLabels
|
||||||
.map((item) => item.textContent)
|
.map((item) => item.textContent)
|
||||||
.toList()
|
|
||||||
.contains('热评'))
|
.contains('热评'))
|
||||||
Text(
|
Text(
|
||||||
'热评',
|
'热评',
|
||||||
|
|||||||
@@ -1641,12 +1641,12 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
onTap: handlePlay,
|
onTap: handlePlay,
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => NetworkImgLayer(
|
() => NetworkImgLayer(
|
||||||
|
radius: 0,
|
||||||
|
quality: 60,
|
||||||
src: videoDetailController.cover.value,
|
src: videoDetailController.cover.value,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
boxFit: BoxFit.cover,
|
boxFit: BoxFit.cover,
|
||||||
fadeOutDuration: const Duration(milliseconds: 120),
|
|
||||||
fadeInDuration: const Duration(milliseconds: 120),
|
|
||||||
forceUseCacheWidth: true,
|
forceUseCacheWidth: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:PiliPlus/http/ua_type.dart';
|
import 'package:PiliPlus/http/ua_type.dart';
|
||||||
import 'package:PiliPlus/models/common/webview_menu_type.dart';
|
import 'package:PiliPlus/models/common/webview_menu_type.dart';
|
||||||
import 'package:PiliPlus/utils/accounts.dart';
|
|
||||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
|
||||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||||
import 'package:PiliPlus/utils/cache_manage.dart';
|
import 'package:PiliPlus/utils/cache_manage.dart';
|
||||||
|
import 'package:PiliPlus/utils/login_utils.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||||
@@ -111,18 +110,7 @@ class _WebviewPageState extends State<WebviewPage> {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WebviewMenuItem.resetCookie:
|
case WebviewMenuItem.resetCookie:
|
||||||
final cookies = Accounts.main.cookieJar.toList();
|
await LoginUtils.setWebCookie();
|
||||||
for (var item in cookies) {
|
|
||||||
await CookieManager().setCookie(
|
|
||||||
url: WebUri(item.domain ?? ''),
|
|
||||||
name: item.name,
|
|
||||||
value: item.value,
|
|
||||||
path: item.path ?? '',
|
|
||||||
domain: item.domain,
|
|
||||||
isSecure: item.secure,
|
|
||||||
isHttpOnly: item.httpOnly,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
SmartDialog.showToast('设置成功,刷新或重新打开网页');
|
SmartDialog.showToast('设置成功,刷新或重新打开网页');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,28 +25,28 @@ import 'package:get/get.dart';
|
|||||||
class LoginUtils {
|
class LoginUtils {
|
||||||
static final random = Random();
|
static final random = Random();
|
||||||
|
|
||||||
|
static Future setWebCookie([Account? account]) async {
|
||||||
|
final cookies = (account ?? Accounts.main).cookieJar.toList();
|
||||||
|
final webManager = web.CookieManager();
|
||||||
|
return Future.wait(
|
||||||
|
cookies.map(
|
||||||
|
(cookie) => webManager.setCookie(
|
||||||
|
url: web.WebUri(cookie.domain ?? ''),
|
||||||
|
name: cookie.name,
|
||||||
|
value: cookie.value,
|
||||||
|
path: cookie.path ?? '/',
|
||||||
|
domain: cookie.domain,
|
||||||
|
isSecure: cookie.secure,
|
||||||
|
isHttpOnly: cookie.httpOnly,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static Future<void> onLoginMain() async {
|
static Future<void> onLoginMain() async {
|
||||||
final account = Accounts.main;
|
final account = Accounts.main;
|
||||||
GrpcReq.updateHeaders(account.accessKey);
|
GrpcReq.updateHeaders(account.accessKey);
|
||||||
try {
|
setWebCookie(account);
|
||||||
final cookies = account.cookieJar.toList();
|
|
||||||
final webManager = web.CookieManager();
|
|
||||||
Future.wait([
|
|
||||||
...cookies.map(
|
|
||||||
(item) => webManager.setCookie(
|
|
||||||
url: web.WebUri(item.domain ?? ''),
|
|
||||||
name: item.name,
|
|
||||||
value: item.value,
|
|
||||||
path: item.path ?? '',
|
|
||||||
domain: item.domain,
|
|
||||||
isSecure: item.secure,
|
|
||||||
isHttpOnly: item.httpOnly,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
} catch (e) {
|
|
||||||
SmartDialog.showToast('设置登录态失败,$e');
|
|
||||||
}
|
|
||||||
final result = await UserHttp.userInfo();
|
final result = await UserHttp.userInfo();
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
final UserInfoData data = result.data;
|
final UserInfoData data = result.data;
|
||||||
|
|||||||
@@ -67,15 +67,13 @@ class PageUtils {
|
|||||||
final shareListRes = await ImGrpc.shareList(size: 3);
|
final shareListRes = await ImGrpc.shareList(size: 3);
|
||||||
if (shareListRes.isSuccess && shareListRes.data.sessionList.isNotEmpty) {
|
if (shareListRes.isSuccess && shareListRes.data.sessionList.isNotEmpty) {
|
||||||
userList.addAll(
|
userList.addAll(
|
||||||
shareListRes.data.sessionList
|
shareListRes.data.sessionList.map<UserModel>(
|
||||||
.map<UserModel>(
|
|
||||||
(item) => UserModel(
|
(item) => UserModel(
|
||||||
mid: item.talkerId.toInt(),
|
mid: item.talkerId.toInt(),
|
||||||
name: item.talkerUname,
|
name: item.talkerUname,
|
||||||
avatar: item.talkerIcon,
|
avatar: item.talkerIcon,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.toList(),
|
|
||||||
);
|
);
|
||||||
} else if (context.mounted) {
|
} else if (context.mounted) {
|
||||||
UserModel? userModel = await Navigator.of(context).push(
|
UserModel? userModel = await Navigator.of(context).push(
|
||||||
|
|||||||
@@ -70,10 +70,7 @@ class Utils {
|
|||||||
String baseDirectory,
|
String baseDirectory,
|
||||||
List<String> shaders,
|
List<String> shaders,
|
||||||
) {
|
) {
|
||||||
List<String> absolutePaths = shaders.map((shader) {
|
return shaders.map((shader) => path.join(baseDirectory, shader)).join(':');
|
||||||
return path.join(baseDirectory, shader);
|
|
||||||
}).toList();
|
|
||||||
return absolutePaths.join(':');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static final numericRegex = RegExp(r'^[\d\.]+$');
|
static final numericRegex = RegExp(r'^[\d\.]+$');
|
||||||
|
|||||||
Reference in New Issue
Block a user