mirror of
https://github.com/immich-app/immich.git
synced 2024-12-21 01:39:59 +02:00
40a8115101
* Fixed app not resuming backup after closing and reopening the app * Fixed cosmetic effect of backup button doesn't change state right away after pressing start backup * Fixed grammar * Fixed deep copy problem that cause incorrect asset count when backing up * Format code
74 lines
1.5 KiB
Dart
74 lines
1.5 KiB
Dart
import 'dart:convert';
|
|
|
|
class ServerVersion {
|
|
final int major;
|
|
final int minor;
|
|
final int patch;
|
|
final int build;
|
|
|
|
ServerVersion({
|
|
required this.major,
|
|
required this.minor,
|
|
required this.patch,
|
|
required this.build,
|
|
});
|
|
|
|
ServerVersion copyWith({
|
|
int? major,
|
|
int? minor,
|
|
int? patch,
|
|
int? build,
|
|
}) {
|
|
return ServerVersion(
|
|
major: major ?? this.major,
|
|
minor: minor ?? this.minor,
|
|
patch: patch ?? this.patch,
|
|
build: build ?? this.build,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'major': major,
|
|
'minor': minor,
|
|
'patch': patch,
|
|
'build': build,
|
|
};
|
|
}
|
|
|
|
factory ServerVersion.fromMap(Map<String, dynamic> map) {
|
|
return ServerVersion(
|
|
major: map['major']?.toInt() ?? 0,
|
|
minor: map['minor']?.toInt() ?? 0,
|
|
patch: map['patch']?.toInt() ?? 0,
|
|
build: map['build']?.toInt() ?? 0,
|
|
);
|
|
}
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory ServerVersion.fromJson(String source) =>
|
|
ServerVersion.fromMap(json.decode(source));
|
|
|
|
@override
|
|
String toString() {
|
|
return 'ServerVersion(major: $major, minor: $minor, patch: $patch, build: $build)';
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return other is ServerVersion &&
|
|
other.major == major &&
|
|
other.minor == minor &&
|
|
other.patch == patch &&
|
|
other.build == build;
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return major.hashCode ^ minor.hashCode ^ patch.hashCode ^ build.hashCode;
|
|
}
|
|
}
|