mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(mobile): server info to use data classes instead of dtos (#4591)
* refactor: server info model to use data classes instead of dtos * mobile: add return types and refactor private variables in map / stack --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
9b418642a6
commit
b05132a01a
15 changed files with 294 additions and 86 deletions
|
|
@ -1,60 +0,0 @@
|
|||
import 'package:openapi/api.dart';
|
||||
|
||||
class ServerInfoState {
|
||||
final ServerVersionResponseDto serverVersion;
|
||||
final ServerFeaturesDto serverFeatures;
|
||||
final ServerConfigDto serverConfig;
|
||||
final bool isVersionMismatch;
|
||||
final String versionMismatchErrorMessage;
|
||||
|
||||
ServerInfoState({
|
||||
required this.serverVersion,
|
||||
required this.serverFeatures,
|
||||
required this.serverConfig,
|
||||
required this.isVersionMismatch,
|
||||
required this.versionMismatchErrorMessage,
|
||||
});
|
||||
|
||||
ServerInfoState copyWith({
|
||||
ServerVersionResponseDto? serverVersion,
|
||||
ServerFeaturesDto? serverFeatures,
|
||||
ServerConfigDto? serverConfig,
|
||||
bool? isVersionMismatch,
|
||||
String? versionMismatchErrorMessage,
|
||||
}) {
|
||||
return ServerInfoState(
|
||||
serverVersion: serverVersion ?? this.serverVersion,
|
||||
serverFeatures: serverFeatures ?? this.serverFeatures,
|
||||
serverConfig: serverConfig ?? this.serverConfig,
|
||||
isVersionMismatch: isVersionMismatch ?? this.isVersionMismatch,
|
||||
versionMismatchErrorMessage:
|
||||
versionMismatchErrorMessage ?? this.versionMismatchErrorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ServerInfoState( serverVersion: $serverVersion, serverFeatures: $serverFeatures, serverConfig: $serverConfig, isVersionMismatch: $isVersionMismatch, versionMismatchErrorMessage: $versionMismatchErrorMessage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is ServerInfoState &&
|
||||
other.serverVersion == serverVersion &&
|
||||
other.serverFeatures == serverFeatures &&
|
||||
other.serverConfig == serverConfig &&
|
||||
other.isVersionMismatch == isVersionMismatch &&
|
||||
other.versionMismatchErrorMessage == versionMismatchErrorMessage;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return serverVersion.hashCode ^
|
||||
serverFeatures.hashCode ^
|
||||
serverConfig.hashCode ^
|
||||
isVersionMismatch.hashCode ^
|
||||
versionMismatchErrorMessage.hashCode;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue