Skip to content

Commit

Permalink
Merge pull request #493 from ardriveapp/PE-1503
Browse files Browse the repository at this point in the history
Fix: Add validation of permission and no funds for AppDrawer buttons
  • Loading branch information
thiagocarvalhodev authored May 12, 2022
2 parents e02e4d4 + 30d8d8b commit 7fd464f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions lib/components/app_drawer/app_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ class AppDrawer extends StatelessWidget {
context: context,
isEnabled: state.hasWritePermissions && hasMinBalance,
itemTitle: appLocalizationsOf(context).newFolder,
message: hasMinBalance
? null
: appLocalizationsOf(context).insufficientFundsForCreateAFolder,
message: state.hasWritePermissions && !hasMinBalance
? appLocalizationsOf(context).insufficientFundsForCreateAFolder
: null,
value: (context) => promptToCreateFolder(
context,
driveId: state.currentDrive.id,
Expand All @@ -289,9 +289,9 @@ class AppDrawer extends StatelessWidget {
return _buildMenuItemTile(
context: context,
isEnabled: state.hasWritePermissions && hasMinBalance,
message: hasMinBalance
? null
: appLocalizationsOf(context).insufficientFundsForUploadFiles,
message: state.hasWritePermissions && !hasMinBalance
? appLocalizationsOf(context).insufficientFundsForUploadFiles
: null,
itemTitle: appLocalizationsOf(context).uploadFiles,
value: (context) => promptToUpload(
context,
Expand All @@ -308,9 +308,9 @@ class AppDrawer extends StatelessWidget {
context: context,
isEnabled: state.hasWritePermissions && hasMinBalance,
itemTitle: appLocalizationsOf(context).uploadFolder,
message: hasMinBalance
? null
: appLocalizationsOf(context).insufficientFundsForUploadFolders,
message: state.hasWritePermissions && !hasMinBalance
? appLocalizationsOf(context).insufficientFundsForUploadFolders
: null,
value: (context) => promptToUpload(
context,
driveId: state.currentDrive.id,
Expand All @@ -329,8 +329,8 @@ class AppDrawer extends StatelessWidget {
);
}

PopupMenuEntry<Function> _buildCreateDrive(BuildContext context,
DrivesLoadSuccess drivesState, bool hasMinBalance) {
PopupMenuEntry<Function> _buildCreateDrive(
BuildContext context, DrivesLoadSuccess drivesState, bool hasMinBalance) {
return _buildMenuItemTile(
context: context,
isEnabled: drivesState.canCreateNewDrive && hasMinBalance,
Expand Down Expand Up @@ -359,15 +359,15 @@ class AppDrawer extends StatelessWidget {
);
}

PopupMenuEntry<Function> _buildCreateManifestItem(BuildContext context,
DriveDetailLoadSuccess state, bool hasMinBalance) {
PopupMenuEntry<Function> _buildCreateManifestItem(
BuildContext context, DriveDetailLoadSuccess state, bool hasMinBalance) {
return _buildMenuItemTile(
context: context,
isEnabled: !state.driveIsEmpty,
isEnabled: !state.driveIsEmpty && hasMinBalance,
itemTitle: appLocalizationsOf(context).createManifest,
message: hasMinBalance
? null
: appLocalizationsOf(context).insufficientFundsForCreateAManifest,
message: !state.driveIsEmpty && !hasMinBalance
? appLocalizationsOf(context).insufficientFundsForCreateAManifest
: null,
value: (context) =>
promptToCreateManifest(context, drive: state.currentDrive),
);
Expand Down

0 comments on commit 7fd464f

Please sign in to comment.