Skip to content

Commit

Permalink
Merge pull request #1870 from ardriveapp/dev
Browse files Browse the repository at this point in the history
PE-6285: Release ArDrive v2.54.5
  • Loading branch information
thiagocarvalhodev authored Sep 25, 2024
2 parents 118c208 + 27d24ce commit c71fa7f
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 675 deletions.
862 changes: 201 additions & 661 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/155.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Resolved issue with displaying outdated metadata and transaction IDs after file replacement.
1 change: 1 addition & 0 deletions lib/blocs/upload/upload_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,7 @@ class UploadCubit extends Cubit<UploadState> {
performedAction: revisionAction,
),
);

if (licensesCompanion != null) {
await _driveDao.insertLicense(licensesCompanion);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/components/upload_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ class _UploadFormState extends State<UploadForm> {
context.read<ActivityTracker>().setUploading(false);
context.read<SyncCubit>().startSync();
}

widget.driveDetailCubit.refreshDriveDataTable();
} else if (state is UploadPreparationInitialized) {
context.read<UploadCubit>().verifyFilesAboveWarningLimit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,30 @@ class ThumbnailRepository {
Future<ThumbnailData> getThumbnail({
required FileDataTableItem fileDataTableItem,
}) async {
if (_cachedThumbnails[fileDataTableItem.id] != null) {
return _cachedThumbnails[fileDataTableItem.id]!;
if (_cachedThumbnails[fileDataTableItem.dataTxId] != null) {
return _cachedThumbnails[fileDataTableItem.dataTxId]!;
}

final drive = await _driveDao
.driveById(driveId: fileDataTableItem.driveId)
.getSingle();

if (drive.isPrivate) {
_cachedThumbnails[fileDataTableItem.id] = ThumbnailData(
_cachedThumbnails[fileDataTableItem.dataTxId] = ThumbnailData(
data: await _getThumbnailData(fileDataTableItem: fileDataTableItem),
url: null,
);

return _cachedThumbnails[fileDataTableItem.id]!;
return _cachedThumbnails[fileDataTableItem.dataTxId]!;
}

final urlString =
'${_arweaveService.client.api.gatewayUrl.origin}/raw/${fileDataTableItem.thumbnail?.variants.first.txId}';

_cachedThumbnails[fileDataTableItem.id] =
_cachedThumbnails[fileDataTableItem.dataTxId] =
ThumbnailData(data: null, url: urlString);

return _cachedThumbnails[fileDataTableItem.id]!;
return _cachedThumbnails[fileDataTableItem.dataTxId]!;
}

Future<Uint8List> _getThumbnailData({
Expand Down
22 changes: 16 additions & 6 deletions lib/sync/domain/repositories/sync_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -992,37 +992,47 @@ class _SyncRepository implements SyncRepository {

final newRevisions = <FileRevisionsCompanion>[];
for (final entity in newEntities) {
if (entity.assignedNames != null) {
logger.d('Entity has assigned names: ${entity.assignedNames}');
}

if (!latestRevisions.containsKey(entity.id) &&
entity.parentFolderId != null) {
final revisions = await _driveDao
.latestFileRevisionByFileId(driveId: driveId, fileId: entity.id!)
.getSingleOrNull();
// Gets the latest revision for the file, if it exists on the database.
if (revisions != null) {
latestRevisions[entity.id!] = revisions.toCompanion(true);
}
}

final revisionPerformedAction =
entity.getPerformedRevisionAction(latestRevisions[entity.id]);

if (revisionPerformedAction == null) {
continue;
}

// If Parent-Folder-Id is missing for a file, put it in the root folder
try {
entity.parentFolderId = entity.parentFolderId ?? rootPath;

final revision = entity.toRevisionCompanion(
performedAction: revisionPerformedAction);

if (revision.action.value.isEmpty) {
continue;
}

newRevisions.add(revision);
latestRevisions[entity.id!] = revision;
if (latestRevisions.containsKey(entity.id)) {
final latestRevision = latestRevisions[entity.id];

if (revision.dateCreated.value
.isAfter(latestRevision!.dateCreated.value)) {
latestRevisions[entity.id!] = revision;
newRevisions.add(revision);
}
} else {
latestRevisions[entity.id!] = revision;
newRevisions.add(revision);
}
} catch (e, stacktrace) {
logger.e('Error adding revision for entity', e, stacktrace);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Secure, permanent storage

publish_to: 'none'

version: 2.54.4
version: 2.54.5

environment:
sdk: '>=3.2.0 <4.0.0'
Expand Down
1 change: 0 additions & 1 deletion test/blocs/upload_cubit_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ void main() {
late MockLicenseService mockLicense;
late MockConfigService mockConfigService;
late MockArnsRepository mockArnsRepository;

const tDriveId = 'drive_id';
const tRootFolderId = 'root-folder-id';
const tRootFolderFileCount = 5;
Expand Down

0 comments on commit c71fa7f

Please sign in to comment.