From c34dfe02da8322c92d5f5f8259f30489f566f50f Mon Sep 17 00:00:00 2001 From: Plague Fox Date: Thu, 13 Jun 2024 04:17:13 +0400 Subject: [PATCH] Refactor SpinifyImpl to handle missing subscriptions in SpinifySubscriptionMixin --- lib/src/subscription_impl.dart | 6 +++++- lib/src/subscription_interface.dart | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/src/subscription_impl.dart b/lib/src/subscription_impl.dart index 679f7a7..bfbd6e3 100644 --- a/lib/src/subscription_impl.dart +++ b/lib/src/subscription_impl.dart @@ -190,14 +190,18 @@ final class SpinifyClientSubscriptionImpl extends SpinifySubscriptionBase @override Future subscribe() { throw UnimplementedError(); + // TODO(plugfox): implement subscribe, add resubscribe timer } @override Future unsubscribe([ int code = 0, String reason = 'unsubscribe called', - ]) { + ]) async { + if (_state.isUnsubscribed) return Future.value(); + //await ready().timeout(_client.config.timeout); throw UnimplementedError(); + // TODO(plugfox): implement unsubscribe, remove resubscribe timer } } diff --git a/lib/src/subscription_interface.dart b/lib/src/subscription_interface.dart index 9094d39..c6b9e11 100644 --- a/lib/src/subscription_interface.dart +++ b/lib/src/subscription_interface.dart @@ -143,10 +143,10 @@ abstract interface class SpinifyClientSubscription /// Subscription configuration. abstract final SpinifySubscriptionConfig config; - /// Start subscribing to a channel + /// Start subscribing to a channel interactively. Future subscribe(); - /// Unsubscribe from a channel + /// Unsubscribe from a channel interactively. Future unsubscribe([ int code = 0, String reason = 'unsubscribe called',