Browse Source

refactor: create view interface (#2772)

* refactor: create view interface

* chore: update doc

Co-authored-by: Lucas.Xu <[email protected]>

---------

Co-authored-by: Lucas.Xu <[email protected]>
Nathan.fooo 1 year ago
parent
commit
4f5672c2af

+ 1 - 0
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(

+ 5 - 2
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.

+ 1 - 0
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 {

+ 1 - 0
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 {

+ 1 - 0
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 {