mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +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
|
|
@ -0,0 +1,44 @@
|
|||
import 'package:openapi/api.dart';
|
||||
|
||||
class ServerConfig {
|
||||
final int trashDays;
|
||||
final String mapTileUrl;
|
||||
|
||||
const ServerConfig({
|
||||
required this.trashDays,
|
||||
required this.mapTileUrl,
|
||||
});
|
||||
|
||||
ServerConfig copyWith({
|
||||
int? trashDays,
|
||||
String? mapTileUrl,
|
||||
}) {
|
||||
return ServerConfig(
|
||||
trashDays: trashDays ?? this.trashDays,
|
||||
mapTileUrl: mapTileUrl ?? this.mapTileUrl,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ServerConfig(trashDays: $trashDays, mapTileUrl: $mapTileUrl)';
|
||||
}
|
||||
|
||||
ServerConfig.fromDto(ServerConfigDto dto)
|
||||
: trashDays = dto.trashDays,
|
||||
mapTileUrl = dto.mapTileUrl;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is ServerConfig &&
|
||||
other.trashDays == trashDays &&
|
||||
other.mapTileUrl == mapTileUrl;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return trashDays.hashCode ^ mapTileUrl.hashCode;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue