feat(discord): add listening activity type

This commit is contained in:
Kingkor Roy Tirtho 2024-08-10 21:35:38 +06:00
parent 64d25509b4
commit 84f47df6c1
2 changed files with 30 additions and 28 deletions

View File

@ -17,8 +17,7 @@ class DiscordNotifier extends AsyncNotifier<void> {
var lastPosition = audioPlayer.position; var lastPosition = audioPlayer.position;
final subscriptions = final subscriptions = [
[
FlutterDiscordRPC.instance.isConnectedStream.listen((connected) async { FlutterDiscordRPC.instance.isConnectedStream.listen((connected) async {
final playback = ref.read(audioPlayerProvider); final playback = ref.read(audioPlayerProvider);
if (connected && playback.activeTrack != null) { if (connected && playback.activeTrack != null) {
@ -83,8 +82,11 @@ class DiscordNotifier extends AsyncNotifier<void> {
), ),
], ],
timestamps: RPCTimestamps( timestamps: RPCTimestamps(
start: isPlaying ? DateTime.now().millisecondsSinceEpoch - position.inMilliseconds : null, start: isPlaying
? DateTime.now().millisecondsSinceEpoch - position.inMilliseconds
: null,
), ),
activityType: ActivityType.listening,
), ),
); );
} }

View File

@ -717,7 +717,7 @@ packages:
description: description:
path: "packages/flutter_discord_rpc" path: "packages/flutter_discord_rpc"
ref: cargokit ref: cargokit
resolved-ref: "1b839bf02afd5dfa56b0dc25f60af04aa9bfc7c3" resolved-ref: "331636d8e378e3ac9ad30a4b0d3eed17d5a85fe9"
url: "https://github.com/KRTirtho/frb_plugins.git" url: "https://github.com/KRTirtho/frb_plugins.git"
source: git source: git
version: "0.1.0+1" version: "0.1.0+1"
@ -1484,7 +1484,7 @@ packages:
description: description:
path: "packages/metadata_god" path: "packages/metadata_god"
ref: cargokit ref: cargokit
resolved-ref: "1b839bf02afd5dfa56b0dc25f60af04aa9bfc7c3" resolved-ref: "331636d8e378e3ac9ad30a4b0d3eed17d5a85fe9"
url: "https://github.com/KRTirtho/frb_plugins.git" url: "https://github.com/KRTirtho/frb_plugins.git"
source: git source: git
version: "0.5.3" version: "0.5.3"
@ -1987,7 +1987,7 @@ packages:
description: description:
path: "packages/smtc_windows" path: "packages/smtc_windows"
ref: cargokit ref: cargokit
resolved-ref: "1b839bf02afd5dfa56b0dc25f60af04aa9bfc7c3" resolved-ref: "331636d8e378e3ac9ad30a4b0d3eed17d5a85fe9"
url: "https://github.com/KRTirtho/frb_plugins.git" url: "https://github.com/KRTirtho/frb_plugins.git"
source: git source: git
version: "0.1.3" version: "0.1.3"