mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 05:08:40 +00:00
fix #363
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
87187843fa
commit
3899c8e6e4
16 changed files with 358 additions and 118 deletions
|
|
@ -100,6 +100,14 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
.get();
|
||||
}
|
||||
|
||||
Future<List<MediaFile>> getAllNonHashedStoredMediaFiles() async {
|
||||
return (select(mediaFiles)
|
||||
..where(
|
||||
(t) => t.stored.equals(true) & t.storedFileHash.isNull(),
|
||||
))
|
||||
.get();
|
||||
}
|
||||
|
||||
Future<List<MediaFile>> getAllMediaFilesPendingUpload() async {
|
||||
return (select(mediaFiles)
|
||||
..where(
|
||||
|
|
@ -111,7 +119,10 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
}
|
||||
|
||||
Stream<List<MediaFile>> watchAllStoredMediaFiles() {
|
||||
return (select(mediaFiles)..where((t) => t.stored.equals(true))).watch();
|
||||
final query = (select(mediaFiles)..where((t) => t.stored.equals(true)))
|
||||
.join([])
|
||||
..groupBy([mediaFiles.storedFileHash]);
|
||||
return query.map((row) => row.readTable(mediaFiles)).watch();
|
||||
}
|
||||
|
||||
Stream<List<MediaFile>> watchNewestMediaFiles() {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -59,6 +59,8 @@ class MediaFiles extends Table {
|
|||
BlobColumn get encryptionMac => blob().nullable()();
|
||||
BlobColumn get encryptionNonce => blob().nullable()();
|
||||
|
||||
BlobColumn get storedFileHash => blob().nullable()();
|
||||
|
||||
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ class TwonlyDB extends _$TwonlyDB {
|
|||
},
|
||||
from4To5: (m, schema) async {
|
||||
await m.addColumn(schema.receipts, schema.receipts.markForRetry);
|
||||
await m.addColumn(
|
||||
schema.mediaFiles,
|
||||
schema.mediaFiles.storedFileHash,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1996,6 +1996,12 @@ class $MediaFilesTable extends MediaFiles
|
|||
late final GeneratedColumn<Uint8List> encryptionNonce =
|
||||
GeneratedColumn<Uint8List>('encryption_nonce', aliasedName, true,
|
||||
type: DriftSqlType.blob, requiredDuringInsert: false);
|
||||
static const VerificationMeta _storedFileHashMeta =
|
||||
const VerificationMeta('storedFileHash');
|
||||
@override
|
||||
late final GeneratedColumn<Uint8List> storedFileHash =
|
||||
GeneratedColumn<Uint8List>('stored_file_hash', aliasedName, true,
|
||||
type: DriftSqlType.blob, requiredDuringInsert: false);
|
||||
static const VerificationMeta _createdAtMeta =
|
||||
const VerificationMeta('createdAt');
|
||||
@override
|
||||
|
|
@ -2020,6 +2026,7 @@ class $MediaFilesTable extends MediaFiles
|
|||
encryptionKey,
|
||||
encryptionMac,
|
||||
encryptionNonce,
|
||||
storedFileHash,
|
||||
createdAt
|
||||
];
|
||||
@override
|
||||
|
|
@ -2091,6 +2098,12 @@ class $MediaFilesTable extends MediaFiles
|
|||
encryptionNonce.isAcceptableOrUnknown(
|
||||
data['encryption_nonce']!, _encryptionNonceMeta));
|
||||
}
|
||||
if (data.containsKey('stored_file_hash')) {
|
||||
context.handle(
|
||||
_storedFileHashMeta,
|
||||
storedFileHash.isAcceptableOrUnknown(
|
||||
data['stored_file_hash']!, _storedFileHashMeta));
|
||||
}
|
||||
if (data.containsKey('created_at')) {
|
||||
context.handle(_createdAtMeta,
|
||||
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta));
|
||||
|
|
@ -2137,6 +2150,8 @@ class $MediaFilesTable extends MediaFiles
|
|||
.read(DriftSqlType.blob, data['${effectivePrefix}encryption_mac']),
|
||||
encryptionNonce: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.blob, data['${effectivePrefix}encryption_nonce']),
|
||||
storedFileHash: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.blob, data['${effectivePrefix}stored_file_hash']),
|
||||
createdAt: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
|
||||
);
|
||||
|
|
@ -2181,6 +2196,7 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
final Uint8List? encryptionKey;
|
||||
final Uint8List? encryptionMac;
|
||||
final Uint8List? encryptionNonce;
|
||||
final Uint8List? storedFileHash;
|
||||
final DateTime createdAt;
|
||||
const MediaFile(
|
||||
{required this.mediaId,
|
||||
|
|
@ -2197,6 +2213,7 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
this.encryptionKey,
|
||||
this.encryptionMac,
|
||||
this.encryptionNonce,
|
||||
this.storedFileHash,
|
||||
required this.createdAt});
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
|
|
@ -2241,6 +2258,9 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
if (!nullToAbsent || encryptionNonce != null) {
|
||||
map['encryption_nonce'] = Variable<Uint8List>(encryptionNonce);
|
||||
}
|
||||
if (!nullToAbsent || storedFileHash != null) {
|
||||
map['stored_file_hash'] = Variable<Uint8List>(storedFileHash);
|
||||
}
|
||||
map['created_at'] = Variable<DateTime>(createdAt);
|
||||
return map;
|
||||
}
|
||||
|
|
@ -2280,6 +2300,9 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
encryptionNonce: encryptionNonce == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(encryptionNonce),
|
||||
storedFileHash: storedFileHash == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(storedFileHash),
|
||||
createdAt: Value(createdAt),
|
||||
);
|
||||
}
|
||||
|
|
@ -2308,6 +2331,7 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
encryptionKey: serializer.fromJson<Uint8List?>(json['encryptionKey']),
|
||||
encryptionMac: serializer.fromJson<Uint8List?>(json['encryptionMac']),
|
||||
encryptionNonce: serializer.fromJson<Uint8List?>(json['encryptionNonce']),
|
||||
storedFileHash: serializer.fromJson<Uint8List?>(json['storedFileHash']),
|
||||
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||
);
|
||||
}
|
||||
|
|
@ -2333,6 +2357,7 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
'encryptionKey': serializer.toJson<Uint8List?>(encryptionKey),
|
||||
'encryptionMac': serializer.toJson<Uint8List?>(encryptionMac),
|
||||
'encryptionNonce': serializer.toJson<Uint8List?>(encryptionNonce),
|
||||
'storedFileHash': serializer.toJson<Uint8List?>(storedFileHash),
|
||||
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||
};
|
||||
}
|
||||
|
|
@ -2352,6 +2377,7 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
Value<Uint8List?> encryptionKey = const Value.absent(),
|
||||
Value<Uint8List?> encryptionMac = const Value.absent(),
|
||||
Value<Uint8List?> encryptionNonce = const Value.absent(),
|
||||
Value<Uint8List?> storedFileHash = const Value.absent(),
|
||||
DateTime? createdAt}) =>
|
||||
MediaFile(
|
||||
mediaId: mediaId ?? this.mediaId,
|
||||
|
|
@ -2379,6 +2405,8 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
encryptionNonce: encryptionNonce.present
|
||||
? encryptionNonce.value
|
||||
: this.encryptionNonce,
|
||||
storedFileHash:
|
||||
storedFileHash.present ? storedFileHash.value : this.storedFileHash,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
);
|
||||
MediaFile copyWithCompanion(MediaFilesCompanion data) {
|
||||
|
|
@ -2417,6 +2445,9 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
encryptionNonce: data.encryptionNonce.present
|
||||
? data.encryptionNonce.value
|
||||
: this.encryptionNonce,
|
||||
storedFileHash: data.storedFileHash.present
|
||||
? data.storedFileHash.value
|
||||
: this.storedFileHash,
|
||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||
);
|
||||
}
|
||||
|
|
@ -2438,6 +2469,7 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
..write('encryptionKey: $encryptionKey, ')
|
||||
..write('encryptionMac: $encryptionMac, ')
|
||||
..write('encryptionNonce: $encryptionNonce, ')
|
||||
..write('storedFileHash: $storedFileHash, ')
|
||||
..write('createdAt: $createdAt')
|
||||
..write(')'))
|
||||
.toString();
|
||||
|
|
@ -2459,6 +2491,7 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
$driftBlobEquality.hash(encryptionKey),
|
||||
$driftBlobEquality.hash(encryptionMac),
|
||||
$driftBlobEquality.hash(encryptionNonce),
|
||||
$driftBlobEquality.hash(storedFileHash),
|
||||
createdAt);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
|
|
@ -2479,6 +2512,8 @@ class MediaFile extends DataClass implements Insertable<MediaFile> {
|
|||
$driftBlobEquality.equals(other.encryptionMac, this.encryptionMac) &&
|
||||
$driftBlobEquality.equals(
|
||||
other.encryptionNonce, this.encryptionNonce) &&
|
||||
$driftBlobEquality.equals(
|
||||
other.storedFileHash, this.storedFileHash) &&
|
||||
other.createdAt == this.createdAt);
|
||||
}
|
||||
|
||||
|
|
@ -2497,6 +2532,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
final Value<Uint8List?> encryptionKey;
|
||||
final Value<Uint8List?> encryptionMac;
|
||||
final Value<Uint8List?> encryptionNonce;
|
||||
final Value<Uint8List?> storedFileHash;
|
||||
final Value<DateTime> createdAt;
|
||||
final Value<int> rowid;
|
||||
const MediaFilesCompanion({
|
||||
|
|
@ -2514,6 +2550,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
this.encryptionKey = const Value.absent(),
|
||||
this.encryptionMac = const Value.absent(),
|
||||
this.encryptionNonce = const Value.absent(),
|
||||
this.storedFileHash = const Value.absent(),
|
||||
this.createdAt = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
|
@ -2532,6 +2569,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
this.encryptionKey = const Value.absent(),
|
||||
this.encryptionMac = const Value.absent(),
|
||||
this.encryptionNonce = const Value.absent(),
|
||||
this.storedFileHash = const Value.absent(),
|
||||
this.createdAt = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
}) : mediaId = Value(mediaId),
|
||||
|
|
@ -2551,6 +2589,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
Expression<Uint8List>? encryptionKey,
|
||||
Expression<Uint8List>? encryptionMac,
|
||||
Expression<Uint8List>? encryptionNonce,
|
||||
Expression<Uint8List>? storedFileHash,
|
||||
Expression<DateTime>? createdAt,
|
||||
Expression<int>? rowid,
|
||||
}) {
|
||||
|
|
@ -2572,6 +2611,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
if (encryptionKey != null) 'encryption_key': encryptionKey,
|
||||
if (encryptionMac != null) 'encryption_mac': encryptionMac,
|
||||
if (encryptionNonce != null) 'encryption_nonce': encryptionNonce,
|
||||
if (storedFileHash != null) 'stored_file_hash': storedFileHash,
|
||||
if (createdAt != null) 'created_at': createdAt,
|
||||
if (rowid != null) 'rowid': rowid,
|
||||
});
|
||||
|
|
@ -2592,6 +2632,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
Value<Uint8List?>? encryptionKey,
|
||||
Value<Uint8List?>? encryptionMac,
|
||||
Value<Uint8List?>? encryptionNonce,
|
||||
Value<Uint8List?>? storedFileHash,
|
||||
Value<DateTime>? createdAt,
|
||||
Value<int>? rowid}) {
|
||||
return MediaFilesCompanion(
|
||||
|
|
@ -2611,6 +2652,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
encryptionKey: encryptionKey ?? this.encryptionKey,
|
||||
encryptionMac: encryptionMac ?? this.encryptionMac,
|
||||
encryptionNonce: encryptionNonce ?? this.encryptionNonce,
|
||||
storedFileHash: storedFileHash ?? this.storedFileHash,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
rowid: rowid ?? this.rowid,
|
||||
);
|
||||
|
|
@ -2668,6 +2710,9 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
if (encryptionNonce.present) {
|
||||
map['encryption_nonce'] = Variable<Uint8List>(encryptionNonce.value);
|
||||
}
|
||||
if (storedFileHash.present) {
|
||||
map['stored_file_hash'] = Variable<Uint8List>(storedFileHash.value);
|
||||
}
|
||||
if (createdAt.present) {
|
||||
map['created_at'] = Variable<DateTime>(createdAt.value);
|
||||
}
|
||||
|
|
@ -2694,6 +2739,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFile> {
|
|||
..write('encryptionKey: $encryptionKey, ')
|
||||
..write('encryptionMac: $encryptionMac, ')
|
||||
..write('encryptionNonce: $encryptionNonce, ')
|
||||
..write('storedFileHash: $storedFileHash, ')
|
||||
..write('createdAt: $createdAt, ')
|
||||
..write('rowid: $rowid')
|
||||
..write(')'))
|
||||
|
|
@ -9390,6 +9436,7 @@ typedef $$MediaFilesTableCreateCompanionBuilder = MediaFilesCompanion Function({
|
|||
Value<Uint8List?> encryptionKey,
|
||||
Value<Uint8List?> encryptionMac,
|
||||
Value<Uint8List?> encryptionNonce,
|
||||
Value<Uint8List?> storedFileHash,
|
||||
Value<DateTime> createdAt,
|
||||
Value<int> rowid,
|
||||
});
|
||||
|
|
@ -9408,6 +9455,7 @@ typedef $$MediaFilesTableUpdateCompanionBuilder = MediaFilesCompanion Function({
|
|||
Value<Uint8List?> encryptionKey,
|
||||
Value<Uint8List?> encryptionMac,
|
||||
Value<Uint8List?> encryptionNonce,
|
||||
Value<Uint8List?> storedFileHash,
|
||||
Value<DateTime> createdAt,
|
||||
Value<int> rowid,
|
||||
});
|
||||
|
|
@ -9494,6 +9542,10 @@ class $$MediaFilesTableFilterComposer
|
|||
column: $table.encryptionNonce,
|
||||
builder: (column) => ColumnFilters(column));
|
||||
|
||||
ColumnFilters<Uint8List> get storedFileHash => $composableBuilder(
|
||||
column: $table.storedFileHash,
|
||||
builder: (column) => ColumnFilters(column));
|
||||
|
||||
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
||||
column: $table.createdAt, builder: (column) => ColumnFilters(column));
|
||||
|
||||
|
|
@ -9579,6 +9631,10 @@ class $$MediaFilesTableOrderingComposer
|
|||
column: $table.encryptionNonce,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
|
||||
ColumnOrderings<Uint8List> get storedFileHash => $composableBuilder(
|
||||
column: $table.storedFileHash,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
|
||||
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
||||
column: $table.createdAt, builder: (column) => ColumnOrderings(column));
|
||||
}
|
||||
|
|
@ -9637,6 +9693,9 @@ class $$MediaFilesTableAnnotationComposer
|
|||
GeneratedColumn<Uint8List> get encryptionNonce => $composableBuilder(
|
||||
column: $table.encryptionNonce, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<Uint8List> get storedFileHash => $composableBuilder(
|
||||
column: $table.storedFileHash, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<DateTime> get createdAt =>
|
||||
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
||||
|
||||
|
|
@ -9699,6 +9758,7 @@ class $$MediaFilesTableTableManager extends RootTableManager<
|
|||
Value<Uint8List?> encryptionKey = const Value.absent(),
|
||||
Value<Uint8List?> encryptionMac = const Value.absent(),
|
||||
Value<Uint8List?> encryptionNonce = const Value.absent(),
|
||||
Value<Uint8List?> storedFileHash = const Value.absent(),
|
||||
Value<DateTime> createdAt = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) =>
|
||||
|
|
@ -9717,6 +9777,7 @@ class $$MediaFilesTableTableManager extends RootTableManager<
|
|||
encryptionKey: encryptionKey,
|
||||
encryptionMac: encryptionMac,
|
||||
encryptionNonce: encryptionNonce,
|
||||
storedFileHash: storedFileHash,
|
||||
createdAt: createdAt,
|
||||
rowid: rowid,
|
||||
),
|
||||
|
|
@ -9735,6 +9796,7 @@ class $$MediaFilesTableTableManager extends RootTableManager<
|
|||
Value<Uint8List?> encryptionKey = const Value.absent(),
|
||||
Value<Uint8List?> encryptionMac = const Value.absent(),
|
||||
Value<Uint8List?> encryptionNonce = const Value.absent(),
|
||||
Value<Uint8List?> storedFileHash = const Value.absent(),
|
||||
Value<DateTime> createdAt = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) =>
|
||||
|
|
@ -9753,6 +9815,7 @@ class $$MediaFilesTableTableManager extends RootTableManager<
|
|||
encryptionKey: encryptionKey,
|
||||
encryptionMac: encryptionMac,
|
||||
encryptionNonce: encryptionNonce,
|
||||
storedFileHash: storedFileHash,
|
||||
createdAt: createdAt,
|
||||
rowid: rowid,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -2033,7 +2033,7 @@ final class Schema5 extends i0.VersionedSchema {
|
|||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape2 mediaFiles = Shape2(
|
||||
late final Shape18 mediaFiles = Shape18(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'media_files',
|
||||
withoutRowId: false,
|
||||
|
|
@ -2056,6 +2056,7 @@ final class Schema5 extends i0.VersionedSchema {
|
|||
_column_47,
|
||||
_column_48,
|
||||
_column_49,
|
||||
_column_102,
|
||||
_column_12,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
|
|
@ -2145,7 +2146,7 @@ final class Schema5 extends i0.VersionedSchema {
|
|||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape18 receipts = Shape18(
|
||||
late final Shape19 receipts = Shape19(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'receipts',
|
||||
withoutRowId: false,
|
||||
|
|
@ -2159,7 +2160,7 @@ final class Schema5 extends i0.VersionedSchema {
|
|||
_column_75,
|
||||
_column_76,
|
||||
_column_77,
|
||||
_column_102,
|
||||
_column_103,
|
||||
_column_78,
|
||||
_column_79,
|
||||
_column_80,
|
||||
|
|
@ -2326,6 +2327,47 @@ final class Schema5 extends i0.VersionedSchema {
|
|||
|
||||
class Shape18 extends i0.VersionedTable {
|
||||
Shape18({required super.source, required super.alias}) : super.aliased();
|
||||
i1.GeneratedColumn<String> get mediaId =>
|
||||
columnsByName['media_id']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get type =>
|
||||
columnsByName['type']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get uploadState =>
|
||||
columnsByName['upload_state']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get downloadState =>
|
||||
columnsByName['download_state']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<bool> get requiresAuthentication =>
|
||||
columnsByName['requires_authentication']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get stored =>
|
||||
columnsByName['stored']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get isDraftMedia =>
|
||||
columnsByName['is_draft_media']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<String> get reuploadRequestedBy =>
|
||||
columnsByName['reupload_requested_by']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<int> get displayLimitInMilliseconds =>
|
||||
columnsByName['display_limit_in_milliseconds']!
|
||||
as i1.GeneratedColumn<int>;
|
||||
i1.GeneratedColumn<bool> get removeAudio =>
|
||||
columnsByName['remove_audio']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<i2.Uint8List> get downloadToken =>
|
||||
columnsByName['download_token']! as i1.GeneratedColumn<i2.Uint8List>;
|
||||
i1.GeneratedColumn<i2.Uint8List> get encryptionKey =>
|
||||
columnsByName['encryption_key']! as i1.GeneratedColumn<i2.Uint8List>;
|
||||
i1.GeneratedColumn<i2.Uint8List> get encryptionMac =>
|
||||
columnsByName['encryption_mac']! as i1.GeneratedColumn<i2.Uint8List>;
|
||||
i1.GeneratedColumn<i2.Uint8List> get encryptionNonce =>
|
||||
columnsByName['encryption_nonce']! as i1.GeneratedColumn<i2.Uint8List>;
|
||||
i1.GeneratedColumn<i2.Uint8List> get storedFileHash =>
|
||||
columnsByName['stored_file_hash']! as i1.GeneratedColumn<i2.Uint8List>;
|
||||
i1.GeneratedColumn<DateTime> get createdAt =>
|
||||
columnsByName['created_at']! as i1.GeneratedColumn<DateTime>;
|
||||
}
|
||||
|
||||
i1.GeneratedColumn<i2.Uint8List> _column_102(String aliasedName) =>
|
||||
i1.GeneratedColumn<i2.Uint8List>('stored_file_hash', aliasedName, true,
|
||||
type: i1.DriftSqlType.blob);
|
||||
|
||||
class Shape19 extends i0.VersionedTable {
|
||||
Shape19({required super.source, required super.alias}) : super.aliased();
|
||||
i1.GeneratedColumn<String> get receiptId =>
|
||||
columnsByName['receipt_id']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<int> get contactId =>
|
||||
|
|
@ -2348,7 +2390,7 @@ class Shape18 extends i0.VersionedTable {
|
|||
columnsByName['created_at']! as i1.GeneratedColumn<DateTime>;
|
||||
}
|
||||
|
||||
i1.GeneratedColumn<DateTime> _column_102(String aliasedName) =>
|
||||
i1.GeneratedColumn<DateTime> _column_103(String aliasedName) =>
|
||||
i1.GeneratedColumn<DateTime>('mark_for_retry', aliasedName, true,
|
||||
type: i1.DriftSqlType.dateTime);
|
||||
i0.MigrationStepWithVersion migrationSteps({
|
||||
|
|
|
|||
|
|
@ -461,5 +461,6 @@
|
|||
"showImagePreviewWhenSending": "Bildvorschau bei der Auswahl von Empfängern anzeigen",
|
||||
"verifiedPublicKey": "Der öffentliche Schlüssel von {username} wurde überprüft und ist gültig.",
|
||||
"memoriesAYearAgo": "Vor einem Jahr",
|
||||
"memoriesXYearsAgo": "Vor {years} Jahren"
|
||||
"memoriesXYearsAgo": "Vor {years} Jahren",
|
||||
"migrationOfMemories": "Migration von Mediendateien: {open} noch offen."
|
||||
}
|
||||
|
|
@ -491,5 +491,6 @@
|
|||
"showImagePreviewWhenSending": "Display image preview when selecting recipients",
|
||||
"verifiedPublicKey": "The public key of {username} has been verified and is valid.",
|
||||
"memoriesAYearAgo": "One year ago",
|
||||
"memoriesXYearsAgo": "{years} years ago"
|
||||
"memoriesXYearsAgo": "{years} years ago",
|
||||
"migrationOfMemories": "Migration of media files: {open} still to be processed."
|
||||
}
|
||||
|
|
@ -2869,6 +2869,12 @@ abstract class AppLocalizations {
|
|||
/// In en, this message translates to:
|
||||
/// **'{years} years ago'**
|
||||
String memoriesXYearsAgo(Object years);
|
||||
|
||||
/// No description provided for @migrationOfMemories.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Migration of media files: {open} still to be processed.'**
|
||||
String migrationOfMemories(Object open);
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
|
|
|||
|
|
@ -1590,4 +1590,9 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
String memoriesXYearsAgo(Object years) {
|
||||
return 'Vor $years Jahren';
|
||||
}
|
||||
|
||||
@override
|
||||
String migrationOfMemories(Object open) {
|
||||
return 'Migration von Mediendateien: $open noch offen.';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1580,4 +1580,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
String memoriesXYearsAgo(Object years) {
|
||||
return '$years years ago';
|
||||
}
|
||||
|
||||
@override
|
||||
String migrationOfMemories(Object open) {
|
||||
return 'Migration of media files: $open still to be processed.';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ class UserData {
|
|||
@JsonKey(defaultValue: true)
|
||||
bool showFeedbackShortcut = true;
|
||||
|
||||
@JsonKey(defaultValue: true)
|
||||
bool showShowImagePreviewWhenSending = true;
|
||||
@JsonKey(defaultValue: false)
|
||||
bool showShowImagePreviewWhenSending = false;
|
||||
|
||||
@JsonKey(defaultValue: true)
|
||||
bool startWithCameraOpen = true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import 'package:twonly/src/database/twonly.db.dart';
|
|||
import 'package:twonly/src/services/mediafiles/compression.service.dart';
|
||||
import 'package:twonly/src/services/mediafiles/thumbnail.service.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
|
||||
class MediaFileService {
|
||||
MediaFileService(this.mediaFile);
|
||||
|
|
@ -223,6 +224,22 @@ class MediaFileService {
|
|||
);
|
||||
}
|
||||
unawaited(createThumbnail());
|
||||
await hashStoredMedia();
|
||||
// updateFromDb is done in hashStoredMedia()
|
||||
}
|
||||
|
||||
Future<void> hashStoredMedia() async {
|
||||
if (!storedPath.existsSync()) {
|
||||
Log.error('could not create hash value as media file is not stored.');
|
||||
return;
|
||||
}
|
||||
final checksum = await sha256File(storedPath);
|
||||
await twonlyDB.mediaFilesDao.updateMedia(
|
||||
mediaFile.mediaId,
|
||||
MediaFilesCompanion(
|
||||
storedFileHash: Value(Uint8List.fromList(checksum)),
|
||||
),
|
||||
);
|
||||
await updateFromDB();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_image_compress/flutter_image_compress.dart';
|
||||
|
|
@ -367,3 +369,12 @@ void printWrapped(String text) {
|
|||
// ignore: avoid_print
|
||||
pattern.allMatches(text).forEach((match) => print(match.group(0)));
|
||||
}
|
||||
|
||||
Future<List<int>> sha256File(File file) async {
|
||||
final input = file.openRead();
|
||||
final sha256Sink = AccumulatorSink<Digest>();
|
||||
final converter = sha256.startChunkedConversion(sha256Sink);
|
||||
await input.forEach(converter.add);
|
||||
converter.close();
|
||||
return sha256Sink.events.single.bytes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:twonly/src/database/twonly.db.dart';
|
|||
import 'package:twonly/src/model/memory_item.model.dart';
|
||||
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/components/loader.dart';
|
||||
import 'package:twonly/src/views/memories/memories_item_thumbnail.dart';
|
||||
import 'package:twonly/src/views/memories/memories_photo_slider.view.dart';
|
||||
|
||||
|
|
@ -18,6 +19,7 @@ class MemoriesView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class MemoriesViewState extends State<MemoriesView> {
|
||||
int _filesToMigrate = 0;
|
||||
List<MemoryItem> galleryItems = [];
|
||||
Map<String, List<int>> orderedByMonth = {};
|
||||
List<String> months = [];
|
||||
|
|
@ -38,6 +40,21 @@ class MemoriesViewState extends State<MemoriesView> {
|
|||
}
|
||||
|
||||
Future<void> initAsync() async {
|
||||
final nonHashedFiles =
|
||||
await twonlyDB.mediaFilesDao.getAllNonHashedStoredMediaFiles();
|
||||
if (nonHashedFiles.isNotEmpty) {
|
||||
setState(() {
|
||||
_filesToMigrate = nonHashedFiles.length;
|
||||
});
|
||||
for (final mediaFile in nonHashedFiles) {
|
||||
final mediaService = MediaFileService(mediaFile);
|
||||
await mediaService.hashStoredMedia();
|
||||
setState(() {
|
||||
_filesToMigrate -= 1;
|
||||
});
|
||||
}
|
||||
_filesToMigrate = 0;
|
||||
}
|
||||
await messageSub?.cancel();
|
||||
final msgStream = twonlyDB.mediaFilesDao.watchAllStoredMediaFiles();
|
||||
|
||||
|
|
@ -96,122 +113,139 @@ class MemoriesViewState extends State<MemoriesView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Memories')),
|
||||
body: Scrollbar(
|
||||
child: (galleryItems.isEmpty)
|
||||
? Center(
|
||||
child: Text(
|
||||
context.lang.memoriesEmpty,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: (months.length * 2) +
|
||||
(_galleryItemsLastYears.isEmpty ? 0 : 1),
|
||||
itemBuilder: (context, mIndex) {
|
||||
if (_galleryItemsLastYears.isNotEmpty && mIndex == 0) {
|
||||
return SizedBox(
|
||||
height: 140,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: _galleryItemsLastYears.entries.map(
|
||||
(item) {
|
||||
var text = context.lang.memoriesAYearAgo;
|
||||
if (item.key > 1) {
|
||||
text = context.lang.memoriesXYearsAgo(item.key);
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
await open(context, item.value, 0);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
spreadRadius: -12,
|
||||
blurRadius: 12,
|
||||
),
|
||||
],
|
||||
Widget child = Center(
|
||||
child: Text(
|
||||
context.lang.memoriesEmpty,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
if (_filesToMigrate > 0) {
|
||||
child = Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ThreeRotatingDots(
|
||||
size: 40,
|
||||
color: context.color.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
context.lang.migrationOfMemories(_filesToMigrate),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else if (galleryItems.isNotEmpty) {
|
||||
child = ListView.builder(
|
||||
itemCount:
|
||||
(months.length * 2) + (_galleryItemsLastYears.isEmpty ? 0 : 1),
|
||||
itemBuilder: (context, mIndex) {
|
||||
if (_galleryItemsLastYears.isNotEmpty && mIndex == 0) {
|
||||
return SizedBox(
|
||||
height: 140,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: _galleryItemsLastYears.entries.map(
|
||||
(item) {
|
||||
var text = context.lang.memoriesAYearAgo;
|
||||
if (item.key > 1) {
|
||||
text = context.lang.memoriesXYearsAgo(item.key);
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
await open(context, item.value, 0);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
spreadRadius: -12,
|
||||
blurRadius: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
height: 150,
|
||||
width: 120,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Image.file(
|
||||
item.value.first.mediaService.storedPath,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
height: 150,
|
||||
width: 120,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Image.file(
|
||||
item.value.first.mediaService
|
||||
.storedPath,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color:
|
||||
Color.fromARGB(122, 0, 0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Color.fromARGB(122, 0, 0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (_galleryItemsLastYears.isNotEmpty) {
|
||||
mIndex -= 1;
|
||||
}
|
||||
if (mIndex.isEven) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(months[(mIndex ~/ 2)]),
|
||||
);
|
||||
}
|
||||
final index = (mIndex - 1) ~/ 2;
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const ClampingScrollPhysics(),
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
childAspectRatio: 9 / 16,
|
||||
),
|
||||
itemCount: orderedByMonth[months[index]]!.length,
|
||||
itemBuilder: (context, gIndex) {
|
||||
final gaIndex = orderedByMonth[months[index]]![gIndex];
|
||||
return MemoriesItemThumbnail(
|
||||
galleryItem: galleryItems[gaIndex],
|
||||
onTap: () async {
|
||||
await open(context, galleryItems, gaIndex);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
},
|
||||
).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (_galleryItemsLastYears.isNotEmpty) {
|
||||
mIndex -= 1;
|
||||
}
|
||||
if (mIndex.isEven) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(months[(mIndex ~/ 2)]),
|
||||
);
|
||||
}
|
||||
final index = (mIndex - 1) ~/ 2;
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const ClampingScrollPhysics(),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
childAspectRatio: 9 / 16,
|
||||
),
|
||||
itemCount: orderedByMonth[months[index]]!.length,
|
||||
itemBuilder: (context, gIndex) {
|
||||
final gaIndex = orderedByMonth[months[index]]![gIndex];
|
||||
return MemoriesItemThumbnail(
|
||||
galleryItem: galleryItems[gaIndex],
|
||||
onTap: () async {
|
||||
await open(context, galleryItems, gaIndex);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Memories')),
|
||||
body: Scrollbar(
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1626,6 +1626,9 @@ class MediaFiles extends Table with TableInfo<MediaFiles, MediaFilesData> {
|
|||
late final GeneratedColumn<i2.Uint8List> encryptionNonce =
|
||||
GeneratedColumn<i2.Uint8List>('encryption_nonce', aliasedName, true,
|
||||
type: DriftSqlType.blob, requiredDuringInsert: false);
|
||||
late final GeneratedColumn<i2.Uint8List> storedFileHash =
|
||||
GeneratedColumn<i2.Uint8List>('stored_file_hash', aliasedName, true,
|
||||
type: DriftSqlType.blob, requiredDuringInsert: false);
|
||||
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
||||
'created_at', aliasedName, false,
|
||||
type: DriftSqlType.dateTime,
|
||||
|
|
@ -1648,6 +1651,7 @@ class MediaFiles extends Table with TableInfo<MediaFiles, MediaFilesData> {
|
|||
encryptionKey,
|
||||
encryptionMac,
|
||||
encryptionNonce,
|
||||
storedFileHash,
|
||||
createdAt
|
||||
];
|
||||
@override
|
||||
|
|
@ -1691,6 +1695,8 @@ class MediaFiles extends Table with TableInfo<MediaFiles, MediaFilesData> {
|
|||
.read(DriftSqlType.blob, data['${effectivePrefix}encryption_mac']),
|
||||
encryptionNonce: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.blob, data['${effectivePrefix}encryption_nonce']),
|
||||
storedFileHash: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.blob, data['${effectivePrefix}stored_file_hash']),
|
||||
createdAt: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
|
||||
);
|
||||
|
|
@ -1717,6 +1723,7 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
final i2.Uint8List? encryptionKey;
|
||||
final i2.Uint8List? encryptionMac;
|
||||
final i2.Uint8List? encryptionNonce;
|
||||
final i2.Uint8List? storedFileHash;
|
||||
final DateTime createdAt;
|
||||
const MediaFilesData(
|
||||
{required this.mediaId,
|
||||
|
|
@ -1733,6 +1740,7 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
this.encryptionKey,
|
||||
this.encryptionMac,
|
||||
this.encryptionNonce,
|
||||
this.storedFileHash,
|
||||
required this.createdAt});
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
|
|
@ -1770,6 +1778,9 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
if (!nullToAbsent || encryptionNonce != null) {
|
||||
map['encryption_nonce'] = Variable<i2.Uint8List>(encryptionNonce);
|
||||
}
|
||||
if (!nullToAbsent || storedFileHash != null) {
|
||||
map['stored_file_hash'] = Variable<i2.Uint8List>(storedFileHash);
|
||||
}
|
||||
map['created_at'] = Variable<DateTime>(createdAt);
|
||||
return map;
|
||||
}
|
||||
|
|
@ -1809,6 +1820,9 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
encryptionNonce: encryptionNonce == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(encryptionNonce),
|
||||
storedFileHash: storedFileHash == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(storedFileHash),
|
||||
createdAt: Value(createdAt),
|
||||
);
|
||||
}
|
||||
|
|
@ -1835,6 +1849,8 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
encryptionMac: serializer.fromJson<i2.Uint8List?>(json['encryptionMac']),
|
||||
encryptionNonce:
|
||||
serializer.fromJson<i2.Uint8List?>(json['encryptionNonce']),
|
||||
storedFileHash:
|
||||
serializer.fromJson<i2.Uint8List?>(json['storedFileHash']),
|
||||
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||
);
|
||||
}
|
||||
|
|
@ -1857,6 +1873,7 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
'encryptionKey': serializer.toJson<i2.Uint8List?>(encryptionKey),
|
||||
'encryptionMac': serializer.toJson<i2.Uint8List?>(encryptionMac),
|
||||
'encryptionNonce': serializer.toJson<i2.Uint8List?>(encryptionNonce),
|
||||
'storedFileHash': serializer.toJson<i2.Uint8List?>(storedFileHash),
|
||||
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||
};
|
||||
}
|
||||
|
|
@ -1876,6 +1893,7 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
Value<i2.Uint8List?> encryptionKey = const Value.absent(),
|
||||
Value<i2.Uint8List?> encryptionMac = const Value.absent(),
|
||||
Value<i2.Uint8List?> encryptionNonce = const Value.absent(),
|
||||
Value<i2.Uint8List?> storedFileHash = const Value.absent(),
|
||||
DateTime? createdAt}) =>
|
||||
MediaFilesData(
|
||||
mediaId: mediaId ?? this.mediaId,
|
||||
|
|
@ -1903,6 +1921,8 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
encryptionNonce: encryptionNonce.present
|
||||
? encryptionNonce.value
|
||||
: this.encryptionNonce,
|
||||
storedFileHash:
|
||||
storedFileHash.present ? storedFileHash.value : this.storedFileHash,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
);
|
||||
MediaFilesData copyWithCompanion(MediaFilesCompanion data) {
|
||||
|
|
@ -1941,6 +1961,9 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
encryptionNonce: data.encryptionNonce.present
|
||||
? data.encryptionNonce.value
|
||||
: this.encryptionNonce,
|
||||
storedFileHash: data.storedFileHash.present
|
||||
? data.storedFileHash.value
|
||||
: this.storedFileHash,
|
||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||
);
|
||||
}
|
||||
|
|
@ -1962,6 +1985,7 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
..write('encryptionKey: $encryptionKey, ')
|
||||
..write('encryptionMac: $encryptionMac, ')
|
||||
..write('encryptionNonce: $encryptionNonce, ')
|
||||
..write('storedFileHash: $storedFileHash, ')
|
||||
..write('createdAt: $createdAt')
|
||||
..write(')'))
|
||||
.toString();
|
||||
|
|
@ -1983,6 +2007,7 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
$driftBlobEquality.hash(encryptionKey),
|
||||
$driftBlobEquality.hash(encryptionMac),
|
||||
$driftBlobEquality.hash(encryptionNonce),
|
||||
$driftBlobEquality.hash(storedFileHash),
|
||||
createdAt);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
|
|
@ -2003,6 +2028,8 @@ class MediaFilesData extends DataClass implements Insertable<MediaFilesData> {
|
|||
$driftBlobEquality.equals(other.encryptionMac, this.encryptionMac) &&
|
||||
$driftBlobEquality.equals(
|
||||
other.encryptionNonce, this.encryptionNonce) &&
|
||||
$driftBlobEquality.equals(
|
||||
other.storedFileHash, this.storedFileHash) &&
|
||||
other.createdAt == this.createdAt);
|
||||
}
|
||||
|
||||
|
|
@ -2021,6 +2048,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
final Value<i2.Uint8List?> encryptionKey;
|
||||
final Value<i2.Uint8List?> encryptionMac;
|
||||
final Value<i2.Uint8List?> encryptionNonce;
|
||||
final Value<i2.Uint8List?> storedFileHash;
|
||||
final Value<DateTime> createdAt;
|
||||
final Value<int> rowid;
|
||||
const MediaFilesCompanion({
|
||||
|
|
@ -2038,6 +2066,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
this.encryptionKey = const Value.absent(),
|
||||
this.encryptionMac = const Value.absent(),
|
||||
this.encryptionNonce = const Value.absent(),
|
||||
this.storedFileHash = const Value.absent(),
|
||||
this.createdAt = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
|
@ -2056,6 +2085,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
this.encryptionKey = const Value.absent(),
|
||||
this.encryptionMac = const Value.absent(),
|
||||
this.encryptionNonce = const Value.absent(),
|
||||
this.storedFileHash = const Value.absent(),
|
||||
this.createdAt = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
}) : mediaId = Value(mediaId),
|
||||
|
|
@ -2075,6 +2105,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
Expression<i2.Uint8List>? encryptionKey,
|
||||
Expression<i2.Uint8List>? encryptionMac,
|
||||
Expression<i2.Uint8List>? encryptionNonce,
|
||||
Expression<i2.Uint8List>? storedFileHash,
|
||||
Expression<DateTime>? createdAt,
|
||||
Expression<int>? rowid,
|
||||
}) {
|
||||
|
|
@ -2096,6 +2127,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
if (encryptionKey != null) 'encryption_key': encryptionKey,
|
||||
if (encryptionMac != null) 'encryption_mac': encryptionMac,
|
||||
if (encryptionNonce != null) 'encryption_nonce': encryptionNonce,
|
||||
if (storedFileHash != null) 'stored_file_hash': storedFileHash,
|
||||
if (createdAt != null) 'created_at': createdAt,
|
||||
if (rowid != null) 'rowid': rowid,
|
||||
});
|
||||
|
|
@ -2116,6 +2148,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
Value<i2.Uint8List?>? encryptionKey,
|
||||
Value<i2.Uint8List?>? encryptionMac,
|
||||
Value<i2.Uint8List?>? encryptionNonce,
|
||||
Value<i2.Uint8List?>? storedFileHash,
|
||||
Value<DateTime>? createdAt,
|
||||
Value<int>? rowid}) {
|
||||
return MediaFilesCompanion(
|
||||
|
|
@ -2135,6 +2168,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
encryptionKey: encryptionKey ?? this.encryptionKey,
|
||||
encryptionMac: encryptionMac ?? this.encryptionMac,
|
||||
encryptionNonce: encryptionNonce ?? this.encryptionNonce,
|
||||
storedFileHash: storedFileHash ?? this.storedFileHash,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
rowid: rowid ?? this.rowid,
|
||||
);
|
||||
|
|
@ -2188,6 +2222,9 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
if (encryptionNonce.present) {
|
||||
map['encryption_nonce'] = Variable<i2.Uint8List>(encryptionNonce.value);
|
||||
}
|
||||
if (storedFileHash.present) {
|
||||
map['stored_file_hash'] = Variable<i2.Uint8List>(storedFileHash.value);
|
||||
}
|
||||
if (createdAt.present) {
|
||||
map['created_at'] = Variable<DateTime>(createdAt.value);
|
||||
}
|
||||
|
|
@ -2214,6 +2251,7 @@ class MediaFilesCompanion extends UpdateCompanion<MediaFilesData> {
|
|||
..write('encryptionKey: $encryptionKey, ')
|
||||
..write('encryptionMac: $encryptionMac, ')
|
||||
..write('encryptionNonce: $encryptionNonce, ')
|
||||
..write('storedFileHash: $storedFileHash, ')
|
||||
..write('createdAt: $createdAt, ')
|
||||
..write('rowid: $rowid')
|
||||
..write(')'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue