Skip to content

Commit

Permalink
Remove deprecated members (#1526)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev authored Feb 23, 2024
1 parent 4b3e9fd commit 93fa54f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 596 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
### Breaking Changes
* `RealmValue.type` is now an enum of type `RealmValueType` rather than `Type`. If you need the runtime type of the value wrapped in `RealmValue`, use `RealmValue.value.runtimeType`. (Issue [#1505](https://github.com/realm/realm-dart/issues/1505))
* Renamed `RealmValue.uint8List` constructor to `RealmValue.binary`. (PR [#1469](https://github.com/realm/realm-dart/pull/1469))
* Removed the following deprecated classes and members:
* `AppConfiguration.localAppName` - was unused and had no effect
* `AppConfiguration.localAppVersion` - was unused and had no effect
* `ClientResetError.isFatal` - it was always `true`
* `ClientResetError.sessionErrorCode`
* `SyncError.codeValue` - can be accessed through `SyncError.code.code`
* `SyncError.category` - categories were deprecated in `1.6.0`
* `SyncError.detailedMessage` - was always empty
* `SyncError` constructor and `SyncError.create` factory - sync errors are created internally by the SDK and are not supposed to be constructed by users
* `SyncClientError`, `SyncConnectionError`, `SyncSessionError`, `SyncResolveError`, `SyncWebSocketError`, `GeneralSyncError` - consolidated into `SyncError` as part of the error simplification in `1.6.0`
* `RealmProperty.indexed` - replaced by `RealmProperty.indexType`
* `SyncErrorCategory`, `SyncClientErrorCode`, `SyncConnectionErrorCode`, `SyncSessionErrorCode`, `SyncResolveErrorCode`, `SyncWebsocketErrorCode`, `GeneralSyncErrorCode` - consolidated into `SyncErrorCode` as part of the error simplification in `1.6.0`
* `User.provider` - the provider is associated with each identity, so the value was incorrect for users who had more than one identity


### Enhancements
* Added `isCollectionDeleted` to `RealmListChanges`, `RealmSetChanges`, and `RealmMapChanges` which will be `true` if the parent object, containing the collection has been deleted. (Core 14.0.0)
Expand Down
18 changes: 0 additions & 18 deletions packages/realm_dart/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,6 @@ class AppConfiguration {
/// the WebSocket handshake. Defaults to 2 minutes.
final Duration maxConnectionTimeout;

/// The [localAppName] is the friendly name identifying the current client application.
///
/// This is typically used to differentiate between client applications that use the same
/// [Atlas App Services](https://www.mongodb.com/docs/atlas/app-services/) application.
///
/// These can be the same conceptual app developed for different platforms, or
/// significantly different client side applications that operate on the same data - e.g. an event managing
/// service that has different clients apps for organizers and attendees.
@Deprecated("localAppName is not used.")
final String? localAppName;

/// The [localAppVersion] can be specified, if you wish to distinguish different client versions of the
/// same application.
@Deprecated("localAppVersion is not used.")
final String? localAppVersion;

/// Enumeration that specifies how and if logged-in User objects are persisted across application launches.
final MetadataPersistenceMode metadataPersistenceMode;

Expand All @@ -149,8 +133,6 @@ class AppConfiguration {
Uri? baseUrl,
Directory? baseFilePath,
this.defaultRequestTimeout = const Duration(seconds: 60),
this.localAppName,
this.localAppVersion,
this.metadataEncryptionKey,
this.metadataPersistenceMode = MetadataPersistenceMode.plaintext,
this.maxConnectionTimeout = const Duration(minutes: 2),
Expand Down
186 changes: 0 additions & 186 deletions packages/realm_dart/lib/src/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -601,38 +601,13 @@ enum ClientResyncModeInternal {
class ClientResetError extends SyncError {
final App? _app;
/// If true the received error is fatal.
@Deprecated("This will be removed in the future.")
final bool isFatal = true;
/// The path to the original copy of the realm when the client reset was triggered.
/// This realm may contain unsynced changes.
final String? originalFilePath;
/// The path where the backup copy of the realm will be placed once the client reset process is complete.
final String? backupFilePath;
/// The [SyncSessionErrorCode] value indicating the type of the sync error.
/// This property will be [SyncSessionErrorCode.unknown] if `onManualResetFallback` occurs on client reset.
@Deprecated("This will be removed in the future.")
SyncSessionErrorCode get sessionErrorCode => SyncSessionErrorCode.unknown;
@Deprecated("ClientResetError constructor is deprecated and will be removed in the future")
ClientResetError(
String message,
this._app, {
SyncErrorCategory category = SyncErrorCategory.client,
int? errorCodeValue,
this.backupFilePath,
this.originalFilePath,
String? detailedMessage,
}) : super(
message,
category,
errorCodeValue ?? SyncClientErrorCode.autoClientResetFailure.code,
detailedMessage: detailedMessage,
);
ClientResetError._(
String message,
SyncErrorCode code,
Expand Down Expand Up @@ -673,31 +648,6 @@ class SyncError extends RealmError {
SyncError._(String message, this.code, this.innerError) : super(message);
/// The numeric code value indicating the type of the sync error.
@Deprecated("Errors of SyncError subclasses will be created base on the error code. Error codes won't be returned anymore.")
int get codeValue => code.code;
/// The category of the sync error
@Deprecated("SyncErrorCategory enum is deprecated.")
late SyncErrorCategory category = SyncErrorCategory.system;
/// Detailed error message.
/// In case of server error, it contains the link to the server log.
@Deprecated("Detailed message is empty. Use `message` property.")
late String? detailedMessage;
@Deprecated("SyncError constructor is deprecated and will be removed in the future")
SyncError(String message, this.category, int codeValue, {this.detailedMessage})
: code = SyncErrorCode.fromInt(codeValue),
innerError = null,
super(message);
/// Creates a specific type of [SyncError] instance based on the [category] and the [code] supplied.
@Deprecated("This method is deprecated and will be removed in the future")
static SyncError create(String message, SyncErrorCategory category, int code, {bool isFatal = false}) {
return SyncError._(message, SyncErrorCode.fromInt(code), null);
}
final Object? innerError;
@override
Expand Down Expand Up @@ -772,139 +722,3 @@ extension SyncErrorInternal on SyncError {
};
}
}
// Deprecated errors - to be removed in 2.0
/// An error type that describes a session-level error condition.
/// {@category Sync}
@Deprecated("Use SyncError.")
class SyncClientError extends SyncError {
/// If true the received error is fatal.
final bool isFatal;
@Deprecated("SyncClientError constructor is deprecated and will be removed in the future")
SyncClientError(
String message,
SyncErrorCategory category,
SyncClientErrorCode errorCode, {
String? detailedMessage,
this.isFatal = false,
}) : super(message, category, errorCode.code, detailedMessage: detailedMessage);
@override
String toString() {
return "SyncClientError message: $message category: $category code: $code isFatal: $isFatal";
}
}
/// An error type that describes a connection-level error condition.
/// {@category Sync}
@Deprecated("Use SyncError.")
class SyncConnectionError extends SyncError {
/// If true the received error is fatal.
final bool isFatal;
@Deprecated("SyncConnectionError constructor is deprecated and will be removed in the future")
SyncConnectionError(
String message,
SyncErrorCategory category,
SyncConnectionErrorCode errorCode, {
String? detailedMessage,
this.isFatal = false,
}) : super(message, category, errorCode.code, detailedMessage: detailedMessage);
@override
String toString() {
return "SyncConnectionError message: $message category: $category code: $code isFatal: $isFatal";
}
}
/// An error type that describes a session-level error condition.
/// {@category Sync}
@Deprecated("Use SyncError.")
class SyncSessionError extends SyncError {
/// If true the received error is fatal.
final bool isFatal;
@Deprecated("SyncSessionError constructor is deprecated and will be removed in the future")
SyncSessionError(
String message,
SyncErrorCategory category,
SyncSessionErrorCode errorCode, {
String? detailedMessage,
this.isFatal = false,
}) : super(message, category, errorCode.code, detailedMessage: detailedMessage);
@override
String toString() {
return "SyncSessionError message: $message category: $category code: $code isFatal: $isFatal";
}
}
/// Network resolution error
///
/// This class is deprecated and it will be removed. The sync errors caused by network resolution problems
/// will be received as [SyncWebSocketError].
@Deprecated("Use SyncError.")
class SyncResolveError extends SyncError {
SyncResolveError(
String message,
SyncErrorCategory category,
SyncResolveErrorCode errorCode,
) : super(message, category, errorCode.index);
@override
String toString() {
return "SyncResolveError message: $message category: $category code: $code";
}
}
/// Web socket error
@Deprecated("Use SyncError.")
class SyncWebSocketError extends SyncError {
@Deprecated("SyncWebSocketError constructor is deprecated and will be removed in the future")
SyncWebSocketError(
String message,
SyncErrorCategory category,
SyncWebSocketErrorCode errorCode, {
String? detailedMessage,
}) : super(message, category, errorCode.code, detailedMessage: detailedMessage);
@override
String toString() {
return "SyncWebSocketError message: $message category: $category code: $code";
}
}
/// A general or unknown sync error
@Deprecated("Use SyncError.")
class GeneralSyncError extends SyncError {
@Deprecated("GeneralSyncError constructor is deprecated and will be removed in the future")
GeneralSyncError(
String message,
SyncErrorCategory category,
int code, {
String? detailedMessage,
}) : super(message, category, code, detailedMessage: detailedMessage);
@override
String toString() {
return "GeneralSyncError message: $message category: $category code: $code";
}
}
/// General sync error codes
@Deprecated("Use SyncError.")
enum GeneralSyncErrorCode {
/// Unknown Sync error code
unknown(9999);
static final Map<int, GeneralSyncErrorCode> _valuesMap = {for (var value in GeneralSyncErrorCode.values) value.code: value};
static GeneralSyncErrorCode fromInt(int code) {
return GeneralSyncErrorCode._valuesMap[code] ?? GeneralSyncErrorCode.unknown;
}
final int code;
const GeneralSyncErrorCode(this.code);
}
4 changes: 0 additions & 4 deletions packages/realm_dart/lib/src/realm_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class SchemaProperty {
/// `true` if the property is a primary key
final bool primaryKey;

/// `true` if the property is indexed
@Deprecated("Use indexType instead")
bool get indexed => indexType == RealmIndexType.regular;

/// Returns the index type for this property
final RealmIndexType? indexType;

Expand Down
1 change: 0 additions & 1 deletion packages/realm_dart/lib/src/results.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ class RealmResultsChanges<T extends Object?> extends RealmCollectionChanges {
RealmResultsChanges._(super.handle, this.results);

@override
@Deprecated("`isCleared` is deprecated. Use `isEmpty` of the results collection instead.")
bool get isCleared => results.isEmpty;
}

Expand Down
Loading

0 comments on commit 93fa54f

Please sign in to comment.