chore(repo): remove deprecated code.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -17,7 +17,6 @@ import 'package:stream_chat/src/core/http/stream_http_client.dart';
|
||||
import 'package:stream_chat/src/core/http/token.dart';
|
||||
import 'package:stream_chat/src/core/http/token_manager.dart';
|
||||
import 'package:stream_chat/src/core/models/attachment_file.dart';
|
||||
import 'package:stream_chat/src/core/models/channel_model.dart';
|
||||
import 'package:stream_chat/src/core/models/channel_state.dart';
|
||||
import 'package:stream_chat/src/core/models/event.dart';
|
||||
import 'package:stream_chat/src/core/models/filter.dart';
|
||||
@@ -572,8 +571,6 @@ class StreamChatClient {
|
||||
/// Requests channels with a given query.
|
||||
Stream<List<Channel>> queryChannels({
|
||||
Filter? filter,
|
||||
@Deprecated('Use channelStateSort instead.')
|
||||
List<SortOption<ChannelModel>>? sort,
|
||||
List<SortOption<ChannelState>>? channelStateSort,
|
||||
bool state = true,
|
||||
bool watch = true,
|
||||
@@ -590,7 +587,7 @@ class StreamChatClient {
|
||||
|
||||
final hash = generateHash([
|
||||
filter,
|
||||
sort,
|
||||
channelStateSort,
|
||||
state,
|
||||
watch,
|
||||
presence,
|
||||
@@ -604,8 +601,6 @@ class StreamChatClient {
|
||||
} else {
|
||||
final channels = await queryChannelsOffline(
|
||||
filter: filter,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
sort: sort,
|
||||
channelStateSort: channelStateSort,
|
||||
paginationParams: paginationParams,
|
||||
);
|
||||
@@ -614,7 +609,7 @@ class StreamChatClient {
|
||||
try {
|
||||
final newQueryChannelsFuture = queryChannelsOnline(
|
||||
filter: filter,
|
||||
sort: channelStateSort ?? sort,
|
||||
sort: channelStateSort,
|
||||
state: state,
|
||||
watch: watch,
|
||||
presence: presence,
|
||||
@@ -731,17 +726,11 @@ class StreamChatClient {
|
||||
/// Requests channels with a given query from the Persistence client.
|
||||
Future<List<Channel>> queryChannelsOffline({
|
||||
Filter? filter,
|
||||
@Deprecated('''
|
||||
sort has been deprecated.
|
||||
Please use channelStateSort instead.''')
|
||||
List<SortOption<ChannelModel>>? sort,
|
||||
List<SortOption<ChannelState>>? channelStateSort,
|
||||
PaginationParams paginationParams = const PaginationParams(),
|
||||
}) async {
|
||||
final offlineChannels = (await chatPersistenceClient?.getChannelStates(
|
||||
filter: filter,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
sort: sort,
|
||||
channelStateSort: channelStateSort,
|
||||
paginationParams: paginationParams,
|
||||
)) ??
|
||||
|
||||
@@ -13,7 +13,6 @@ class RetryPolicy {
|
||||
/// Instantiate a new RetryPolicy
|
||||
RetryPolicy({
|
||||
required this.shouldRetry,
|
||||
@Deprecated("Use 'delayFactor' instead.") this.retryTimeout,
|
||||
this.maxRetryAttempts = 6,
|
||||
this.delayFactor = const Duration(milliseconds: 200),
|
||||
this.randomizationFactor = 0.25,
|
||||
@@ -53,13 +52,4 @@ class RetryPolicy {
|
||||
int attempt,
|
||||
StreamChatError? error,
|
||||
) shouldRetry;
|
||||
|
||||
/// In the case that we want to retry a failed request the retryTimeout
|
||||
/// method is called to determine the timeout
|
||||
@Deprecated("Use 'delayFactor' instead.")
|
||||
final Duration Function(
|
||||
StreamChatClient client,
|
||||
int attempt,
|
||||
StreamChatError? error,
|
||||
)? retryTimeout;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
|
||||
@@ -88,11 +88,6 @@ class StreamChatNetworkError extends StreamChatError {
|
||||
this.isRequestCancelledError = false,
|
||||
}) : super(message);
|
||||
|
||||
///
|
||||
@Deprecated('Use `StreamChatNetworkError.fromDioException` instead')
|
||||
factory StreamChatNetworkError.fromDioError(DioException error) =
|
||||
StreamChatNetworkError.fromDioException;
|
||||
|
||||
///
|
||||
factory StreamChatNetworkError.fromDioException(DioException exception) {
|
||||
final response = exception.response;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:stream_chat/src/core/models/user.dart';
|
||||
|
||||
@@ -15,70 +15,6 @@ class _NullConst {
|
||||
|
||||
const _nullConst = _NullConst();
|
||||
|
||||
/// Enum defining the status of a sending message.
|
||||
enum MessageSendingStatus {
|
||||
/// Message is being sent
|
||||
sending,
|
||||
|
||||
/// Message is being updated
|
||||
updating,
|
||||
|
||||
/// Message is being deleted
|
||||
deleting,
|
||||
|
||||
/// Message failed to send
|
||||
failed,
|
||||
|
||||
/// Message failed to updated
|
||||
// ignore: constant_identifier_names
|
||||
failed_update,
|
||||
|
||||
/// Message failed to delete
|
||||
// ignore: constant_identifier_names
|
||||
failed_delete,
|
||||
|
||||
/// Message correctly sent
|
||||
sent;
|
||||
|
||||
/// Returns a [MessageState] from a [MessageSendingStatus]
|
||||
MessageState toMessageState() {
|
||||
switch (this) {
|
||||
case MessageSendingStatus.sending:
|
||||
return MessageState.sending;
|
||||
case MessageSendingStatus.updating:
|
||||
return MessageState.updating;
|
||||
case MessageSendingStatus.deleting:
|
||||
return MessageState.softDeleting;
|
||||
case MessageSendingStatus.failed:
|
||||
return MessageState.sendingFailed;
|
||||
case MessageSendingStatus.failed_update:
|
||||
return MessageState.updatingFailed;
|
||||
case MessageSendingStatus.failed_delete:
|
||||
return MessageState.softDeletingFailed;
|
||||
case MessageSendingStatus.sent:
|
||||
return MessageState.sent;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a [MessageSendingStatus] from a [MessageState].
|
||||
static MessageSendingStatus fromMessageState(MessageState state) {
|
||||
return state.when(
|
||||
initial: () => MessageSendingStatus.sending,
|
||||
outgoing: (it) => it.when(
|
||||
sending: () => MessageSendingStatus.sending,
|
||||
updating: () => MessageSendingStatus.updating,
|
||||
deleting: (_) => MessageSendingStatus.deleting,
|
||||
),
|
||||
completed: (_) => MessageSendingStatus.sent,
|
||||
failed: (it, __) => it.when(
|
||||
sendingFailed: () => MessageSendingStatus.failed,
|
||||
updatingFailed: () => MessageSendingStatus.failed_update,
|
||||
deletingFailed: (_) => MessageSendingStatus.failed_delete,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The class that contains the information about a message.
|
||||
@JsonSerializable()
|
||||
class Message extends Equatable {
|
||||
@@ -114,23 +50,14 @@ class Message extends Equatable {
|
||||
DateTime? pinExpires,
|
||||
this.pinnedBy,
|
||||
this.extraData = const {},
|
||||
@Deprecated('Use `state` instead') MessageSendingStatus? status,
|
||||
MessageState? state,
|
||||
this.state = const MessageState.initial(),
|
||||
this.i18n,
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
pinExpires = pinExpires?.toUtc(),
|
||||
remoteCreatedAt = createdAt,
|
||||
remoteUpdatedAt = updatedAt,
|
||||
remoteDeletedAt = deletedAt,
|
||||
_quotedMessageId = quotedMessageId {
|
||||
var messageState = state ?? const MessageState.initial();
|
||||
// Backward compatibility. TODO: Remove in the next major version
|
||||
if (status != null) {
|
||||
messageState = status.toMessageState();
|
||||
}
|
||||
|
||||
this.state = messageState;
|
||||
}
|
||||
_quotedMessageId = quotedMessageId;
|
||||
|
||||
/// Create a new instance from JSON.
|
||||
factory Message.fromJson(Map<String, dynamic> json) {
|
||||
@@ -155,17 +82,9 @@ class Message extends Equatable {
|
||||
/// The text of this message.
|
||||
final String? text;
|
||||
|
||||
/// The status of a sending message.
|
||||
@Deprecated('Use `state` instead')
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
MessageSendingStatus get status {
|
||||
return MessageSendingStatus.fromMessageState(state);
|
||||
}
|
||||
|
||||
// TODO: Remove late modifier in the next major version.
|
||||
/// The current state of the message.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
late final MessageState state;
|
||||
final MessageState state;
|
||||
|
||||
/// The message type.
|
||||
@JsonKey(includeToJson: false)
|
||||
@@ -381,7 +300,6 @@ class Message extends Equatable {
|
||||
Object? pinExpires = _nullConst,
|
||||
User? pinnedBy,
|
||||
Map<String, Object?>? extraData,
|
||||
@Deprecated('Use `state` instead') MessageSendingStatus? status,
|
||||
MessageState? state,
|
||||
Map<String, String>? i18n,
|
||||
}) {
|
||||
@@ -416,8 +334,6 @@ class Message extends Equatable {
|
||||
return true;
|
||||
}(), 'Validate type for quotedMessage');
|
||||
|
||||
final messageState = state ?? status?.toMessageState();
|
||||
|
||||
return Message(
|
||||
id: id ?? this.id,
|
||||
text: text ?? this.text,
|
||||
@@ -454,7 +370,7 @@ class Message extends Equatable {
|
||||
pinExpires == _nullConst ? this.pinExpires : pinExpires as DateTime?,
|
||||
pinnedBy: pinnedBy ?? this.pinnedBy,
|
||||
extraData: extraData ?? this.extraData,
|
||||
state: messageState ?? this.state,
|
||||
state: state ?? this.state,
|
||||
i18n: i18n ?? this.i18n,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -102,8 +102,6 @@ abstract class ChatPersistenceClient {
|
||||
/// for filtering out states.
|
||||
Future<List<ChannelState>> getChannelStates({
|
||||
Filter? filter,
|
||||
@Deprecated('Use channelStateSort instead.')
|
||||
List<SortOption<ChannelModel>>? sort,
|
||||
List<SortOption<ChannelState>>? channelStateSort,
|
||||
PaginationParams? paginationParams,
|
||||
});
|
||||
|
||||
@@ -62,8 +62,6 @@ class TestPersistenceClient extends ChatPersistenceClient {
|
||||
@override
|
||||
Future<List<ChannelState>> getChannelStates(
|
||||
{Filter? filter,
|
||||
@Deprecated('Use channelStateSort instead.')
|
||||
List<SortOption<ChannelModel>>? sort,
|
||||
List<SortOption<ChannelState>>? channelStateSort,
|
||||
PaginationParams? paginationParams}) =>
|
||||
throw UnimplementedError();
|
||||
|
||||
Reference in New Issue
Block a user