Skip to content

Commit

Permalink
Merge pull request #1782 from ardriveapp/dev
Browse files Browse the repository at this point in the history
PE-6397: Release ArDrive App v2.49.0
  • Loading branch information
thiagocarvalhodev authored Jul 9, 2024
2 parents f961b71 + c778449 commit ed48997
Show file tree
Hide file tree
Showing 42 changed files with 1,739 additions and 587 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ jobs:
run: flutter analyze

- name: Test app
run: scr test


run: scr test
2 changes: 2 additions & 0 deletions android/fastlane/metadata/android/en-US/changelogs/136.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Implements thumbnail generator for all image files
- Adds the Parent Folder Name and Status columns on the Drive Export feature
129 changes: 111 additions & 18 deletions lib/app_shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import 'package:ardrive/blocs/prompt_to_snapshot/prompt_to_snapshot_bloc.dart';
import 'package:ardrive/blocs/prompt_to_snapshot/prompt_to_snapshot_event.dart';
import 'package:ardrive/components/profile_card.dart';
import 'package:ardrive/components/side_bar.dart';
import 'package:ardrive/drive_explorer/multi_thumbnail_creation/bloc/multi_thumbnail_creation_bloc.dart';
import 'package:ardrive/gift/reedem_button.dart';
import 'package:ardrive/misc/misc.dart';
import 'package:ardrive/pages/drive_detail/components/hover_widget.dart';
import 'package:ardrive/shared/blocs/banner/app_banner_bloc.dart';
import 'package:ardrive/sync/domain/cubit/sync_cubit.dart';
import 'package:ardrive/sync/domain/sync_progress.dart';
import 'package:ardrive/utils/logger.dart';
import 'package:ardrive/utils/size_constants.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:ardrive_utils/ardrive_utils.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:responsive_builder/responsive_builder.dart';
Expand Down Expand Up @@ -172,24 +175,114 @@ class AppShellState extends State<AppShell> {
),
);
return ScreenTypeLayout.builder(
desktop: (context) => buildPage(
Row(
children: [
const AppSideBar(),
Container(
color: ArDriveTheme.of(context).themeData.backgroundColor,
width: 16,
),
Expanded(
child: Scaffold(
backgroundColor:
ArDriveTheme.of(context).themeData.backgroundColor,
body: widget.page,
),
),
],
),
),
desktop: (context) {
final colorTokens =
ArDriveTheme.of(context).themeData.colorTokens;
final typography = ArDriveTypographyNew.of(context);

return buildPage(
BlocBuilder<AppBannerBloc, AppBannerState>(
builder: (context, state) {
return Column(
children: [
if (state is AppBannerVisible)
Container(
height: 45,
width: double.maxFinite,
color: colorTokens.buttonPrimaryDefault,
alignment: Alignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
ArDriveIcons.asc(
color: colorTokens.textOnPrimary,
size: 18,
),
const SizedBox(width: 8),
// move two pixels above
Transform(
transform:
Matrix4.translationValues(0.0, -2.0, 0.0),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text:
'ArDrive now supports thumbnails! You can ',
style: typography.paragraphNormal(
fontWeight: ArFontWeight.semiBold,
color: colorTokens.textOnPrimary),
),
TextSpan(
text: 'add them now!',
recognizer: TapGestureRecognizer()
..onTap = () {
context
.read<
MultiThumbnailCreationBloc>()
.add(
const CreateMultiThumbnailForAllDrives());
},
style: typography
.paragraphNormal(
fontWeight:
ArFontWeight.semiBold,
color:
colorTokens.textOnPrimary)
.copyWith(
decoration:
TextDecoration.underline,
),
),
],
),
),
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: GestureDetector(
onTap: () {
context
.read<AppBannerBloc>()
.add(const AppBannerCloseEvent());
},
child: ArDriveIcons.x(
color: colorTokens.textOnPrimary,
),
),
),
],
),
),
Flexible(
child: Row(
children: [
const AppSideBar(),
Container(
color: ArDriveTheme.of(context)
.themeData
.backgroundColor,
width: 16,
),
Expanded(
child: Scaffold(
backgroundColor: ArDriveTheme.of(context)
.themeData
.backgroundColor,
body: widget.page,
),
),
],
),
),
],
);
},
),
);
},
mobile: (context) => buildPage(widget.page),
);
},
Expand Down
50 changes: 40 additions & 10 deletions lib/blocs/data_export/data_export_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';

import 'package:ardrive/core/arfs/repository/folder_repository.dart';
import 'package:ardrive/models/models.dart';
import 'package:csv/csv.dart';
import 'package:drift/drift.dart';
Expand All @@ -8,17 +9,32 @@ import 'package:flutter_bloc/flutter_bloc.dart';

part 'data_export_state.dart';

const _fileIdColumnName = 'File Id';
const _fileNameColumnName = 'File Name';
const _parentFolderIdColumnName = 'Parent Folder ID';
const _parentFolderNameColumnName = 'Parent Folder Name';
const _dataTransactionIdColumnName = 'Data Transaction ID';
const _metadataTransactionIdColumnName = 'Metadata Transaction ID';
const _fileSizeColumnName = 'File Size';
const _dateCreatedColumnName = 'Date Created';
const _lastModifiedColumnName = 'Last Modified';
const _directDownloadLinkColumnName = 'Direct Download Link';
const _statusColumnName = 'Status';

class DataExportCubit extends Cubit<DataExportState> {
final String driveId;
final DriveDao _driveDao;
final FolderRepository _folderRepository;
final String _gatewayURL;

DataExportCubit({
required this.driveId,
required DriveDao driveDao,
required String gatewayURL,
required FolderRepository folderRepository,
}) : _driveDao = driveDao,
_gatewayURL = gatewayURL,
_folderRepository = folderRepository,
super(DataExportInitial());

Future<String> getFilesInDriveAsCSV(String driveId) async {
Expand All @@ -27,30 +43,44 @@ class DataExportCubit extends Cubit<DataExportState> {
.get();
final export = <List<String>>[
[
'File Id',
'File Name',
'Parent Folder ID',
'Data Transaction ID',
'Metadata Transaction ID',
'File Size',
'Date Created',
'Last Modified',
'Direct Download Link'
_fileIdColumnName,
_fileNameColumnName,
_parentFolderIdColumnName,
_parentFolderNameColumnName,
_dataTransactionIdColumnName,
_metadataTransactionIdColumnName,
_fileSizeColumnName,
_dateCreatedColumnName,
_lastModifiedColumnName,
_directDownloadLinkColumnName,
_statusColumnName,
]
];

final Map<String, String> folderNames = {};

for (var file in files) {
final fileContent = <String>[];

final parentFolder = await _folderRepository.getLatestFolderRevisionInfo(
driveId, file.parentFolderId);

if (parentFolder != null) {
folderNames[file.parentFolderId] = parentFolder.name;
}

fileContent
..add(file.id)
..add(file.name)
..add(file.parentFolderId)
..add(folderNames[file.parentFolderId] ?? '')
..add(file.dataTx.id)
..add(file.metadataTx.id)
..add(file.size.toString())
..add(file.dateCreated.toString())
..add(file.lastModifiedDate.toString())
..add(Uri.parse('$_gatewayURL/${file.dataTx.id}').toString());
..add(Uri.parse('$_gatewayURL/${file.dataTx.id}').toString())
..add(file.dataTx.status.toString());
export.add(fileContent);
}
return const ListToCsvConverter().convert(export);
Expand Down
2 changes: 2 additions & 0 deletions lib/components/csv_export_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:async';

import 'package:ardrive/blocs/blocs.dart';
import 'package:ardrive/blocs/data_export/data_export_cubit.dart';
import 'package:ardrive/core/arfs/repository/folder_repository.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/theme/theme.dart';
Expand All @@ -23,6 +24,7 @@ Future<void> promptToExportCSVData({
return DataExportCubit(
driveId: driveId,
driveDao: context.read<DriveDao>(),
folderRepository: context.read<FolderRepository>(),
gatewayURL:
context.read<ArweaveService>().client.api.gatewayUrl.toString(),
)..exportData();
Expand Down
74 changes: 30 additions & 44 deletions lib/components/details_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -602,15 +602,7 @@ class _DetailsPanelState extends State<DetailsPanel> {
leading: Row(
mainAxisSize: MainAxisSize.min,
children: [
ArDriveIconButton(
tooltip: appLocalizationsOf(context).viewOnViewBlock,
icon: ArDriveIcons.newWindow(size: 20),
onPressed: () {
openUrl(
url: 'https://viewblock.io/arweave/tx/${folder.metadataTxId}',
);
},
),
_TxIdTextLink(txId: folder.metadataTxId),
const SizedBox(width: 12),
CopyButton(
text: folder.metadataTxId,
Expand Down Expand Up @@ -671,15 +663,7 @@ class _DetailsPanelState extends State<DetailsPanel> {
leading: Row(
mainAxisSize: MainAxisSize.min,
children: [
ArDriveIconButton(
tooltip: appLocalizationsOf(context).viewOnViewBlock,
icon: ArDriveIcons.newWindow(size: 20),
onPressed: () {
openUrl(
url: 'https://viewblock.io/arweave/tx/${state.metadataTxId}',
);
},
),
_TxIdTextLink(txId: state.metadataTxId),
const SizedBox(width: 12),
CopyButton(
text: state.metadataTxId,
Expand Down Expand Up @@ -739,12 +723,7 @@ class _DetailsPanelState extends State<DetailsPanel> {
leading: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${state.metadataTxId.substring(0, 4)}...',
style: ArDriveTypography.body
.buttonNormalRegular()
.copyWith(decoration: TextDecoration.underline),
),
_TxIdTextLink(txId: state.metadataTxId),
const SizedBox(width: 12),
CopyButton(
text: state.metadataTxId,
Expand All @@ -758,26 +737,7 @@ class _DetailsPanelState extends State<DetailsPanel> {
leading: Row(
mainAxisSize: MainAxisSize.min,
children: [
// only first 4 characters of the data tx id are shown
ArDriveClickArea(
child: GestureDetector(
onTap: () {
openUrl(
url: 'https://viewblock.io/arweave/tx/${item.dataTxId}',
);
},
child: Tooltip(
message: item.dataTxId,
child: Text(
'${item.dataTxId.substring(0, 4)}...',
style:
ArDriveTypography.body.buttonNormalRegular().copyWith(
decoration: TextDecoration.underline,
),
),
),
),
),
_TxIdTextLink(txId: item.dataTxId),
const SizedBox(width: 12),
CopyButton(
text: item.dataTxId,
Expand Down Expand Up @@ -1039,6 +999,32 @@ class _DetailsPanelState extends State<DetailsPanel> {
}
}

class _TxIdTextLink extends StatelessWidget {
const _TxIdTextLink({required this.txId});

final String txId;

@override
Widget build(BuildContext context) {
return ArDriveClickArea(
child: GestureDetector(
onTap: () {
openUrl(url: 'https://viewblock.io/arweave/tx/$txId');
},
child: Tooltip(
message: txId,
child: Text(
'${txId.substring(0, 4)}...',
style: ArDriveTypography.body
.buttonNormalRegular()
.copyWith(decoration: TextDecoration.underline),
),
),
),
);
}
}

class EntityRevision {
final String name;
final DateTime dateCreated;
Expand Down
Loading

0 comments on commit ed48997

Please sign in to comment.