Skip to content

Commit

Permalink
chore(hygiene): cleans up the code PE-5309
Browse files Browse the repository at this point in the history
  • Loading branch information
matibat committed Jan 5, 2024
1 parent fe03b09 commit 340bca1
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 31 deletions.
14 changes: 0 additions & 14 deletions lib/blocs/drive_detail/drive_detail_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ class DriveDetailCubit extends Cubit<DriveDetailState> {
final rootFolderNode =
await _driveDao.getFolderTree(driveId, drive.rootFolderId);

if (_refreshSelectedItem) {
logger.d('Refreshing selected item: $_selectedItem');
}

if (_selectedItem != null && _refreshSelectedItem) {
if (_selectedItem is FileDataTableItem) {
final index = folderContents.files.indexWhere(
Expand All @@ -170,8 +166,6 @@ class DriveDetailCubit extends Cubit<DriveDetailState> {
_selectedItem!.index,
_selectedItem!.isOwner,
);

logger.d('Selected file: $_selectedItem');
}
} else if (_selectedItem is FolderDataTableItem) {
final index = folderContents.subfolders.indexWhere(
Expand All @@ -185,8 +179,6 @@ class DriveDetailCubit extends Cubit<DriveDetailState> {
_selectedItem!.index,
_selectedItem!.isOwner,
);

logger.d('Selected folder: $_selectedItem');
}
} else {
_selectedItem = DriveDataTableItemMapper.fromDrive(
Expand All @@ -196,17 +188,13 @@ class DriveDetailCubit extends Cubit<DriveDetailState> {
_selectedItem!.isOwner,
);
}

// _refreshSelectedItem = false;
}

final currentFolderContents = parseEntitiesToDatatableItem(
folder: folderContents,
isOwner: isDriveOwner(_auth, drive.ownerAddress),
);

logger.d('Drive detail state with item: $_selectedItem');

if (state != null) {
emit(
state.copyWith(
Expand Down Expand Up @@ -423,8 +411,6 @@ class DriveDetailCubit extends Cubit<DriveDetailState> {
}

void refreshDriveDataTable() {
logger.d('Asked to refresh drive data table');

// _refreshSelectedItem = true;

if (state is DriveDetailLoadSuccess) {
Expand Down
2 changes: 0 additions & 2 deletions lib/components/details_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class DetailsPanel extends StatefulWidget {
const DetailsPanel({
super.key,
required this.item,
// required this.maybeSelectedItem,
required this.drivePrivacy,
this.revisions,
this.fileKey,
Expand All @@ -53,7 +52,6 @@ class DetailsPanel extends StatefulWidget {
});

final ArDriveDataTableItem item;
// final SelectedItem? maybeSelectedItem;
final Privacy drivePrivacy;
final List<FileRevision>? revisions;
final SecretKey? fileKey;
Expand Down
5 changes: 1 addition & 4 deletions lib/components/hide_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ class HideDialog extends StatelessWidget {
listener: (context, state) {
if (state is SuccessHideState) {
Navigator.of(context).pop();

// _driveDetailCubit.refreshDriveDataTable();

logger.d('Successfully hid entity');
logger.d('Successfully hid/unhid entity');
} else if (state is ConfirmingHideState) {
_driveDetailCubit.refreshDriveDataTable();
context.read<HideBloc>().add(const ConfirmUploadEvent());
Expand Down
4 changes: 0 additions & 4 deletions lib/pages/app_router_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ class AppRouterDelegate extends RouterDelegate<AppRoutePath>
listeners: [
BlocListener<DriveDetailCubit, DriveDetailState>(
listener: (context, driveDetailCubitState) {
logger.d(
'DriveDetailCubit state at app_router: $driveDetailCubitState',
);

if (driveDetailCubitState is DriveDetailLoadSuccess) {
driveId = driveDetailCubitState.currentDrive.id;
driveFolderId =
Expand Down
2 changes: 0 additions & 2 deletions lib/pages/drive_detail/components/drive_detail_data_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Widget _buildDataList(
BuildContext context,
DriveDetailLoadSuccess state,
) {
// logger.d('Building data list for state: $state');

return _buildDataListContent(
context,
state.currentFolderContents,
Expand Down
4 changes: 0 additions & 4 deletions lib/pages/drive_detail/drive_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ class _DriveDetailPageState extends State<DriveDetailPage> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Hey, mati
Expanded(
child: _buildDataList(
context,
Expand Down Expand Up @@ -533,8 +532,6 @@ class _DriveDetailPageState extends State<DriveDetailPage> {
isSharePage: false,
drivePrivacy:
driveDetailState.currentDrive.privacy,
// maybeSelectedItem:
// driveDetailState.maybeSelectedItem(),
item: driveDetailState.selectedItem!,
onNextImageNavigation: () {
context
Expand Down Expand Up @@ -605,7 +602,6 @@ class _DriveDetailPageState extends State<DriveDetailPage> {
currentDrive: driveDetailLoadSuccessState.currentDrive,
isSharePage: false,
drivePrivacy: driveDetailLoadSuccessState.currentDrive.privacy,
// maybeSelectedItem: driveDetailLoadSuccessState.maybeSelectedItem(),
item: driveDetailLoadSuccessState.selectedItem!,
onNextImageNavigation: () {
context.read<DriveDetailCubit>().selectNextImage();
Expand Down
1 change: 0 additions & 1 deletion lib/pages/shared_file/shared_file_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class SharedFilePage extends StatelessWidget {
false,
),
isSharePage: true,
// maybeSelectedItem: null,
fileKey: state.fileKey,
revisions: state.fileRevisions,
drivePrivacy: state.fileKey != null ? 'private' : 'public',
Expand Down

0 comments on commit 340bca1

Please sign in to comment.