Compare commits

..

9 Commits

Author SHA1 Message Date
67c9ff699c feat: sentry 异常捕获 2024-03-23 14:15:51 +08:00
74f31a818c Merge branch 'main' into feature-sentry 2024-03-23 00:41:12 +08:00
c216c9bd65 mod: tabbar样式&增加评论数 2024-03-21 23:51:43 +08:00
3701fdef97 Merge branch 'fix-scrollSetVolume' 2024-03-21 23:40:55 +08:00
59641f0216 Merge branch 'fix' 2024-03-21 23:40:30 +08:00
6d276fce4c fix: 媒体库无法滑动 2024-03-21 00:03:20 +08:00
710361caea fix: 历史记录相关错误 2024-03-20 23:21:41 +08:00
734db176bf Merge branch 'main' into fix 2024-03-20 00:08:37 +08:00
64292d523f fix: player fit rebuild 2024-03-18 22:13:15 +08:00
16 changed files with 187 additions and 73 deletions

View File

@ -45,6 +45,13 @@ PODS:
- Flutter - Flutter
- screen_brightness_ios (0.1.0): - screen_brightness_ios (0.1.0):
- Flutter - Flutter
- Sentry/HybridSDK (8.19.0):
- SentryPrivate (= 8.19.0)
- sentry_flutter (0.0.1):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.19.0)
- SentryPrivate (8.19.0)
- share_plus (0.0.1): - share_plus (0.0.1):
- Flutter - Flutter
- sqflite (0.0.3): - sqflite (0.0.3):
@ -86,6 +93,7 @@ DEPENDENCIES:
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- saver_gallery (from `.symlinks/plugins/saver_gallery/ios`) - saver_gallery (from `.symlinks/plugins/saver_gallery/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`) - screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- status_bar_control (from `.symlinks/plugins/status_bar_control/ios`) - status_bar_control (from `.symlinks/plugins/status_bar_control/ios`)
@ -101,6 +109,8 @@ SPEC REPOS:
- FMDB - FMDB
- GT3Captcha-iOS - GT3Captcha-iOS
- ReachabilitySwift - ReachabilitySwift
- Sentry
- SentryPrivate
- Toast - Toast
EXTERNAL SOURCES: EXTERNAL SOURCES:
@ -142,6 +152,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/saver_gallery/ios" :path: ".symlinks/plugins/saver_gallery/ios"
screen_brightness_ios: screen_brightness_ios:
:path: ".symlinks/plugins/screen_brightness_ios/ios" :path: ".symlinks/plugins/screen_brightness_ios/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
share_plus: share_plus:
:path: ".symlinks/plugins/share_plus/ios" :path: ".symlinks/plugins/share_plus/ios"
sqflite: sqflite:
@ -184,6 +196,9 @@ SPEC CHECKSUMS:
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78 saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625 screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
Sentry: 1ebcaef678a27c8ac515f974cb5425dd1bbdec2f
sentry_flutter: ecdfbedee55337205561cfa782ee02d31ec83e1f
SentryPrivate: 765c9b4ebe9ac1a5fcdc067c5a1cfbf3f10e1677
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5 share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446 status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446

View File

@ -45,10 +45,14 @@ class ApiInterceptor extends Interceptor {
void onError(DioException err, ErrorInterceptorHandler handler) async { void onError(DioException err, ErrorInterceptorHandler handler) async {
// 处理网络请求错误 // 处理网络请求错误
// handler.next(err); // handler.next(err);
SmartDialog.showToast( String url = err.requestOptions.uri.toString();
await dioError(err), print('🌹🌹ApiInterceptor: $url');
displayType: SmartToastType.onlyRefresh, if (!url.contains('heartBeat')) {
); SmartDialog.showToast(
await dioError(err),
displayType: SmartToastType.onlyRefresh,
);
}
super.onError(err, handler); super.onError(err, handler);
} }

View File

@ -25,6 +25,9 @@ import 'package:media_kit/media_kit.dart'; // Provides [Player], [Media], [Playl
import 'package:pilipala/utils/recommend_filter.dart'; import 'package:pilipala/utils/recommend_filter.dart';
import 'package:catcher_2/catcher_2.dart'; import 'package:catcher_2/catcher_2.dart';
import './services/loggeer.dart'; import './services/loggeer.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'services/sentry.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -55,14 +58,36 @@ void main() async {
[FileHandler(await getLogsPath())], [FileHandler(await getLogsPath())],
); );
Catcher2( // Catcher2(
debugConfig: debugConfig, // debugConfig: debugConfig,
releaseConfig: releaseConfig, // releaseConfig: releaseConfig,
runAppFunction: () { // runAppFunction: () {
runApp(const MyApp()); // runApp(const MyApp());
}, // },
// );
await SentryService.sentryInit(
() => runApp(
SentryScreenshotWidget(
child: SentryUserInteractionWidget(
child: DefaultAssetBundle(
bundle: SentryAssetBundle(),
child: const MyApp(),
),
),
),
),
); );
// try {
// int? test;
// test! + 3;
// } catch (exception, stackTrace) {
// debugPrint('111');
// await Sentry.captureException(exception, stackTrace: '$stackTrace');
// debugPrint('222');
// }
// 小白条、导航栏沉浸 // 小白条、导航栏沉浸
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
@ -195,6 +220,7 @@ class MyApp extends StatelessWidget {
navigatorObservers: [ navigatorObservers: [
VideoDetailPage.routeObserver, VideoDetailPage.routeObserver,
SearchPage.routeObserver, SearchPage.routeObserver,
SentryNavigatorObserver(),
], ],
); );
}), }),

View File

@ -88,8 +88,10 @@ class HistoryController extends GetxController {
// 观看历史暂停状态 // 观看历史暂停状态
Future historyStatus() async { Future historyStatus() async {
var res = await UserHttp.historyStatus(); var res = await UserHttp.historyStatus();
pauseStatus.value = res.data['data']; if (res.data['code'] == 0) {
localCache.put(LocalCacheKey.historyPause, res.data['data']); pauseStatus.value = res.data['data'];
localCache.put(LocalCacheKey.historyPause, res.data['data']);
}
} }
// 清空观看历史 // 清空观看历史

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:media_kit/media_kit.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/models/user/fav_folder.dart'; import 'package:pilipala/models/user/fav_folder.dart';
import 'package:pilipala/pages/main/index.dart'; import 'package:pilipala/pages/main/index.dart';
@ -102,7 +103,11 @@ class _MediaPageState extends State<MediaPage>
], ],
Obx(() => mediaController.userLogin.value Obx(() => mediaController.userLogin.value
? favFolder(mediaController, context) ? favFolder(mediaController, context)
: const SizedBox()) : const SizedBox()),
SizedBox(
height: MediaQuery.of(context).padding.bottom +
kBottomNavigationBarHeight,
)
], ],
), ),
), ),

View File

@ -85,10 +85,9 @@ class VideoIntroController extends GetxController {
if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) { if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) {
lastPlayCid.value = videoDetail.value.pages!.first.cid!; lastPlayCid.value = videoDetail.value.pages!.first.cid!;
} }
// Get.find<VideoDetailController>(tag: heroTag).tabs.value = [ final VideoDetailController videoDetailCtr =
// '简介', Get.find<VideoDetailController>(tag: heroTag);
// '评论 ${result['data']!.stat!.reply}' videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
// ];
// 获取到粉丝数再返回 // 获取到粉丝数再返回
await queryUserStat(); await queryUserStat();
} }

View File

@ -319,62 +319,78 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
), ),
child: Row( child: Material(
children: [ child: Row(
const SizedBox(width: 20), children: [
Expanded( Flexible(
child: TabBar( flex: 1,
controller: vdCtr.tabCtr, child: Obx(
dividerColor: Colors.transparent, () => TabBar(
tabs: vdCtr.tabs.map((String name) => Tab(text: name)).toList(), padding: EdgeInsets.zero,
), controller: vdCtr.tabCtr,
), labelStyle: const TextStyle(fontSize: 13),
SizedBox( labelPadding:
width: 220, const EdgeInsets.symmetric(horizontal: 10.0), // 设置每个标签的宽度
child: Center( dividerColor: Colors.transparent,
child: Row( tabs: vdCtr.tabs
mainAxisAlignment: MainAxisAlignment.end, .map(
children: [ (String name) => Flexible(
SizedBox( child: Tab(text: name),
height: 32, ),
child: TextButton( )
style: ButtonStyle( .toList(),
padding: MaterialStateProperty.all(EdgeInsets.zero), ),
),
onPressed: () => vdCtr.showShootDanmakuSheet(),
child: const Text('发弹幕', style: TextStyle(fontSize: 12)),
),
),
const SizedBox(width: 4),
SizedBox(
width: 34,
height: 32,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () {
plPlayerController?.isOpenDanmu.value =
!(plPlayerController?.isOpenDanmu.value ?? false);
},
child: Obx(() => Text(
'',
style: TextStyle(
fontSize: 12,
color: (plPlayerController?.isOpenDanmu.value ??
false)
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
),
)),
),
),
const SizedBox(width: 14),
],
), ),
), ),
), Flexible(
], flex: 1,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
height: 32,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () => vdCtr.showShootDanmakuSheet(),
child:
const Text('发弹幕', style: TextStyle(fontSize: 12)),
),
),
const SizedBox(width: 4),
SizedBox(
width: 34,
height: 32,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () {
plPlayerController?.isOpenDanmu.value =
!(plPlayerController?.isOpenDanmu.value ??
false);
},
child: Obx(() => Text(
'',
style: TextStyle(
fontSize: 12,
color: (plPlayerController
?.isOpenDanmu.value ??
false)
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
),
)),
),
),
const SizedBox(width: 14),
],
),
)),
],
),
), ),
); );

View File

@ -347,6 +347,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
children: <Widget>[ children: <Widget>[
Obx( Obx(
() => Video( () => Video(
key: ValueKey(_.videoFit.value),
controller: videoController, controller: videoController,
controls: NoVideoControls, controls: NoVideoControls,
pauseUponEnteringBackgroundMode: !enableBackgroundPlay, pauseUponEnteringBackgroundMode: !enableBackgroundPlay,

26
lib/services/sentry.dart Normal file
View File

@ -0,0 +1,26 @@
import 'package:sentry_flutter/sentry_flutter.dart';
class SentryService {
static sentryInit(AppRunner appRunner) async {
return await SentryFlutter.init(
(options) => options
..dsn =
'https://cb0ce70fcda1c903072a6c73cc2d89e2@o4506669621182464.ingest.sentry.io/4506669624459264'
..debug = true // 调试模式下启用
..attachThreads = true // 附带线程信息
..sendDefaultPii = true
..reportPackages = false // 禁用报告包信息
..tracesSampleRate = 0.1 // 要发送的事件百分比
..attachScreenshot = false // 屏幕截图
..attachViewHierarchy = true // 包含视图结构
..reportSilentFlutterErrors = true // 报告静默的 Flutter 错误
..enableAutoPerformanceTracing = true // 自动性能跟踪
..considerInAppFramesByDefault = false // 不考虑应用内帧
..enableWindowMetricBreadcrumbs = true // 启用窗口度量面包屑
..screenshotQuality = SentryScreenshotQuality.low // 屏幕截图质量
..maxRequestBodySize = MaxRequestBodySize.small // 请求体大小
..maxResponseBodySize = MaxResponseBodySize.small, // 响应体大小
appRunner: appRunner,
);
}
}

View File

@ -10,6 +10,7 @@
#include <flutter_volume_controller/flutter_volume_controller_plugin.h> #include <flutter_volume_controller/flutter_volume_controller_plugin.h>
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h> #include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
#include <media_kit_video/media_kit_video_plugin.h> #include <media_kit_video/media_kit_video_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
@ -25,6 +26,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) media_kit_video_registrar = g_autoptr(FlPluginRegistrar) media_kit_video_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin");
media_kit_video_plugin_register_with_registrar(media_kit_video_registrar); media_kit_video_plugin_register_with_registrar(media_kit_video_registrar);
g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View File

@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_volume_controller flutter_volume_controller
media_kit_libs_linux media_kit_libs_linux
media_kit_video media_kit_video
sentry_flutter
url_launcher_linux url_launcher_linux
) )

View File

@ -16,6 +16,7 @@ import media_kit_video
import package_info_plus import package_info_plus
import path_provider_foundation import path_provider_foundation
import screen_brightness_macos import screen_brightness_macos
import sentry_flutter
import share_plus import share_plus
import sqflite import sqflite
import url_launcher_macos import url_launcher_macos
@ -33,6 +34,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin")) ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

View File

@ -1267,10 +1267,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: sentry name: sentry
sha256: "5686ed515bb620dc52b4ae99a6586fe720d443591183cf1f620ec5d1f0eec100" sha256: a7946f4a90b0feb47214981d881b98149e05f6c576da9f2a2f33945bf561de25
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "7.15.0" version: "7.16.0"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
sha256: "6db7fa1b076faf2f5dd77d8cc9ef206171f32a290cc638842d78e5d62b441a27"
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.16.0"
share_plus: share_plus:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -142,6 +142,7 @@ dependencies:
path: 1.8.3 path: 1.8.3
# 电池优化 # 电池优化
disable_battery_optimization: ^1.1.1 disable_battery_optimization: ^1.1.1
sentry_flutter: ^7.16.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View File

@ -13,6 +13,7 @@
#include <media_kit_video/media_kit_video_plugin_c_api.h> #include <media_kit_video/media_kit_video_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h> #include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <screen_brightness_windows/screen_brightness_windows_plugin.h> #include <screen_brightness_windows/screen_brightness_windows_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h> #include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
@ -31,6 +32,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
ScreenBrightnessWindowsPluginRegisterWithRegistrar( ScreenBrightnessWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin")); registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin"));
SentryFlutterPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
SharePlusWindowsPluginCApiRegisterWithRegistrar( SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(

View File

@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
media_kit_video media_kit_video
permission_handler_windows permission_handler_windows
screen_brightness_windows screen_brightness_windows
sentry_flutter
share_plus share_plus
url_launcher_windows url_launcher_windows
) )