Bump album version

This commit is contained in:
Ming Ming 2021-11-18 17:02:16 +08:00
parent b6a9ff2d1d
commit 3527e96f7a
3 changed files with 25 additions and 1 deletions

View file

@ -189,7 +189,7 @@ class Album with EquatableMixin {
final File? albumFile;
/// versioning of this class, use to upgrade old persisted album
static const version = 6;
static const version = 7;
}
class AlbumShare with EquatableMixin {

View file

@ -206,6 +206,24 @@ class AlbumUpgraderV5 implements AlbumUpgrader {
static final _log = Logger("entity.album.upgrader.AlbumUpgraderV5");
}
/// Upgrade v6 Album to v7
class AlbumUpgraderV6 implements AlbumUpgrader {
const AlbumUpgraderV6({
this.logFilePath,
});
@override
call(JsonObj json) {
_log.fine("[call] Upgrade v6 Album for file: $logFilePath");
return json;
}
static final _log = Logger("entity.album.upgrader.AlbumUpgraderV6");
/// File path for logging only
final String? logFilePath;
}
abstract class AlbumUpgraderFactory {
const AlbumUpgraderFactory();
@ -214,6 +232,7 @@ abstract class AlbumUpgraderFactory {
AlbumUpgraderV3? buildV3();
AlbumUpgraderV4? buildV4();
AlbumUpgraderV5? buildV5();
AlbumUpgraderV6? buildV6();
}
class DefaultAlbumUpgraderFactory extends AlbumUpgraderFactory {
@ -242,6 +261,9 @@ class DefaultAlbumUpgraderFactory extends AlbumUpgraderFactory {
logFilePath: logFilePath,
);
@override
buildV6() => AlbumUpgraderV6(logFilePath: logFilePath);
final Account account;
final File? albumFile;

View file

@ -1778,4 +1778,6 @@ class _NullAlbumUpgraderFactory extends AlbumUpgraderFactory {
buildV4() => null;
@override
buildV5() => null;
@override
buildV6() => null;
}