Compare commits
20 Commits
feature-li
...
feature-se
| Author | SHA1 | Date | |
|---|---|---|---|
| 67c9ff699c | |||
| 74f31a818c | |||
| c216c9bd65 | |||
| 3701fdef97 | |||
| 59641f0216 | |||
| 4dbcd2e0ec | |||
| 6d276fce4c | |||
| 710361caea | |||
| 00b81b194f | |||
| 734db176bf | |||
| 64292d523f | |||
| af96d16062 | |||
| 12c299685b | |||
| 1182a58cb4 | |||
| e04a7e5702 | |||
| e9dc6f7fdb | |||
| 25d1ccc87a | |||
| b13d7b475b | |||
| f41bb02bae | |||
| 105a29f311 |
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import 'package:pilipala/pages/search/index.dart';
|
|||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/router/app_pages.dart';
|
import 'package:pilipala/router/app_pages.dart';
|
||||||
import 'package:pilipala/pages/main/view.dart';
|
import 'package:pilipala/pages/main/view.dart';
|
||||||
|
import 'package:pilipala/services/disable_battery_opt.dart';
|
||||||
import 'package:pilipala/services/service_locator.dart';
|
import 'package:pilipala/services/service_locator.dart';
|
||||||
import 'package:pilipala/utils/app_scheme.dart';
|
import 'package:pilipala/utils/app_scheme.dart';
|
||||||
import 'package:pilipala/utils/data.dart';
|
import 'package:pilipala/utils/data.dart';
|
||||||
@ -24,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();
|
||||||
@ -54,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(
|
||||||
@ -71,6 +97,7 @@ void main() async {
|
|||||||
));
|
));
|
||||||
Data.init();
|
Data.init();
|
||||||
PiliSchame.init();
|
PiliSchame.init();
|
||||||
|
DisableBatteryOpt();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +220,7 @@ class MyApp extends StatelessWidget {
|
|||||||
navigatorObservers: [
|
navigatorObservers: [
|
||||||
VideoDetailPage.routeObserver,
|
VideoDetailPage.routeObserver,
|
||||||
SearchPage.routeObserver,
|
SearchPage.routeObserver,
|
||||||
|
SentryNavigatorObserver(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -148,9 +148,9 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length + 1,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
bool isLastItem = index == widget.pages.length - 1;
|
bool isLastItem = index == widget.pages.length;
|
||||||
bool isCurrentIndex = currentIndex == index;
|
bool isCurrentIndex = currentIndex == index;
|
||||||
return isLastItem
|
return isLastItem
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
|
|||||||
@ -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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清空观看历史
|
// 清空观看历史
|
||||||
|
|||||||
@ -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,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,9 +161,9 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
itemCount: episodes.length,
|
itemCount: episodes.length + 1,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
bool isLastItem = index == episodes.length - 1;
|
bool isLastItem = index == episodes.length;
|
||||||
bool isCurrentIndex = currentIndex == index;
|
bool isCurrentIndex = currentIndex == index;
|
||||||
return isLastItem
|
return isLastItem
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
|
|||||||
@ -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),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
@ -346,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,
|
||||||
@ -674,13 +676,16 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
_distance.value = dy;
|
_distance.value = dy;
|
||||||
} else {
|
} else {
|
||||||
// 右边区域 👈
|
// 右边区域 👈
|
||||||
final double level = (_.isFullScreen.value
|
EasyThrottle.throttle(
|
||||||
? Get.size.height
|
'setVolume', const Duration(milliseconds: 20), () {
|
||||||
: screenWidth * 9 / 16) *
|
final double level = (_.isFullScreen.value
|
||||||
3;
|
? Get.size.height
|
||||||
final double volume = _volumeValue.value - delta / level;
|
: screenWidth * 9 / 16);
|
||||||
final double result = volume.clamp(0.0, 1.0);
|
final double volume = _volumeValue.value -
|
||||||
setVolume(result);
|
double.parse(delta.toStringAsFixed(1)) / level;
|
||||||
|
final double result = volume.clamp(0.0, 1.0);
|
||||||
|
setVolume(result);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onVerticalDragEnd: (DragEndDetails details) {},
|
onVerticalDragEnd: (DragEndDetails details) {},
|
||||||
@ -799,7 +804,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
// 锁
|
// 锁
|
||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
visible: _.videoType.value != 'live',
|
visible: _.videoType.value != 'live' && _.isFullScreen.value,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: FractionalTranslation(
|
child: FractionalTranslation(
|
||||||
|
|||||||
40
lib/services/disable_battery_opt.dart
Normal file
40
lib/services/disable_battery_opt.dart
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:disable_battery_optimization/disable_battery_optimization.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
|
void DisableBatteryOpt() async {
|
||||||
|
if (!Platform.isAndroid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 本地缓存中读取 是否禁用了电池优化 默认未禁用
|
||||||
|
bool isDisableBatteryOptLocal =
|
||||||
|
GStrorage.localCache.get('isDisableBatteryOptLocal', defaultValue: false);
|
||||||
|
if (!isDisableBatteryOptLocal) {
|
||||||
|
final isBatteryOptimizationDisabled =
|
||||||
|
await DisableBatteryOptimization.isBatteryOptimizationDisabled;
|
||||||
|
if (isBatteryOptimizationDisabled == false) {
|
||||||
|
final hasDisabled = await DisableBatteryOptimization
|
||||||
|
.showDisableBatteryOptimizationSettings();
|
||||||
|
// 设置为已禁用
|
||||||
|
GStrorage.localCache.put('isDisableBatteryOptLocal', hasDisabled == true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isManufacturerBatteryOptimizationDisabled = GStrorage.localCache
|
||||||
|
.get('isManufacturerBatteryOptimizationDisabled', defaultValue: false);
|
||||||
|
if (!isManufacturerBatteryOptimizationDisabled) {
|
||||||
|
final isManBatteryOptimizationDisabled = await DisableBatteryOptimization
|
||||||
|
.isManufacturerBatteryOptimizationDisabled;
|
||||||
|
if (isManBatteryOptimizationDisabled == false) {
|
||||||
|
final hasDisabled = await DisableBatteryOptimization
|
||||||
|
.showDisableManufacturerBatteryOptimizationSettings(
|
||||||
|
"当前设备可能有额外的电池优化",
|
||||||
|
"按照步骤操作以禁用电池优化,以保证应用在后台正常运行",
|
||||||
|
);
|
||||||
|
// 设置为已禁用
|
||||||
|
GStrorage.localCache.put(
|
||||||
|
'isManufacturerBatteryOptimizationDisabled', hasDisabled == true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
lib/services/sentry.dart
Normal file
26
lib/services/sentry.dart
Normal 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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,40 +1,94 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:saver_gallery/saver_gallery.dart';
|
import 'package:saver_gallery/saver_gallery.dart';
|
||||||
|
|
||||||
class DownloadUtils {
|
class DownloadUtils {
|
||||||
// 获取存储权限
|
// 获取存储权限
|
||||||
static requestStoragePer() async {
|
static Future<bool> requestStoragePer() async {
|
||||||
Map<Permission, PermissionStatus> statuses = await [
|
await Permission.storage.request();
|
||||||
Permission.storage,
|
PermissionStatus status = await Permission.storage.status;
|
||||||
Permission.photos,
|
if (status == PermissionStatus.denied ||
|
||||||
].request();
|
status == PermissionStatus.permanentlyDenied) {
|
||||||
statuses[Permission.storage].toString();
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: const Text('存储权限未授权'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
openAppSettings();
|
||||||
|
},
|
||||||
|
child: const Text('去授权'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取相册权限
|
||||||
|
static Future<bool> requestPhotoPer() async {
|
||||||
|
await Permission.photos.request();
|
||||||
|
PermissionStatus status = await Permission.photos.status;
|
||||||
|
if (status == PermissionStatus.denied ||
|
||||||
|
status == PermissionStatus.permanentlyDenied) {
|
||||||
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: const Text('相册权限未授权'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
openAppSettings();
|
||||||
|
},
|
||||||
|
child: const Text('去授权'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> downloadImg(String imgUrl,
|
static Future<bool> downloadImg(String imgUrl,
|
||||||
{String imgType = 'cover'}) async {
|
{String imgType = 'cover'}) async {
|
||||||
try {
|
try {
|
||||||
await requestStoragePer();
|
if (!await requestPhotoPer()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
SmartDialog.showLoading(msg: '保存中');
|
SmartDialog.showLoading(msg: '保存中');
|
||||||
var response = await Dio()
|
var response = await Dio()
|
||||||
.get(imgUrl, options: Options(responseType: ResponseType.bytes));
|
.get(imgUrl, options: Options(responseType: ResponseType.bytes));
|
||||||
|
final String imgSuffix = imgUrl.split('.').last;
|
||||||
String picName =
|
String picName =
|
||||||
"plpl_${imgType}_${DateTime.now().toString().split('-').join()}";
|
"plpl_${imgType}_${DateTime.now().toString().replaceAll(RegExp(r'[- :]'), '').split('.').first}";
|
||||||
final SaveResult result = await SaverGallery.saveImage(
|
final SaveResult result = await SaverGallery.saveImage(
|
||||||
Uint8List.fromList(response.data),
|
Uint8List.fromList(response.data),
|
||||||
quality: 60,
|
name: '$picName.$imgSuffix',
|
||||||
name: picName,
|
|
||||||
// 保存到 PiliPala文件夹
|
// 保存到 PiliPala文件夹
|
||||||
androidRelativePath: "Pictures/PiliPala",
|
androidRelativePath: "Pictures/PiliPala",
|
||||||
androidExistNotSave: false,
|
androidExistNotSave: false,
|
||||||
);
|
);
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
await SmartDialog.showToast('「$picName」已保存 ');
|
await SmartDialog.showToast('「${'$picName.$imgSuffix'}」已保存 ');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -172,6 +172,10 @@ class LocalCacheKey {
|
|||||||
// 代理host port
|
// 代理host port
|
||||||
systemProxyHost = 'systemProxyHost',
|
systemProxyHost = 'systemProxyHost',
|
||||||
systemProxyPort = 'systemProxyPort';
|
systemProxyPort = 'systemProxyPort';
|
||||||
|
|
||||||
|
static const String isDisableBatteryOptLocal = 'isDisableBatteryOptLocal',
|
||||||
|
isManufacturerBatteryOptimizationDisabled =
|
||||||
|
'isManufacturerBatteryOptimizationDisabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
class VideoBoxKey {
|
class VideoBoxKey {
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -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"))
|
||||||
|
|||||||
20
pubspec.lock
20
pubspec.lock
@ -393,6 +393,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.0"
|
version: "2.4.0"
|
||||||
|
disable_battery_optimization:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: disable_battery_optimization
|
||||||
|
sha256: "6b2ba802f984af141faf1b6b5fb956d5ef01f9cd555597c35b9cc335a03185ba"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
dismissible_page:
|
dismissible_page:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -1259,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:
|
||||||
|
|||||||
@ -140,6 +140,9 @@ dependencies:
|
|||||||
catcher_2: ^1.1.0
|
catcher_2: ^1.1.0
|
||||||
logger: ^2.0.2+1
|
logger: ^2.0.2+1
|
||||||
path: 1.8.3
|
path: 1.8.3
|
||||||
|
# 电池优化
|
||||||
|
disable_battery_optimization: ^1.1.1
|
||||||
|
sentry_flutter: ^7.16.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user