progress on slow mode
This commit is contained in:
@@ -130,6 +130,9 @@ class Channel {
|
||||
return state?.channelStateStream.map((cs) => cs.channel?.cooldown);
|
||||
}
|
||||
|
||||
///
|
||||
DateTime? cooldownStartedAt;
|
||||
|
||||
/// Channel creation date
|
||||
DateTime? get createdAt {
|
||||
_checkInitialized();
|
||||
@@ -429,6 +432,9 @@ class Channel {
|
||||
skipPush: skipPush,
|
||||
);
|
||||
state!.addMessage(response.message);
|
||||
if (cooldown! > 0) {
|
||||
cooldownStartedAt = DateTime.now();
|
||||
}
|
||||
return response;
|
||||
} catch (e) {
|
||||
if (e is StreamChatNetworkError && e.isRetriable) {
|
||||
@@ -827,6 +833,20 @@ class Channel {
|
||||
return _client.updateChannelPartial(id!, type, set: set, unset: unset);
|
||||
}
|
||||
|
||||
/// Enable slow mode
|
||||
Future<UpdateChannelResponse> enableSlowMode({
|
||||
required int cooldownInterval,
|
||||
}) async {
|
||||
_checkInitialized();
|
||||
return _client.enableSlowdown(id!, type, cooldownInterval);
|
||||
}
|
||||
|
||||
/// Disable slow mode
|
||||
Future<UpdateChannelResponse> disableSlowMode() async {
|
||||
_checkInitialized();
|
||||
return _client.disableSlowdown(id!, type);
|
||||
}
|
||||
|
||||
/// Delete this channel. Messages are permanently removed.
|
||||
Future<EmptyResponse> delete() async {
|
||||
_checkInitialized();
|
||||
|
||||
Reference in New Issue
Block a user