Skip to content

Commit

Permalink
chore: add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Jul 5, 2024
1 parent dced0f1 commit 7f0876e
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'package:appflowy/user/application/user_service.dart';
import 'package:appflowy/workspace/application/view/prelude.dart';
import 'package:appflowy/workspace/application/view/view_ext.dart';
import 'package:appflowy/workspace/application/view/view_service.dart';
import 'package:appflowy/workspace/application/workspace/prelude.dart';
import 'package:appflowy/workspace/application/workspace/workspace_sections_listener.dart';
import 'package:appflowy/workspace/application/workspace/workspace_service.dart';
import 'package:appflowy/workspace/presentation/home/menu/sidebar/space/space_icon_popup.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
Expand All @@ -21,6 +21,7 @@ import 'package:appflowy_result/appflowy_result.dart';
import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/uuid.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:protobuf/protobuf.dart';
Expand Down Expand Up @@ -337,6 +338,7 @@ class SpaceBloc extends Bloc<SpaceEvent, SpaceState> {
String? _workspaceId;
late UserProfilePB userProfile;
WorkspaceSectionsListener? _listener;
WorkspaceListener? _workspaceListener;

@override
Future<void> close() async {
Expand All @@ -356,6 +358,17 @@ class SpaceBloc extends Bloc<SpaceEvent, SpaceState> {
final publicSpaces = publicViews.where((e) => e.isSpace);
final privateSpaces = privateViews.where((e) => e.isSpace);

for (final view in publicViews) {
debugPrint('public view: ${view.name}');
}

for (final view in privateViews) {
debugPrint('private view: ${view.name}');
}

debugPrint('publicSpaces: ${publicSpaces.length}');
debugPrint('privateSpaces: ${privateSpaces.length}');

return ([...publicSpaces, ...privateSpaces], publicViews, privateViews);
}

Expand Down Expand Up @@ -434,11 +447,24 @@ class SpaceBloc extends Bloc<SpaceEvent, SpaceState> {
add(const SpaceEvent.didReceiveSpaceUpdate());
},
);

_workspaceListener =
WorkspaceListener(user: userProfile, workspaceId: workspaceId)
..start(
onWorkspaceUpdated: (result) {
debugPrint('workspace updated $result');
},
appsChanged: (p0) {
debugPrint('apps changed $p0');
},
);
}

void _reset(UserProfilePB userProfile, String workspaceId) {
_listener?.stop();
_listener = null;
_workspaceListener?.stop();
_workspaceListener = null;

_initial(userProfile, workspaceId);
}
Expand Down

0 comments on commit 7f0876e

Please sign in to comment.