Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-6480: Release Ardrive v2.49.5 #1808

Merged
merged 18 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
51c3585
logging:
thiagocarvalhodev Jul 19, 2024
e377482
Update upload_cubit.dart
thiagocarvalhodev Jul 22, 2024
493c094
handle Null error throwing a proper exception
thiagocarvalhodev Jul 22, 2024
67de23a
Update drive_attach_cubit.dart
thiagocarvalhodev Jul 22, 2024
8c01cff
Merge pull request #1800 from ardriveapp/PE-6470-better-handling-on-t…
thiagocarvalhodev Jul 22, 2024
5dceaae
feat(image preview)
thiagocarvalhodev Jul 22, 2024
e42f207
Merge pull request #1797 from ardriveapp/PE-6464-could-not-roll-back-…
thiagocarvalhodev Jul 22, 2024
6b169e0
Update d2n_streamed_upload.dart
thiagocarvalhodev Jul 22, 2024
f9cad66
fix(attach drive)
thiagocarvalhodev Jul 23, 2024
ad5760a
Update app_router_delegate.dart
thiagocarvalhodev Jul 23, 2024
8885b1a
Update login_bloc_test.dart
thiagocarvalhodev Jul 23, 2024
75777c2
Merge pull request #1799 from ardriveapp/PE-6469-refactor-on-error-me…
thiagocarvalhodev Jul 23, 2024
d371a60
Merge pull request #1802 from ardriveapp/PE-6472-handle-error-at-imag…
thiagocarvalhodev Jul 23, 2024
b359829
Merge pull request #1803 from ardriveapp/PE-6473-enhance-log-for-bund…
karlprieb Jul 24, 2024
eade1ce
Merge pull request #1801 from ardriveapp/PE-6471-refactor-on-error-me…
thiagocarvalhodev Jul 24, 2024
d0df45f
Merge pull request #1806 from ardriveapp/PE-6011
thiagocarvalhodev Jul 24, 2024
9c9f82e
bump version
thiagocarvalhodev Jul 24, 2024
84590eb
Merge pull request #1807 from ardriveapp/PE-6480-release-ar-drive-app…
thiagocarvalhodev Jul 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/141.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Improves handling of a few common errors
8 changes: 7 additions & 1 deletion lib/authentication/login/blocs/login_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:ardrive/authentication/ardrive_auth.dart';
import 'package:ardrive/authentication/login/blocs/ethereum_signer.dart';
import 'package:ardrive/authentication/login/blocs/stub_web_wallet.dart' // stub implementation
if (dart.library.html) 'package:ardrive/authentication/login/blocs/web_wallet.dart';
import 'package:ardrive/blocs/profile/profile_cubit.dart';
import 'package:ardrive/core/crypto/crypto.dart';
import 'package:ardrive/core/download_service.dart';
import 'package:ardrive/entities/profile_types.dart';
Expand Down Expand Up @@ -40,6 +41,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
final ArweaveService _arweaveService;
final DownloadService _downloadService;
final ConfigService _configService;
final ProfileCubit _profileCubit;

bool ignoreNextWaletSwitch = false;

Expand All @@ -61,13 +63,15 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
required DownloadService downloadService,
required UserRepository userRepository,
required ConfigService configService,
required ProfileCubit profileCubit,
}) : _arDriveAuth = arDriveAuth,
_arConnectService = arConnectService,
_ethereumProviderService = ethereumProviderService,
_arweaveService = arweaveService,
_turboUploadService = turboUploadService,
_downloadService = downloadService,
_configService = configService,
_profileCubit = profileCubit,
super(LoginLoading()) {
on<LoginEvent>(_onLoginEvent);
_listenToWalletChange();
Expand Down Expand Up @@ -500,7 +504,9 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
Emitter<LoginState> emit,
) async {
if (await _arDriveAuth.isUserLoggedIn()) {
await _arDriveAuth.logout();
await _arDriveAuth
.logout()
.then((value) => _profileCubit.logoutProfile());
}

usingSeedphrase = false;
Expand Down
32 changes: 0 additions & 32 deletions lib/authentication/login/views/forget_wallet.dart

This file was deleted.

6 changes: 6 additions & 0 deletions lib/authentication/login/views/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class _LoginPageState extends State<LoginPage> {
arDriveAuth: context.read<ArDriveAuth>(),
userRepository: context.read<UserRepository>(),
configService: context.read<ConfigService>(),
profileCubit: context.read<ProfileCubit>(),
)..add(
CheckIfUserIsLoggedIn(
gettingStarted: widget.gettingStarted,
Expand All @@ -93,6 +94,11 @@ class _LoginPageState extends State<LoginPage> {
});
}

if (loginState is LoginSuccess) {
logger.setContext(logger.context
.copyWith(userAddress: loginState.user.walletAddress));
}

if (loginState is PromptPassword) {
showEnterYourPasswordDialog(
context: context,
Expand Down
12 changes: 5 additions & 7 deletions lib/blocs/drive_attach/drive_attach_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class DriveAttachCubit extends Cubit<DriveAttachState> {
PlausibleEventTracker.trackAttachDrive(
drivePrivacy: drivePrivacy,
);
} catch (err) {
addError(err);
} catch (err, stacktrace) {
_handleError(err, stacktrace);
}
}

Expand Down Expand Up @@ -249,11 +249,9 @@ class DriveAttachCubit extends Cubit<DriveAttachState> {
return null;
}

@override
void onError(Object error, StackTrace stackTrace) {
emit(DriveAttachFailure());
super.onError(error, stackTrace);
void _handleError(Object error, StackTrace stackTrace) {
logger.e('Failed to attach drive. Emitting error', error, stackTrace);

logger.e('Failed to attach drive', error, stackTrace);
emit(DriveAttachFailure());
}
}
19 changes: 15 additions & 4 deletions lib/blocs/fs_entry_preview/fs_entry_preview_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
final SecretKey? _fileKey;

StreamSubscription? _entrySubscription;
static final ValueNotifier<ImagePreviewNotification> imagePreviewNotifier =
ValueNotifier<ImagePreviewNotification>(ImagePreviewNotification());
static final ValueNotifier<ImagePreviewNotification?> imagePreviewNotifier =
ValueNotifier<ImagePreviewNotification?>(null);

final previewMaxFileSize = 1024 * 1024 * 100;
final allowedPreviewContentTypes = [];
Expand Down Expand Up @@ -180,10 +180,15 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
FileEntry file,
String dataUrl,
) async {
if (file.dataContentType == null) {
emit(FsEntryPreviewUnavailable());
return;
}

imagePreviewNotifier.value = ImagePreviewNotification(
isLoading: true,
filename: file.name,
contentType: file.dataContentType,
contentType: file.dataContentType!,
);

emit(FsEntryPreviewImage(previewUrl: dataUrl));
Expand Down Expand Up @@ -428,10 +433,16 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
if (isClosed) {
return;
}

if (file.dataContentType == null) {
emit(FsEntryPreviewUnavailable());
return;
}

imagePreviewNotifier.value = ImagePreviewNotification(
dataBytes: dataBytes,
filename: file.name,
contentType: file.dataContentType,
contentType: file.dataContentType!,
);
emit(FsEntryPreviewImage(previewUrl: dataUrl));
}
Expand Down
8 changes: 4 additions & 4 deletions lib/blocs/fs_entry_preview/image_preview_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import 'dart:typed_data';
class ImagePreviewNotification {
bool isLoading;
Uint8List? dataBytes;
String? filename;
String? contentType;
String filename;
String contentType;

bool get isPreviewable => dataBytes != null;

ImagePreviewNotification({
this.dataBytes,
this.filename,
this.contentType,
required this.filename,
required this.contentType,
this.isLoading = false,
});
}
37 changes: 6 additions & 31 deletions lib/blocs/upload/upload_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ class UploadCubit extends Cubit<UploadState> {
);
} catch (error, stacktrace) {
logger.e('error mounting the upload', error, stacktrace);
addError(error);
_emitError(error);
}
}

Expand Down Expand Up @@ -645,14 +645,6 @@ class UploadCubit extends Cubit<UploadState> {

uploadController.onDone(
(tasks) async {
logger.d('Upload folders and files finished... Verifying results');

if (tasks.any((element) => element.status == UploadStatus.failed)) {
logger.e('One or more tasks failed. Emitting error');
// if any of the files failed, we should throw an error
addError(Exception('Error uploading'));
}

emit(UploadComplete());

unawaited(_profileCubit.refreshBalance());
Expand Down Expand Up @@ -766,30 +758,15 @@ class UploadCubit extends Cubit<UploadState> {

uploadController.onDone(
(tasks) async {
logger.d('Upload files finished... Verifying results');

bool uploadSucced = true;

if (tasks.any((element) => element.status == UploadStatus.failed)) {
logger.e('One or more tasks failed. Emitting error');
// if any of the files failed, we should throw an error
addError(Exception('Error uploading'));

PlausibleEventTracker.trackUploadFailure();
uploadSucced = false;
}

unawaited(_profileCubit.refreshBalance());

// all files are uploaded

logger.i('Upload finished with success');
logger.i(
'Upload finished with success. Number of tasks: ${tasks.length}',
);

emit(UploadComplete());

if (uploadSucced) {
PlausibleEventTracker.trackUploadSuccess();
}
PlausibleEventTracker.trackUploadSuccess();
},
);

Expand Down Expand Up @@ -976,16 +953,14 @@ class UploadCubit extends Cubit<UploadState> {
emit(UploadFailure(error: UploadErrors.unknown));
}

@override
void onError(Object error, StackTrace stackTrace) {
void _emitError(Object error) {
if (error is TurboUploadTimeoutException) {
emit(UploadFailure(error: UploadErrors.turboTimeout));

return;
}

emit(UploadFailure(error: UploadErrors.unknown));
super.onError(error, stackTrace);
}

Future<void> cancelUpload() async {
Expand Down
Loading
Loading