Project import generated by Copybara.

GitOrigin-RevId: c94e3eec92e2b3c3a820d6d7cef3860b80fc14d1
This commit is contained in:
Madari Developers 2025-01-09 08:27:08 +00:00
parent d0dc2c2410
commit 79b2b2ca0e
3 changed files with 15 additions and 47 deletions

View file

@ -7,6 +7,8 @@ PODS:
- connectivity_plus (0.0.1):
- Flutter
- FlutterMacOS
- device_info_plus (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.9):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
@ -174,14 +176,12 @@ PODS:
- Flutter
- wakelock_plus (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS
DEPENDENCIES:
- background_downloader (from `.symlinks/plugins/background_downloader/ios`)
- bonsoir_darwin (from `.symlinks/plugins/bonsoir_darwin/darwin`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`)
@ -203,7 +203,6 @@ DEPENDENCIES:
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- volume_controller (from `.symlinks/plugins/volume_controller/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)
SPEC REPOS:
trunk:
@ -236,6 +235,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/bonsoir_darwin/darwin"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/darwin"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
Flutter:
@ -270,13 +271,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/volume_controller/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"
SPEC CHECKSUMS:
background_downloader: 9f788ffc5de45acf87d6380e91ca0841066c18cf
bonsoir_darwin: e3b8526c42ca46a885142df84229131dfabea842
connectivity_plus: 18382e7311ba19efcaee94442b23b32507b20695
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
@ -315,7 +315,6 @@ SPEC CHECKSUMS:
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
PODFILE CHECKSUM: b02c94e3a8abdba64191e66ef2b4faf4842a32c2

View file

@ -62,6 +62,11 @@ class _VideoViewerState extends State<VideoViewer> {
saveWatchHistory() {
final duration = player.state.duration.inSeconds;
if (duration < 30) {
return;
}
final position = player.state.position.inSeconds;
final progress = duration > 0 ? (position / duration * 100).round() : 0;
@ -186,6 +191,7 @@ class _VideoViewerState extends State<VideoViewer> {
if ((progress ?? []).isEmpty) {
player.play();
return;
}
final duration = Duration(
@ -197,48 +203,10 @@ class _VideoViewerState extends State<VideoViewer> {
player.seek(duration);
player.play();
addListenerForTrakt();
}
List<StreamSubscription> listener = [];
bool traktIntegration = false;
addListenerForTrakt() {
if (traktIntegration == true) {
return;
}
traktIntegration = true;
final streams = player.stream.playing.listen((item) {
if (item) {
TraktService.instance!.startScrobbling(
meta: widget.meta as types.Meta,
progress: currentProgressInPercentage,
);
} else {
TraktService.instance!.pauseScrobbling(
meta: widget.meta as types.Meta,
progress: currentProgressInPercentage,
);
}
});
final oneMore = player.stream.completed.listen((item) {
if (item && player.state.duration.inSeconds > 10) {
TraktService.instance!.stopScrobbling(
meta: widget.meta as types.Meta,
progress: currentProgressInPercentage,
);
}
});
listener.add(streams);
listener.add(oneMore);
}
PlaybackConfig config = getPlaybackConfig();
bool defaultConfigSelected = false;
@ -417,7 +385,9 @@ class _VideoViewerState extends State<VideoViewer> {
_streamListen.cancel();
_duration.cancel();
if (traktIntegration && widget.meta is types.Meta) {
if (traktIntegration &&
widget.meta is types.Meta &&
player.state.duration.inSeconds > 30) {
TraktService.instance!.stopScrobbling(
meta: widget.meta as types.Meta,
progress: currentProgressInPercentage,

View file

@ -606,7 +606,6 @@ class TraktService {
);
if (response.statusCode != 201) {
print(response.statusCode);
throw Exception('Failed to stop scrobbling');
}