mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
Transfer repository from Gitlab
This commit is contained in:
parent
af2efbdbbd
commit
568cc243f0
177 changed files with 13300 additions and 0 deletions
77
mobile/lib/shared/models/backup_state.model.dart
Normal file
77
mobile/lib/shared/models/backup_state.model.dart
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
||||
|
||||
enum BackUpProgressEnum { idle, inProgress, done }
|
||||
|
||||
class BackUpState {
|
||||
final BackUpProgressEnum backupProgress;
|
||||
final int totalAssetCount;
|
||||
final int assetOnDatabase;
|
||||
final int backingUpAssetCount;
|
||||
final double progressInPercentage;
|
||||
final CancelToken cancelToken;
|
||||
final ServerInfo serverInfo;
|
||||
|
||||
BackUpState({
|
||||
required this.backupProgress,
|
||||
required this.totalAssetCount,
|
||||
required this.assetOnDatabase,
|
||||
required this.backingUpAssetCount,
|
||||
required this.progressInPercentage,
|
||||
required this.cancelToken,
|
||||
required this.serverInfo,
|
||||
});
|
||||
|
||||
BackUpState copyWith({
|
||||
BackUpProgressEnum? backupProgress,
|
||||
int? totalAssetCount,
|
||||
int? assetOnDatabase,
|
||||
int? backingUpAssetCount,
|
||||
double? progressInPercentage,
|
||||
CancelToken? cancelToken,
|
||||
ServerInfo? serverInfo,
|
||||
}) {
|
||||
return BackUpState(
|
||||
backupProgress: backupProgress ?? this.backupProgress,
|
||||
totalAssetCount: totalAssetCount ?? this.totalAssetCount,
|
||||
assetOnDatabase: assetOnDatabase ?? this.assetOnDatabase,
|
||||
backingUpAssetCount: backingUpAssetCount ?? this.backingUpAssetCount,
|
||||
progressInPercentage: progressInPercentage ?? this.progressInPercentage,
|
||||
cancelToken: cancelToken ?? this.cancelToken,
|
||||
serverInfo: serverInfo ?? this.serverInfo,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackUpState(backupProgress: $backupProgress, totalAssetCount: $totalAssetCount, assetOnDatabase: $assetOnDatabase, backingUpAssetCount: $backingUpAssetCount, progressInPercentage: $progressInPercentage, cancelToken: $cancelToken, serverInfo: $serverInfo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is BackUpState &&
|
||||
other.backupProgress == backupProgress &&
|
||||
other.totalAssetCount == totalAssetCount &&
|
||||
other.assetOnDatabase == assetOnDatabase &&
|
||||
other.backingUpAssetCount == backingUpAssetCount &&
|
||||
other.progressInPercentage == progressInPercentage &&
|
||||
other.cancelToken == cancelToken &&
|
||||
other.serverInfo == serverInfo;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return backupProgress.hashCode ^
|
||||
totalAssetCount.hashCode ^
|
||||
assetOnDatabase.hashCode ^
|
||||
backingUpAssetCount.hashCode ^
|
||||
progressInPercentage.hashCode ^
|
||||
cancelToken.hashCode ^
|
||||
serverInfo.hashCode;
|
||||
}
|
||||
}
|
||||
100
mobile/lib/shared/models/device_info.model.dart
Normal file
100
mobile/lib/shared/models/device_info.model.dart
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
|
||||
class DeviceInfoRemote {
|
||||
final int id;
|
||||
final String userId;
|
||||
final String deviceId;
|
||||
final String deviceType;
|
||||
final String notificationToken;
|
||||
final String createdAt;
|
||||
final bool isAutoBackup;
|
||||
|
||||
DeviceInfoRemote({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.deviceId,
|
||||
required this.deviceType,
|
||||
required this.notificationToken,
|
||||
required this.createdAt,
|
||||
required this.isAutoBackup,
|
||||
});
|
||||
|
||||
DeviceInfoRemote copyWith({
|
||||
int? id,
|
||||
String? userId,
|
||||
String? deviceId,
|
||||
String? deviceType,
|
||||
String? notificationToken,
|
||||
String? createdAt,
|
||||
bool? isAutoBackup,
|
||||
}) {
|
||||
return DeviceInfoRemote(
|
||||
id: id ?? this.id,
|
||||
userId: userId ?? this.userId,
|
||||
deviceId: deviceId ?? this.deviceId,
|
||||
deviceType: deviceType ?? this.deviceType,
|
||||
notificationToken: notificationToken ?? this.notificationToken,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
isAutoBackup: isAutoBackup ?? this.isAutoBackup,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'userId': userId,
|
||||
'deviceId': deviceId,
|
||||
'deviceType': deviceType,
|
||||
'notificationToken': notificationToken,
|
||||
'createdAt': createdAt,
|
||||
'isAutoBackup': isAutoBackup,
|
||||
};
|
||||
}
|
||||
|
||||
factory DeviceInfoRemote.fromMap(Map<String, dynamic> map) {
|
||||
return DeviceInfoRemote(
|
||||
id: map['id']?.toInt() ?? 0,
|
||||
userId: map['userId'] ?? '',
|
||||
deviceId: map['deviceId'] ?? '',
|
||||
deviceType: map['deviceType'] ?? '',
|
||||
notificationToken: map['notificationToken'] ?? '',
|
||||
createdAt: map['createdAt'] ?? '',
|
||||
isAutoBackup: map['isAutoBackup'] ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory DeviceInfoRemote.fromJson(String source) => DeviceInfoRemote.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DeviceInfo(id: $id, userId: $userId, deviceId: $deviceId, deviceType: $deviceType, notificationToken: $notificationToken, createdAt: $createdAt, isAutoBackup: $isAutoBackup)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is DeviceInfoRemote &&
|
||||
other.id == id &&
|
||||
other.userId == userId &&
|
||||
other.deviceId == deviceId &&
|
||||
other.deviceType == deviceType &&
|
||||
other.notificationToken == notificationToken &&
|
||||
other.createdAt == createdAt &&
|
||||
other.isAutoBackup == isAutoBackup;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return id.hashCode ^
|
||||
userId.hashCode ^
|
||||
deviceId.hashCode ^
|
||||
deviceType.hashCode ^
|
||||
notificationToken.hashCode ^
|
||||
createdAt.hashCode ^
|
||||
isAutoBackup.hashCode;
|
||||
}
|
||||
}
|
||||
11
mobile/lib/shared/models/image_viewer_page_data.model.dart
Normal file
11
mobile/lib/shared/models/image_viewer_page_data.model.dart
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class ImageViewerPageData {
|
||||
final String heroTag;
|
||||
final String imageUrl;
|
||||
final String thumbnailUrl;
|
||||
|
||||
ImageViewerPageData({
|
||||
required this.heroTag,
|
||||
required this.imageUrl,
|
||||
required this.thumbnailUrl,
|
||||
});
|
||||
}
|
||||
131
mobile/lib/shared/models/immich_asset.model.dart
Normal file
131
mobile/lib/shared/models/immich_asset.model.dart
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
import 'dart:convert';
|
||||
|
||||
class ImmichAsset {
|
||||
final String id;
|
||||
final String deviceAssetId;
|
||||
final String userId;
|
||||
final String deviceId;
|
||||
final String assetType;
|
||||
final String localPath;
|
||||
final String remotePath;
|
||||
final String createdAt;
|
||||
final String modifiedAt;
|
||||
final bool isFavorite;
|
||||
final String? description;
|
||||
|
||||
ImmichAsset({
|
||||
required this.id,
|
||||
required this.deviceAssetId,
|
||||
required this.userId,
|
||||
required this.deviceId,
|
||||
required this.assetType,
|
||||
required this.localPath,
|
||||
required this.remotePath,
|
||||
required this.createdAt,
|
||||
required this.modifiedAt,
|
||||
required this.isFavorite,
|
||||
this.description,
|
||||
});
|
||||
|
||||
ImmichAsset copyWith({
|
||||
String? id,
|
||||
String? deviceAssetId,
|
||||
String? userId,
|
||||
String? deviceId,
|
||||
String? assetType,
|
||||
String? localPath,
|
||||
String? remotePath,
|
||||
String? createdAt,
|
||||
String? modifiedAt,
|
||||
bool? isFavorite,
|
||||
String? description,
|
||||
}) {
|
||||
return ImmichAsset(
|
||||
id: id ?? this.id,
|
||||
deviceAssetId: deviceAssetId ?? this.deviceAssetId,
|
||||
userId: userId ?? this.userId,
|
||||
deviceId: deviceId ?? this.deviceId,
|
||||
assetType: assetType ?? this.assetType,
|
||||
localPath: localPath ?? this.localPath,
|
||||
remotePath: remotePath ?? this.remotePath,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
modifiedAt: modifiedAt ?? this.modifiedAt,
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
description: description ?? this.description,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'deviceAssetId': deviceAssetId,
|
||||
'userId': userId,
|
||||
'deviceId': deviceId,
|
||||
'assetType': assetType,
|
||||
'localPath': localPath,
|
||||
'remotePath': remotePath,
|
||||
'createdAt': createdAt,
|
||||
'modifiedAt': modifiedAt,
|
||||
'isFavorite': isFavorite,
|
||||
'description': description,
|
||||
};
|
||||
}
|
||||
|
||||
factory ImmichAsset.fromMap(Map<String, dynamic> map) {
|
||||
return ImmichAsset(
|
||||
id: map['id'] ?? '',
|
||||
deviceAssetId: map['deviceAssetId'] ?? '',
|
||||
userId: map['userId'] ?? '',
|
||||
deviceId: map['deviceId'] ?? '',
|
||||
assetType: map['assetType'] ?? '',
|
||||
localPath: map['localPath'] ?? '',
|
||||
remotePath: map['remotePath'] ?? '',
|
||||
createdAt: map['createdAt'] ?? '',
|
||||
modifiedAt: map['modifiedAt'] ?? '',
|
||||
isFavorite: map['isFavorite'] ?? false,
|
||||
description: map['description'],
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory ImmichAsset.fromJson(String source) => ImmichAsset.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ImmichAsset(id: $id, deviceAssetId: $deviceAssetId, userId: $userId, deviceId: $deviceId, assetType: $assetType, localPath: $localPath, remotePath: $remotePath, createdAt: $createdAt, modifiedAt: $modifiedAt, isFavorite: $isFavorite, description: $description)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is ImmichAsset &&
|
||||
other.id == id &&
|
||||
other.deviceAssetId == deviceAssetId &&
|
||||
other.userId == userId &&
|
||||
other.deviceId == deviceId &&
|
||||
other.assetType == assetType &&
|
||||
other.localPath == localPath &&
|
||||
other.remotePath == remotePath &&
|
||||
other.createdAt == createdAt &&
|
||||
other.modifiedAt == modifiedAt &&
|
||||
other.isFavorite == isFavorite &&
|
||||
other.description == description;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return id.hashCode ^
|
||||
deviceAssetId.hashCode ^
|
||||
userId.hashCode ^
|
||||
deviceId.hashCode ^
|
||||
assetType.hashCode ^
|
||||
localPath.hashCode ^
|
||||
remotePath.hashCode ^
|
||||
createdAt.hashCode ^
|
||||
modifiedAt.hashCode ^
|
||||
isFavorite.hashCode ^
|
||||
description.hashCode;
|
||||
}
|
||||
}
|
||||
98
mobile/lib/shared/models/server_info.model.dart
Normal file
98
mobile/lib/shared/models/server_info.model.dart
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
import 'dart:convert';
|
||||
|
||||
class ServerInfo {
|
||||
final String diskSize;
|
||||
final String diskUse;
|
||||
final String diskAvailable;
|
||||
final int diskSizeRaw;
|
||||
final int diskUseRaw;
|
||||
final int diskAvailableRaw;
|
||||
final double diskUsagePercentage;
|
||||
ServerInfo({
|
||||
required this.diskSize,
|
||||
required this.diskUse,
|
||||
required this.diskAvailable,
|
||||
required this.diskSizeRaw,
|
||||
required this.diskUseRaw,
|
||||
required this.diskAvailableRaw,
|
||||
required this.diskUsagePercentage,
|
||||
});
|
||||
|
||||
ServerInfo copyWith({
|
||||
String? diskSize,
|
||||
String? diskUse,
|
||||
String? diskAvailable,
|
||||
int? diskSizeRaw,
|
||||
int? diskUseRaw,
|
||||
int? diskAvailableRaw,
|
||||
double? diskUsagePercentage,
|
||||
}) {
|
||||
return ServerInfo(
|
||||
diskSize: diskSize ?? this.diskSize,
|
||||
diskUse: diskUse ?? this.diskUse,
|
||||
diskAvailable: diskAvailable ?? this.diskAvailable,
|
||||
diskSizeRaw: diskSizeRaw ?? this.diskSizeRaw,
|
||||
diskUseRaw: diskUseRaw ?? this.diskUseRaw,
|
||||
diskAvailableRaw: diskAvailableRaw ?? this.diskAvailableRaw,
|
||||
diskUsagePercentage: diskUsagePercentage ?? this.diskUsagePercentage,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'diskSize': diskSize,
|
||||
'diskUse': diskUse,
|
||||
'diskAvailable': diskAvailable,
|
||||
'diskSizeRaw': diskSizeRaw,
|
||||
'diskUseRaw': diskUseRaw,
|
||||
'diskAvailableRaw': diskAvailableRaw,
|
||||
'diskUsagePercentage': diskUsagePercentage,
|
||||
};
|
||||
}
|
||||
|
||||
factory ServerInfo.fromMap(Map<String, dynamic> map) {
|
||||
return ServerInfo(
|
||||
diskSize: map['diskSize'] ?? '',
|
||||
diskUse: map['diskUse'] ?? '',
|
||||
diskAvailable: map['diskAvailable'] ?? '',
|
||||
diskSizeRaw: map['diskSizeRaw']?.toInt() ?? 0,
|
||||
diskUseRaw: map['diskUseRaw']?.toInt() ?? 0,
|
||||
diskAvailableRaw: map['diskAvailableRaw']?.toInt() ?? 0,
|
||||
diskUsagePercentage: map['diskUsagePercentage']?.toDouble() ?? 0.0,
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory ServerInfo.fromJson(String source) => ServerInfo.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ServerInfo(diskSize: $diskSize, diskUse: $diskUse, diskAvailable: $diskAvailable, diskSizeRaw: $diskSizeRaw, diskUseRaw: $diskUseRaw, diskAvailableRaw: $diskAvailableRaw, diskUsagePercentage: $diskUsagePercentage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is ServerInfo &&
|
||||
other.diskSize == diskSize &&
|
||||
other.diskUse == diskUse &&
|
||||
other.diskAvailable == diskAvailable &&
|
||||
other.diskSizeRaw == diskSizeRaw &&
|
||||
other.diskUseRaw == diskUseRaw &&
|
||||
other.diskAvailableRaw == diskAvailableRaw &&
|
||||
other.diskUsagePercentage == diskUsagePercentage;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return diskSize.hashCode ^
|
||||
diskUse.hashCode ^
|
||||
diskAvailable.hashCode ^
|
||||
diskSizeRaw.hashCode ^
|
||||
diskUseRaw.hashCode ^
|
||||
diskAvailableRaw.hashCode ^
|
||||
diskUsagePercentage.hashCode;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue