Skip to content

Commit

Permalink
Merge pull request #1680 from ardriveapp/dev
Browse files Browse the repository at this point in the history
PE-5865: Release ArDrive App v2.39.0
  • Loading branch information
thiagocarvalhodev authored Mar 28, 2024
2 parents 10c1bcb + 54cd64d commit 1c2edcb
Show file tree
Hide file tree
Showing 72 changed files with 2,249 additions and 1,496 deletions.
2 changes: 2 additions & 0 deletions android/fastlane/metadata/android/en-US/changelogs/117.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Optimizes sync load time
- Fixes an issue when creating large snapshots on Firefox
2 changes: 2 additions & 0 deletions lib/app_shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:ardrive/components/profile_card.dart';
import 'package:ardrive/components/side_bar.dart';
import 'package:ardrive/gift/reedem_button.dart';
import 'package:ardrive/pages/drive_detail/components/hover_widget.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';
Expand Down
1 change: 0 additions & 1 deletion lib/blocs/blocs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ export 'keyboard_listener/keyboard_listener_bloc.dart';
export 'profile/profile_cubit.dart';
export 'profile_add/profile_add_cubit.dart';
export 'shared_file/shared_file_cubit.dart';
export 'sync/sync_cubit.dart';
export 'upload/upload_cubit.dart';
79 changes: 39 additions & 40 deletions lib/blocs/create_snapshot/create_snapshot_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,39 +110,58 @@ class CreateSnapshotCubit extends Cubit<CreateSnapshotState> {
await _reset(driveId);
} catch (e) {
emit(ComputeSnapshotDataFailure(errorMessage: e.toString()));
logger.e('Error while resetting snapshot creation parameters', e);
return;
}

final profileState = _profileCubit.state as ProfileLoggedIn;
_ownerAddress = profileState.walletAddress;

_setTrustedRange(range);

late Uint8List data;
try {
final profileState = _profileCubit.state as ProfileLoggedIn;
_ownerAddress = profileState.walletAddress;

_setTrustedRange(range);

data = await _getSnapshotData();

if (_wasCancelled()) return;

_setupSnapshotEntityWithBlob(data);

logger.d('Computed snapshot data size: ${data.length} bytes');
logger.d('Computing cost and balance estimate');

await _computeCost();
await _computeBalanceEstimate();
_computeIsSufficientBalance();
_computeIsTurboEnabled();
_computeIsFreeThanksToTurbo();
_computeIsButtonEnabled();

logger.d('Computed cost and balance estimate');

emit(
ConfirmingSnapshotCreation(
snapshotSize: data.length,
costEstimateAr: _costEstimateAr,
costEstimateTurbo: _costEstimateTurbo,
hasNoTurboBalance: _hasNoTurboBalance,
isTurboUploadPossible: _isTurboUploadPossible,
arBalance: _arBalance,
turboCredits: _turboCredits,
uploadMethod: _uploadMethod,
isButtonToUploadEnabled: _isButtonToUploadEnabled,
sufficientBalanceToPayWithAr: _sufficientArBalance,
sufficientBalanceToPayWithTurbo: _sufficentCreditsBalance,
isFreeThanksToTurbo: _isFreeThanksToTurbo,
),
);
} catch (e) {
if (_wasCancelled()) return;

// If it was not cancelled, then there was a failure.
emit(ComputeSnapshotDataFailure(errorMessage: e.toString()));
return;
logger.e('Error while getting snapshot data', e);
}

_setupSnapshotEntityWithBlob(data);

await _computeCost();
await _computeBalanceEstimate();
_computeIsSufficientBalance();
_computeIsTurboEnabled();
_computeIsFreeThanksToTurbo();
_computeIsButtonEnabled();

await _emitConfirming(
dataSize: data.length,
);
}

bool _wasCancelled() {
Expand Down Expand Up @@ -196,16 +215,13 @@ class CreateSnapshotCubit extends Cubit<CreateSnapshotState> {
// transforms the stream of arrays into a flat stream
final flatGQLEdgesStream = gqlEdgesStream.expand((element) => element);

// maps the items to GQL Nodes
final gqlNodesStream = flatGQLEdgesStream.map((edge) => edge.node);

// declares the reading stream from the SnapshotItemToBeCreated
final snapshotItemToBeCreated = SnapshotItemToBeCreated(
blockStart: _range.start,
blockEnd: _range.end,
driveId: _driveId,
subRanges: HeightRange(rangeSegments: [_range]),
source: gqlNodesStream,
source: flatGQLEdgesStream,
jsonMetadataOfTxId: _jsonMetadataOfTxId,
);

Expand Down Expand Up @@ -496,23 +512,6 @@ class CreateSnapshotCubit extends Cubit<CreateSnapshotState> {
_isFreeThanksToTurbo = isFreeThanksToTurbo && !forceNoFreeThanksToTurbo;
}

Future<void> _emitConfirming({required int dataSize}) async {
emit(ConfirmingSnapshotCreation(
snapshotSize: dataSize,
costEstimateAr: _costEstimateAr,
costEstimateTurbo: _costEstimateTurbo,
hasNoTurboBalance: _hasNoTurboBalance,
isTurboUploadPossible: _isTurboUploadPossible,
arBalance: _arBalance,
turboCredits: _turboCredits,
uploadMethod: _uploadMethod,
isButtonToUploadEnabled: _isButtonToUploadEnabled,
sufficientBalanceToPayWithAr: _sufficientArBalance,
sufficientBalanceToPayWithTurbo: _sufficentCreditsBalance,
isFreeThanksToTurbo: _isFreeThanksToTurbo,
));
}

void setUploadMethod(UploadMethod method) {
logger.d('Upload method set to $method');
_uploadMethod = method;
Expand Down
1 change: 1 addition & 0 deletions lib/blocs/drive_attach/drive_attach_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:ardrive/blocs/blocs.dart';
import 'package:ardrive/core/arfs/entities/arfs_entities.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/sync/domain/cubit/sync_cubit.dart';
import 'package:ardrive/utils/logger.dart';
import 'package:ardrive/utils/plausible_event_tracker/plausible_event_tracker.dart';
import 'package:ardrive_utils/ardrive_utils.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/blocs/drive_rename/drive_rename_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:ardrive/blocs/blocs.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/sync/domain/cubit/sync_cubit.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/blocs/file_download/file_download_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';

import 'package:ardrive/blocs/blocs.dart';
import 'package:ardrive/core/arfs/entities/arfs_entities.dart';
import 'package:ardrive/core/arfs/repository/arfs_repository.dart';
import 'package:ardrive/core/crypto/crypto.dart';
Expand All @@ -9,6 +8,7 @@ import 'package:ardrive/download/limits.dart';
import 'package:ardrive/entities/constants.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/sync/domain/sync_progress.dart';
import 'package:ardrive/utils/logger.dart';
import 'package:ardrive_io/ardrive_io.dart' as io;
import 'package:ardrive_io/ardrive_io.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/blocs/fs_entry_move/fs_entry_move_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:ardrive/core/crypto/crypto.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/pages/drive_detail/drive_detail_page.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/sync/domain/cubit/sync_cubit.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:ardrive/utils/logger.dart';
import 'package:arweave/arweave.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/blocs/fs_entry_rename/fs_entry_rename_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:ardrive/blocs/blocs.dart';
import 'package:ardrive/core/crypto/crypto.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/sync/domain/cubit/sync_cubit.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:ardrive/utils/logger.dart';
import 'package:ardrive_io/ardrive_io.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/blocs/ghost_fixer/ghost_fixer_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:ardrive/blocs/blocs.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/pages/pages.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/sync/domain/cubit/sync_cubit.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:ardrive/utils/logger.dart';
import 'package:equatable/equatable.dart';
Expand Down
68 changes: 0 additions & 68 deletions lib/blocs/sync/utils/add_drive_entity_revisions.dart

This file was deleted.

101 changes: 0 additions & 101 deletions lib/blocs/sync/utils/add_file_entity_revisions.dart

This file was deleted.

Loading

0 comments on commit 1c2edcb

Please sign in to comment.