Skip to content

Commit

Permalink
Merge pull request #1393 from ardriveapp/PE-4544-lock-multi-select-wh…
Browse files Browse the repository at this point in the history
…en-a-modal-is-open

PE-4544: lock multi select when a modal is open
  • Loading branch information
thiagocarvalhodev authored Sep 28, 2023
2 parents 2aa99ea + 0d025a0 commit e594ba8
Show file tree
Hide file tree
Showing 39 changed files with 136 additions and 72 deletions.
1 change: 1 addition & 0 deletions lib/authentication/components/biometric_toggle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class _BiometricToggleState extends State<BiometricToggle> {
} catch (e) {
widget.onError?.call();
if (e is BiometricException) {
// ignore: use_build_context_synchronously
showBiometricExceptionDialogForException(
context,
e,
Expand Down
13 changes: 7 additions & 6 deletions lib/authentication/login/views/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:ardrive/utils/io_utils.dart';
import 'package:ardrive/utils/logger/logger.dart';
import 'package:ardrive/utils/open_url.dart';
import 'package:ardrive/utils/pre_cache_assets.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive/utils/split_localizations.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:arweave/arweave.dart';
Expand Down Expand Up @@ -212,7 +213,7 @@ class _LoginPageScaffoldState extends State<LoginPageScaffold> {
logger.e('Login Failure', state.error);

if (state.error is WalletMismatchException) {
showAnimatedDialog(
showArDriveDialog(
context,
content: ArDriveIconModal(
title: appLocalizationsOf(context).loginFailed,
Expand All @@ -232,7 +233,7 @@ class _LoginPageScaffoldState extends State<LoginPageScaffold> {
return;
}

showAnimatedDialog(
showArDriveDialog(
context,
content: ArDriveIconModal(
title: appLocalizationsOf(context).loginFailed,
Expand Down Expand Up @@ -927,7 +928,7 @@ class _CreatePasswordViewState extends State<CreatePasswordView> {
final isValid = _formKey.currentState!.validateSync();

if (!isValid) {
showAnimatedDialog(context,
showArDriveDialog(context,
content: ArDriveIconModal(
icon: ArDriveIcons.triangle(
size: 88,
Expand All @@ -948,7 +949,7 @@ class _CreatePasswordViewState extends State<CreatePasswordView> {
}

if (_passwordController.text != _confirmPasswordController.text) {
showAnimatedDialog(context,
showArDriveDialog(context,
content: ArDriveIconModal(
icon: ArDriveIcons.triangle(
size: 88,
Expand Down Expand Up @@ -1433,7 +1434,7 @@ class _EnterSeedPhraseViewState extends State<EnterSeedPhraseView> {
bip39.validateMnemonic(_seedPhraseController.text);

if (!isValid) {
showAnimatedDialog(context,
showArDriveDialog(context,
content: ArDriveIconModal(
icon: ArDriveIcons.triangle(
size: 88,
Expand Down Expand Up @@ -2204,7 +2205,7 @@ class CreateNewWalletViewState extends State<CreateNewWalletView> {
color: colors.themeErrorMuted,
)
.copyWith(fontSize: 14)))
]),
]),
shape: RoundedRectangleBorder(
side: BorderSide(
color: colors.themeErrorMuted, width: 1),
Expand Down
3 changes: 2 additions & 1 deletion lib/components/create_manifest_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../utils/show_general_dialog.dart';
import 'components.dart';

Future<void> promptToCreateManifest(
BuildContext context, {
required Drive drive,
}) {
return showAnimatedDialog(
return showArDriveDialog(
context,
content: BlocProvider(
create: (context) => CreateManifestCubit(
Expand Down
36 changes: 17 additions & 19 deletions lib/components/create_snapshot_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import 'package:ardrive/blocs/profile/profile_cubit.dart';
import 'package:ardrive/components/components.dart';
import 'package:ardrive/entities/string_types.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/pages/user_interaction_wrapper.dart';
import 'package:ardrive/services/arweave/arweave.dart';
import 'package:ardrive/services/pst/pst.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/filesize.dart';
import 'package:ardrive/utils/html/html_util.dart';
import 'package:ardrive/utils/logger/logger.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive/utils/split_localizations.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
Expand All @@ -22,24 +22,22 @@ Future<void> promptToCreateSnapshot(
BuildContext context,
Drive drive,
) async {
return showModalDialog(
context,
() => showAnimatedDialog(
context,
barrierDismissible: false,
content: BlocProvider(
create: (_) => CreateSnapshotCubit(
arweave: context.read<ArweaveService>(),
driveDao: context.read<DriveDao>(),
profileCubit: context.read<ProfileCubit>(),
pst: context.read<PstService>(),
tabVisibility: TabVisibilitySingleton(),
),
child: CreateSnapshotDialog(
drive: drive,
),
),
));
return showArDriveDialog(
context,
barrierDismissible: false,
content: BlocProvider(
create: (_) => CreateSnapshotCubit(
arweave: context.read<ArweaveService>(),
driveDao: context.read<DriveDao>(),
profileCubit: context.read<ProfileCubit>(),
pst: context.read<PstService>(),
tabVisibility: TabVisibilitySingleton(),
),
child: CreateSnapshotDialog(
drive: drive,
),
),
);
}

class CreateSnapshotDialog extends StatelessWidget {
Expand Down
3 changes: 2 additions & 1 deletion lib/components/csv_export_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:ardrive/models/models.dart';
import 'package:ardrive/services/services.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive_io/ardrive_io.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
Expand All @@ -15,7 +16,7 @@ Future<void> promptToExportCSVData({
required BuildContext context,
required String driveId,
}) =>
showAnimatedDialog(
showArDriveDialog(
context,
content: BlocProvider<DataExportCubit>(
create: (_) {
Expand Down
7 changes: 4 additions & 3 deletions lib/components/drive_attach_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:cryptography/cryptography.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../utils/show_general_dialog.dart';
import 'components.dart';

Future<void> attachDrive({
Expand All @@ -25,7 +26,7 @@ Future<void> attachDrive({
profileState is ProfileLoggedIn ? profileState.cipherKey : null;
return showModalDialog(
context,
() => showAnimatedDialog(
() => showArDriveDialog(
context,
content: BlocProvider<DriveAttachCubit>(
create: (context) => DriveAttachCubit(
Expand Down Expand Up @@ -87,15 +88,15 @@ class _DriveAttachFormState extends State<DriveAttachForm> {
return BlocConsumer<DriveAttachCubit, DriveAttachState>(
listener: (context, state) {
if (state is DriveAttachInvalidDriveKey) {
showAnimatedDialog(
showArDriveDialog(
context,
content: ArDriveStandardModal(
title: appLocalizationsOf(context).error,
description: appLocalizationsOf(context).invalidKeyFile,
),
);
} else if (state is DriveAttachDriveNotFound) {
showAnimatedDialog(
showArDriveDialog(
context,
content: ArDriveStandardModal(
title: appLocalizationsOf(context).error,
Expand Down
3 changes: 2 additions & 1 deletion lib/components/drive_create_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:ardrive/services/services.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive/utils/validate_folder_name.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
Expand All @@ -18,7 +19,7 @@ import 'components.dart';
Future<void> promptToCreateDrive(BuildContext context) =>
showCongestionDependentModalDialog(
context,
() => showAnimatedDialog(
() => showArDriveDialog(
context,
content: BlocProvider(
create: (_) => DriveCreateCubit(
Expand Down
3 changes: 2 additions & 1 deletion lib/components/drive_detach_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:ardrive/blocs/drives/drives_cubit.dart';
import 'package:ardrive/entities/string_types.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -10,7 +11,7 @@ Future<void> showDetachDriveDialog({
required DriveID driveID,
required String driveName,
}) =>
showAnimatedDialog(
showArDriveDialog(
context,
content: ArDriveStandardModal(
title: appLocalizationsOf(context).detachDrive,
Expand Down
3 changes: 2 additions & 1 deletion lib/components/drive_rename_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:ardrive/services/services.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive/utils/validate_folder_name.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
Expand All @@ -20,7 +21,7 @@ Future<void> promptToRenameDrive(
}) =>
showCongestionDependentModalDialog(
context,
() => showAnimatedDialog(
() => showArDriveDialog(
context,
content: MultiBlocProvider(
providers: [
Expand Down
3 changes: 2 additions & 1 deletion lib/components/drive_share_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:ardrive/components/details_panel.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -12,7 +13,7 @@ Future<void> promptToShareDrive({
required BuildContext context,
required Drive drive,
}) =>
showAnimatedDialog(
showArDriveDialog(
context,
content: BlocProvider(
create: (_) => DriveShareCubit(
Expand Down
4 changes: 2 additions & 2 deletions lib/components/feedback_survey.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/open_url_utils.dart';
import 'package:ardrive/utils/screen_sizes.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

Future<void> openFeedbackSurveyModal(BuildContext context) =>
showAnimatedDialog(
Future<void> openFeedbackSurveyModal(BuildContext context) => showArDriveDialog(
context,
content: const FeedbackSurveyModal(),
);
Expand Down
7 changes: 4 additions & 3 deletions lib/components/file_download_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:ardrive/services/services.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/filesize.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive_io/ardrive_io.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:cryptography/cryptography.dart';
Expand Down Expand Up @@ -41,7 +42,7 @@ Future<void> promptToDownloadProfileFile({
driveDao: context.read<DriveDao>(),
arweave: arweave,
)..download(cipherKey);
return showAnimatedDialog(
return showArDriveDialog(
context,
barrierDismissible: false,
content: BlocProvider<FileDownloadCubit>.value(
Expand Down Expand Up @@ -76,7 +77,7 @@ Future<void> promptToDownloadFileRevision({
arweave: arweave,
)..download(cipherKey);

return showAnimatedDialog(
return showArDriveDialog(
context,
barrierDismissible: false,
content: BlocProvider<FileDownloadCubit>.value(
Expand All @@ -97,7 +98,7 @@ Future<void> promptToDownloadSharedFile({
fileKey: fileKey,
arweave: context.read<ArweaveService>(),
);
return showAnimatedDialog(
return showArDriveDialog(
context,
barrierDismissible: false,
content: BlocProvider<FileDownloadCubit>.value(
Expand Down
3 changes: 2 additions & 1 deletion lib/components/file_share_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:ardrive/components/details_panel.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -14,7 +15,7 @@ Future<void> promptToShareFile({
required String driveId,
required String fileId,
}) =>
showAnimatedDialog(
showArDriveDialog(
context,
content: BlocProvider<FileShareCubit>(
create: (_) => FileShareCubit(
Expand Down
5 changes: 3 additions & 2 deletions lib/components/folder_create_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:ardrive/services/services.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive/utils/validate_folder_name.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
Expand All @@ -19,7 +20,7 @@ Future<void> promptToCreateFolder(
}) =>
showCongestionDependentModalDialog(
context,
() => showAnimatedDialog(
() => showArDriveDialog(
context,
content: BlocProvider(
create: (context) => FolderCreateCubit(
Expand All @@ -40,7 +41,7 @@ Future<void> promptToCreateFolderWithoutCongestionWarning(
required String driveId,
required String parentFolderId,
}) =>
showAnimatedDialog(
showArDriveDialog(
context,
content: BlocProvider(
create: (context) => FolderCreateCubit(
Expand Down
5 changes: 3 additions & 2 deletions lib/components/fs_entry_move_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:ardrive/services/services.dart';
import 'package:ardrive/theme/theme.dart';
import 'package:ardrive/turbo/services/upload_service.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -17,7 +18,7 @@ Future<void> promptToMove(
required String driveId,
required List<ArDriveDataTableItem> selectedItems,
}) {
return showAnimatedDialog(
return showArDriveDialog(
context,
content: MultiBlocProvider(
providers: [
Expand Down Expand Up @@ -284,7 +285,7 @@ class FsEntryMoveForm extends StatelessWidget {
text: appLocalizationsOf(context)
.createFolderEmphasized,
onPressed: () {
showAnimatedDialog(
showArDriveDialog(
context,
content: BlocProvider(
create: (context) => FolderCreateCubit(
Expand Down
Loading

0 comments on commit e594ba8

Please sign in to comment.