Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

refactor: create view interface (#2772)

Nathan.fooo4f5672c2af8a
diff --git a/frontend/appflowy_flutter/lib/workspace/application/app/app_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/app/app_bloc.dart
index 01bb49fc04..c246a9d81f 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/app/app_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/app/app_bloc.dart
@@ -113,6 +113,7 @@ class AppBloc extends Bloc<AppEvent, AppState> {
layoutType: value.pluginBuilder.layoutType!,
initialDataBytes: value.initialDataBytes,
ext: value.ext ?? {},
+ openAfterCreate: true,
);
result.fold(
(view) => emit(
diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
index 267dfaad8b..58605ab462 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
@@ -18,8 +18,11 @@ class ViewBackendService {
required String name,
String? desc,
- /// If [openAfterCreate] is true, the view will be opened after created.
- bool openAfterCreate = true,
+ /// The default value of [openAfterCreate] is false, meaning the view will
+ /// not be opened nor set as the current view. However, if set to true, the
+ /// view will be opened and set as the current view. Upon relaunching the
+ /// app, this view will be opened
+ bool openAfterCreate = false,
/// The initial data should be a JSON that represent the DocumentDataPB.
/// Currently, only support create document with initial data.
diff --git a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart
index 9c7391b53c..2cedbd7716 100644
--- a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart
+++ b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart
@@ -33,6 +33,7 @@ class AppFlowyBoardTest {
parentViewId: app.id,
name: "Test Board",
layoutType: builder.layoutType!,
+ openAfterCreate: true,
).then((result) {
return result.fold(
(view) async {
diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart
index c7184c9e96..5f74f7540e 100644
--- a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart
+++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart
@@ -11,6 +11,7 @@ Future<GridTestContext> createTestFilterGrid(AppFlowyGridTest gridTest) async {
parentViewId: app.id,
name: "Filter Grid",
layoutType: builder.layoutType!,
+ openAfterCreate: true,
).then((result) {
return result.fold(
(view) async {
diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart
index c2de80c67a..144cbe8bd4 100644
--- a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart
+++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart
@@ -176,6 +176,7 @@ class AppFlowyGridTest {
parentViewId: app.id,
name: "Test Grid",
layoutType: builder.layoutType!,
+ openAfterCreate: true,
).then((result) {
return result.fold(
(view) async {