mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(mobile): Use switch expression when possible (#15852)
refactor: Use `switch` expression when possible Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
4efacfbb91
commit
96a6cc20b7
17 changed files with 219 additions and 374 deletions
|
|
@ -545,19 +545,13 @@ enum AssetType {
|
|||
}
|
||||
|
||||
extension AssetTypeEnumHelper on AssetTypeEnum {
|
||||
AssetType toAssetType() {
|
||||
switch (this) {
|
||||
case AssetTypeEnum.IMAGE:
|
||||
return AssetType.image;
|
||||
case AssetTypeEnum.VIDEO:
|
||||
return AssetType.video;
|
||||
case AssetTypeEnum.AUDIO:
|
||||
return AssetType.audio;
|
||||
case AssetTypeEnum.OTHER:
|
||||
return AssetType.other;
|
||||
}
|
||||
throw Exception();
|
||||
}
|
||||
AssetType toAssetType() => switch (this) {
|
||||
AssetTypeEnum.IMAGE => AssetType.image,
|
||||
AssetTypeEnum.VIDEO => AssetType.video,
|
||||
AssetTypeEnum.AUDIO => AssetType.audio,
|
||||
AssetTypeEnum.OTHER => AssetType.other,
|
||||
_ => throw Exception(),
|
||||
};
|
||||
}
|
||||
|
||||
/// Describes where the information of this asset came from:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue