diff --git a/app_flowy/lib/workspace/application/menu/menu_bloc.dart b/app_flowy/lib/workspace/application/menu/menu_bloc.dart index b581723c57..db271c6e44 100644 --- a/app_flowy/lib/workspace/application/menu/menu_bloc.dart +++ b/app_flowy/lib/workspace/application/menu/menu_bloc.dart @@ -65,7 +65,7 @@ class MenuBloc extends Bloc { abstract class MenuEvent with _$MenuEvent { const factory MenuEvent.initial() = _Initial; const factory MenuEvent.collapse() = Collapse; - const factory MenuEvent.openPage(PageContext context) = OpenPage; + const factory MenuEvent.openPage(HomeStackContext context) = OpenPage; const factory MenuEvent.createApp(String name, {String? desc}) = CreateApp; } @@ -75,7 +75,7 @@ abstract class MenuState implements _$MenuState { required bool isCollapse, required Option> apps, required Either successOrFailure, - PageContext? pageContext, + HomeStackContext? pageContext, }) = _MenuState; factory MenuState.initial() => MenuState( diff --git a/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart b/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart index 6f10495e19..8a8a73c583 100644 --- a/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart +++ b/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart @@ -24,7 +24,7 @@ class _$MenuEventTearOff { return const Collapse(); } - OpenPage openPage(PageContext context) { + OpenPage openPage(HomeStackContext context) { return OpenPage( context, ); @@ -47,7 +47,7 @@ mixin _$MenuEvent { TResult when({ required TResult Function() initial, required TResult Function() collapse, - required TResult Function(PageContext context) openPage, + required TResult Function(HomeStackContext context) openPage, required TResult Function(String name, String? desc) createApp, }) => throw _privateConstructorUsedError; @@ -55,7 +55,7 @@ mixin _$MenuEvent { TResult maybeWhen({ TResult Function()? initial, TResult Function()? collapse, - TResult Function(PageContext context)? openPage, + TResult Function(HomeStackContext context)? openPage, TResult Function(String name, String? desc)? createApp, required TResult orElse(), }) => @@ -133,7 +133,7 @@ class _$_Initial implements _Initial { TResult when({ required TResult Function() initial, required TResult Function() collapse, - required TResult Function(PageContext context) openPage, + required TResult Function(HomeStackContext context) openPage, required TResult Function(String name, String? desc) createApp, }) { return initial(); @@ -144,7 +144,7 @@ class _$_Initial implements _Initial { TResult maybeWhen({ TResult Function()? initial, TResult Function()? collapse, - TResult Function(PageContext context)? openPage, + TResult Function(HomeStackContext context)? openPage, TResult Function(String name, String? desc)? createApp, required TResult orElse(), }) { @@ -224,7 +224,7 @@ class _$Collapse implements Collapse { TResult when({ required TResult Function() initial, required TResult Function() collapse, - required TResult Function(PageContext context) openPage, + required TResult Function(HomeStackContext context) openPage, required TResult Function(String name, String? desc) createApp, }) { return collapse(); @@ -235,7 +235,7 @@ class _$Collapse implements Collapse { TResult maybeWhen({ TResult Function()? initial, TResult Function()? collapse, - TResult Function(PageContext context)? openPage, + TResult Function(HomeStackContext context)? openPage, TResult Function(String name, String? desc)? createApp, required TResult orElse(), }) { @@ -280,7 +280,7 @@ abstract class Collapse implements MenuEvent { abstract class $OpenPageCopyWith<$Res> { factory $OpenPageCopyWith(OpenPage value, $Res Function(OpenPage) then) = _$OpenPageCopyWithImpl<$Res>; - $Res call({PageContext context}); + $Res call({HomeStackContext context}); } /// @nodoc @@ -300,7 +300,7 @@ class _$OpenPageCopyWithImpl<$Res> extends _$MenuEventCopyWithImpl<$Res> context == freezed ? _value.context : context // ignore: cast_nullable_to_non_nullable - as PageContext, + as HomeStackContext, )); } } @@ -311,7 +311,7 @@ class _$OpenPage implements OpenPage { const _$OpenPage(this.context); @override - final PageContext context; + final HomeStackContext context; @override String toString() { @@ -340,7 +340,7 @@ class _$OpenPage implements OpenPage { TResult when({ required TResult Function() initial, required TResult Function() collapse, - required TResult Function(PageContext context) openPage, + required TResult Function(HomeStackContext context) openPage, required TResult Function(String name, String? desc) createApp, }) { return openPage(context); @@ -351,7 +351,7 @@ class _$OpenPage implements OpenPage { TResult maybeWhen({ TResult Function()? initial, TResult Function()? collapse, - TResult Function(PageContext context)? openPage, + TResult Function(HomeStackContext context)? openPage, TResult Function(String name, String? desc)? createApp, required TResult orElse(), }) { @@ -389,9 +389,9 @@ class _$OpenPage implements OpenPage { } abstract class OpenPage implements MenuEvent { - const factory OpenPage(PageContext context) = _$OpenPage; + const factory OpenPage(HomeStackContext context) = _$OpenPage; - PageContext get context => throw _privateConstructorUsedError; + HomeStackContext get context => throw _privateConstructorUsedError; @JsonKey(ignore: true) $OpenPageCopyWith get copyWith => throw _privateConstructorUsedError; @@ -472,7 +472,7 @@ class _$CreateApp implements CreateApp { TResult when({ required TResult Function() initial, required TResult Function() collapse, - required TResult Function(PageContext context) openPage, + required TResult Function(HomeStackContext context) openPage, required TResult Function(String name, String? desc) createApp, }) { return createApp(name, desc); @@ -483,7 +483,7 @@ class _$CreateApp implements CreateApp { TResult maybeWhen({ TResult Function()? initial, TResult Function()? collapse, - TResult Function(PageContext context)? openPage, + TResult Function(HomeStackContext context)? openPage, TResult Function(String name, String? desc)? createApp, required TResult orElse(), }) { @@ -538,7 +538,7 @@ class _$MenuStateTearOff { {required bool isCollapse, required Option> apps, required Either successOrFailure, - PageContext? pageContext}) { + HomeStackContext? pageContext}) { return _MenuState( isCollapse: isCollapse, apps: apps, @@ -557,7 +557,7 @@ mixin _$MenuState { Option> get apps => throw _privateConstructorUsedError; Either get successOrFailure => throw _privateConstructorUsedError; - PageContext? get pageContext => throw _privateConstructorUsedError; + HomeStackContext? get pageContext => throw _privateConstructorUsedError; @JsonKey(ignore: true) $MenuStateCopyWith get copyWith => @@ -572,7 +572,7 @@ abstract class $MenuStateCopyWith<$Res> { {bool isCollapse, Option> apps, Either successOrFailure, - PageContext? pageContext}); + HomeStackContext? pageContext}); } /// @nodoc @@ -606,7 +606,7 @@ class _$MenuStateCopyWithImpl<$Res> implements $MenuStateCopyWith<$Res> { pageContext: pageContext == freezed ? _value.pageContext : pageContext // ignore: cast_nullable_to_non_nullable - as PageContext?, + as HomeStackContext?, )); } } @@ -621,7 +621,7 @@ abstract class _$MenuStateCopyWith<$Res> implements $MenuStateCopyWith<$Res> { {bool isCollapse, Option> apps, Either successOrFailure, - PageContext? pageContext}); + HomeStackContext? pageContext}); } /// @nodoc @@ -656,7 +656,7 @@ class __$MenuStateCopyWithImpl<$Res> extends _$MenuStateCopyWithImpl<$Res> pageContext: pageContext == freezed ? _value.pageContext : pageContext // ignore: cast_nullable_to_non_nullable - as PageContext?, + as HomeStackContext?, )); } } @@ -677,7 +677,7 @@ class _$_MenuState implements _MenuState { @override final Either successOrFailure; @override - final PageContext? pageContext; + final HomeStackContext? pageContext; @override String toString() { @@ -720,7 +720,7 @@ abstract class _MenuState implements MenuState { {required bool isCollapse, required Option> apps, required Either successOrFailure, - PageContext? pageContext}) = _$_MenuState; + HomeStackContext? pageContext}) = _$_MenuState; @override bool get isCollapse => throw _privateConstructorUsedError; @@ -730,7 +730,7 @@ abstract class _MenuState implements MenuState { Either get successOrFailure => throw _privateConstructorUsedError; @override - PageContext? get pageContext => throw _privateConstructorUsedError; + HomeStackContext? get pageContext => throw _privateConstructorUsedError; @override @JsonKey(ignore: true) _$MenuStateCopyWith<_MenuState> get copyWith => diff --git a/app_flowy/lib/workspace/domain/i_page_stack.dart b/app_flowy/lib/workspace/domain/i_page_stack.dart index 9d425bc9a3..00077f9d38 100644 --- a/app_flowy/lib/workspace/domain/i_page_stack.dart +++ b/app_flowy/lib/workspace/domain/i_page_stack.dart @@ -1,5 +1,5 @@ import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart'; abstract class IPageStack { - void setPageContext(PageContext context); + void setPageContext(HomeStackContext context); } diff --git a/app_flowy/lib/workspace/domain/page_stack/page_stack.dart b/app_flowy/lib/workspace/domain/page_stack/page_stack.dart index 4ffd56cef1..8d8aac8644 100644 --- a/app_flowy/lib/workspace/domain/page_stack/page_stack.dart +++ b/app_flowy/lib/workspace/domain/page_stack/page_stack.dart @@ -1,20 +1,18 @@ import 'package:app_flowy/workspace/domain/page_stack/page_stack_bloc.dart'; import 'package:equatable/equatable.dart'; +import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart'; import 'package:flutter/material.dart'; import 'package:app_flowy/workspace/presentation/widgets/blank_page.dart'; import 'package:app_flowy/workspace/presentation/widgets/fading_index_stack.dart'; import 'package:app_flowy/workspace/presentation/widgets/prelude.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -List pages = PageType.values.toList(); -enum PageType { - blank, -} +List pages = ViewType.values.toList(); -abstract class PageContext extends Equatable { - final PageType pageType; - final String pageTitle; - const PageContext(this.pageType, {required this.pageTitle}); +abstract class HomeStackContext extends Equatable { + final ViewType type; + final String title; + const HomeStackContext({required this.type, required this.title}); } class HomePageStack { @@ -22,12 +20,11 @@ class HomePageStack { HomePageStack(); String title() { - return _bloc.state.pageContext.pageTitle; + return _bloc.state.pageContext.title; } - void setPageContext(PageContext? newContext) { - _bloc - .add(PageStackEvent.setContext(newContext ?? const BlankPageContext())); + void setPageContext(HomeStackContext? newContext) { + _bloc.add(PageStackEvent.setContext(newContext ?? BlankPageContext())); } Widget stackTopBar() { @@ -36,7 +33,7 @@ class HomePageStack { child: BlocBuilder( builder: (context, state) { return HomeTopBar( - title: state.pageContext.pageTitle, + title: state.pageContext.title, ); }, ), @@ -50,7 +47,7 @@ class HomePageStack { builder: (context, state) { final pageContext = state.pageContext; return FadingIndexedStack( - index: pages.indexOf(pageContext.pageType), + index: pages.indexOf(pageContext.type), children: buildPagesWidget(pageContext), ); }, @@ -59,26 +56,31 @@ class HomePageStack { } } -List buildPagesWidget(PageContext pageContext) { - return PageType.values.map((pageType) { - if (pageType == pageContext.pageType) { - return pageType.builder(pageContext); +List buildPagesWidget(HomeStackContext pageContext) { + return ViewType.values.map((viewType) { + if (viewType == pageContext.type) { + return viewType.builderDisplayWidget(pageContext); } else { return const BlankPage(context: BlankPageContext()); } }).toList(); } -extension PageTypeExtension on PageType { - HomeStackPage builder(PageContext context) { +extension PageTypeExtension on ViewType { + HomeStackWidget builderDisplayWidget(HomeStackContext context) { switch (this) { - case PageType.blank: - return BlankPage(context: context); + case ViewType.Blank: + return BlankPage(context: context as BlankPageContext); + case ViewType.Doc: + return BlankPage(context: context as BlankPageContext); + default: + return BlankPage(context: context as BlankPageContext); } } } -abstract class HomeStackPage extends StatefulWidget { - final PageContext pageContext; - const HomeStackPage({Key? key, required this.pageContext}) : super(key: key); +abstract class HomeStackWidget extends StatefulWidget { + final HomeStackContext pageContext; + const HomeStackWidget({Key? key, required this.pageContext}) + : super(key: key); } diff --git a/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dart b/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dart index a10f8f744d..505aeff989 100644 --- a/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dart +++ b/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dart @@ -19,14 +19,14 @@ class PageStackBloc extends Bloc { @freezed abstract class PageStackEvent with _$PageStackEvent { - const factory PageStackEvent.setContext(PageContext newContext) = + const factory PageStackEvent.setContext(HomeStackContext newContext) = NewPageContext; } @freezed abstract class PageStackState implements _$PageStackState { const factory PageStackState({ - required PageContext pageContext, + required HomeStackContext pageContext, }) = _PageStackState; factory PageStackState.initial() => const PageStackState( diff --git a/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.freezed.dart b/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.freezed.dart index 4848610881..47e9d05548 100644 --- a/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.freezed.dart +++ b/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.freezed.dart @@ -16,7 +16,7 @@ final _privateConstructorUsedError = UnsupportedError( class _$PageStackEventTearOff { const _$PageStackEventTearOff(); - NewPageContext setContext(PageContext newContext) { + NewPageContext setContext(HomeStackContext newContext) { return NewPageContext( newContext, ); @@ -28,16 +28,16 @@ const $PageStackEvent = _$PageStackEventTearOff(); /// @nodoc mixin _$PageStackEvent { - PageContext get newContext => throw _privateConstructorUsedError; + HomeStackContext get newContext => throw _privateConstructorUsedError; @optionalTypeArgs TResult when({ - required TResult Function(PageContext newContext) setContext, + required TResult Function(HomeStackContext newContext) setContext, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ - TResult Function(PageContext newContext)? setContext, + TResult Function(HomeStackContext newContext)? setContext, required TResult orElse(), }) => throw _privateConstructorUsedError; @@ -63,7 +63,7 @@ abstract class $PageStackEventCopyWith<$Res> { factory $PageStackEventCopyWith( PageStackEvent value, $Res Function(PageStackEvent) then) = _$PageStackEventCopyWithImpl<$Res>; - $Res call({PageContext newContext}); + $Res call({HomeStackContext newContext}); } /// @nodoc @@ -83,7 +83,7 @@ class _$PageStackEventCopyWithImpl<$Res> newContext: newContext == freezed ? _value.newContext : newContext // ignore: cast_nullable_to_non_nullable - as PageContext, + as HomeStackContext, )); } } @@ -95,7 +95,7 @@ abstract class $NewPageContextCopyWith<$Res> NewPageContext value, $Res Function(NewPageContext) then) = _$NewPageContextCopyWithImpl<$Res>; @override - $Res call({PageContext newContext}); + $Res call({HomeStackContext newContext}); } /// @nodoc @@ -117,7 +117,7 @@ class _$NewPageContextCopyWithImpl<$Res> newContext == freezed ? _value.newContext : newContext // ignore: cast_nullable_to_non_nullable - as PageContext, + as HomeStackContext, )); } } @@ -128,7 +128,7 @@ class _$NewPageContext implements NewPageContext { const _$NewPageContext(this.newContext); @override - final PageContext newContext; + final HomeStackContext newContext; @override String toString() { @@ -156,7 +156,7 @@ class _$NewPageContext implements NewPageContext { @override @optionalTypeArgs TResult when({ - required TResult Function(PageContext newContext) setContext, + required TResult Function(HomeStackContext newContext) setContext, }) { return setContext(newContext); } @@ -164,7 +164,7 @@ class _$NewPageContext implements NewPageContext { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(PageContext newContext)? setContext, + TResult Function(HomeStackContext newContext)? setContext, required TResult orElse(), }) { if (setContext != null) { @@ -195,10 +195,10 @@ class _$NewPageContext implements NewPageContext { } abstract class NewPageContext implements PageStackEvent { - const factory NewPageContext(PageContext newContext) = _$NewPageContext; + const factory NewPageContext(HomeStackContext newContext) = _$NewPageContext; @override - PageContext get newContext => throw _privateConstructorUsedError; + HomeStackContext get newContext => throw _privateConstructorUsedError; @override @JsonKey(ignore: true) $NewPageContextCopyWith get copyWith => @@ -209,7 +209,7 @@ abstract class NewPageContext implements PageStackEvent { class _$PageStackStateTearOff { const _$PageStackStateTearOff(); - _PageStackState call({required PageContext pageContext}) { + _PageStackState call({required HomeStackContext pageContext}) { return _PageStackState( pageContext: pageContext, ); @@ -221,7 +221,7 @@ const $PageStackState = _$PageStackStateTearOff(); /// @nodoc mixin _$PageStackState { - PageContext get pageContext => throw _privateConstructorUsedError; + HomeStackContext get pageContext => throw _privateConstructorUsedError; @JsonKey(ignore: true) $PageStackStateCopyWith get copyWith => @@ -233,7 +233,7 @@ abstract class $PageStackStateCopyWith<$Res> { factory $PageStackStateCopyWith( PageStackState value, $Res Function(PageStackState) then) = _$PageStackStateCopyWithImpl<$Res>; - $Res call({PageContext pageContext}); + $Res call({HomeStackContext pageContext}); } /// @nodoc @@ -253,7 +253,7 @@ class _$PageStackStateCopyWithImpl<$Res> pageContext: pageContext == freezed ? _value.pageContext : pageContext // ignore: cast_nullable_to_non_nullable - as PageContext, + as HomeStackContext, )); } } @@ -265,7 +265,7 @@ abstract class _$PageStackStateCopyWith<$Res> _PageStackState value, $Res Function(_PageStackState) then) = __$PageStackStateCopyWithImpl<$Res>; @override - $Res call({PageContext pageContext}); + $Res call({HomeStackContext pageContext}); } /// @nodoc @@ -287,7 +287,7 @@ class __$PageStackStateCopyWithImpl<$Res> pageContext: pageContext == freezed ? _value.pageContext : pageContext // ignore: cast_nullable_to_non_nullable - as PageContext, + as HomeStackContext, )); } } @@ -298,7 +298,7 @@ class _$_PageStackState implements _PageStackState { const _$_PageStackState({required this.pageContext}); @override - final PageContext pageContext; + final HomeStackContext pageContext; @override String toString() { @@ -325,11 +325,11 @@ class _$_PageStackState implements _PageStackState { } abstract class _PageStackState implements PageStackState { - const factory _PageStackState({required PageContext pageContext}) = + const factory _PageStackState({required HomeStackContext pageContext}) = _$_PageStackState; @override - PageContext get pageContext => throw _privateConstructorUsedError; + HomeStackContext get pageContext => throw _privateConstructorUsedError; @override @JsonKey(ignore: true) _$PageStackStateCopyWith<_PageStackState> get copyWith => diff --git a/app_flowy/lib/workspace/presentation/app/app_widget.dart b/app_flowy/lib/workspace/presentation/app/app_widget.dart index a11ea61b85..cadf15b5a9 100644 --- a/app_flowy/lib/workspace/presentation/app/app_widget.dart +++ b/app_flowy/lib/workspace/presentation/app/app_widget.dart @@ -133,7 +133,7 @@ class AppHeader extends StatelessWidget { List menuItemBuilder() { return ViewType.values - // .where((element) => element != ViewType.ViewTypeUnknown) + .where((element) => element != ViewType.Blank) .map((ty) { return PopupMenuItem( value: ty, diff --git a/app_flowy/lib/workspace/presentation/doc/doc_widget.dart b/app_flowy/lib/workspace/presentation/doc/doc_widget.dart new file mode 100644 index 0000000000..bf44a06c90 --- /dev/null +++ b/app_flowy/lib/workspace/presentation/doc/doc_widget.dart @@ -0,0 +1,38 @@ +import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart'; +import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart'; +import 'package:flutter/material.dart'; + +class DocPageContext extends HomeStackContext { + final View view; + DocPageContext(this.view) + : super( + type: view.viewType, + title: view.name, + ); + + @override + List get props => [view.id, type]; +} + +class DocPage extends HomeStackWidget { + const DocPage({Key? key, required DocPageContext context}) + : super(key: key, pageContext: context); + + @override + _DocPageState createState() => _DocPageState(); +} + +class _DocPageState extends State { + @override + Widget build(BuildContext context) { + assert(widget.pageContext is DocPageContext); + + final context = widget.pageContext as DocPageContext; + final filename = _extractFilename(context.view.id); + return Container(); + } + + String _extractFilename(String viewId) { + return viewId.replaceFirst('doc_', ''); + } +} diff --git a/app_flowy/lib/workspace/presentation/widgets/blank_page.dart b/app_flowy/lib/workspace/presentation/widgets/blank_page.dart index a3e8d520b0..03264b8f02 100644 --- a/app_flowy/lib/workspace/presentation/widgets/blank_page.dart +++ b/app_flowy/lib/workspace/presentation/widgets/blank_page.dart @@ -1,15 +1,16 @@ import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart'; +import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart'; import 'package:flutter/material.dart'; -class BlankPageContext extends PageContext { - const BlankPageContext() : super(PageType.blank, pageTitle: 'Blank'); +class BlankPageContext extends HomeStackContext { + const BlankPageContext() : super(type: ViewType.Blank, title: 'Blank'); @override List get props => []; } -class BlankPage extends HomeStackPage { - const BlankPage({Key? key, required PageContext context}) +class BlankPage extends HomeStackWidget { + const BlankPage({Key? key, required BlankPageContext context}) : super(key: key, pageContext: context); @override diff --git a/app_flowy/lib/workspace/presentation/widgets/home_stack_page.dart b/app_flowy/lib/workspace/presentation/widgets/home_stack_page.dart index 84ad664b57..a99b097c8f 100644 --- a/app_flowy/lib/workspace/presentation/widgets/home_stack_page.dart +++ b/app_flowy/lib/workspace/presentation/widgets/home_stack_page.dart @@ -2,6 +2,6 @@ import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart'; import 'package:flutter/material.dart'; abstract class HomeStackPage extends StatefulWidget { - final PageContext pageContext; + final HomeStackContext pageContext; const HomeStackPage({Key? key, required this.pageContext}) : super(key: key); } diff --git a/app_flowy/lib/workspace/presentation/widgets/menu/menu.dart b/app_flowy/lib/workspace/presentation/widgets/menu/menu.dart index 166b2413ba..22f61bb16f 100644 --- a/app_flowy/lib/workspace/presentation/widgets/menu/menu.dart +++ b/app_flowy/lib/workspace/presentation/widgets/menu/menu.dart @@ -20,7 +20,7 @@ import 'package:textstyle_extensions/textstyle_extensions.dart'; import 'app_list.dart'; class HomeMenu extends StatelessWidget { - final Function(PageContext?) pageContextChanged; + final Function(HomeStackContext?) pageContextChanged; final Function(bool) isCollapseChanged; final String workspaceId; diff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pb.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pb.dart index c4f0b58855..208da2c0b4 100644 --- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pb.dart +++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pb.dart @@ -29,7 +29,7 @@ class CreateViewRequest extends $pb.GeneratedMessage { ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'thumbnail') - ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Docs, valueOf: ViewType.valueOf, enumValues: ViewType.values) + ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Blank, valueOf: ViewType.valueOf, enumValues: ViewType.values) ..hasRequiredFields = false ; @@ -135,7 +135,7 @@ class View extends $pb.GeneratedMessage { ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'appId') ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') - ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Docs, valueOf: ViewType.valueOf, enumValues: ViewType.values) + ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Blank, valueOf: ViewType.valueOf, enumValues: ViewType.values) ..hasRequiredFields = false ; diff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbenum.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbenum.dart index cc2d2d742e..790a0bd3d1 100644 --- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbenum.dart +++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbenum.dart @@ -10,10 +10,12 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class ViewType extends $pb.ProtobufEnum { - static const ViewType Docs = ViewType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Docs'); + static const ViewType Blank = ViewType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Blank'); + static const ViewType Doc = ViewType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Doc'); static const $core.List values = [ - Docs, + Blank, + Doc, ]; static final $core.Map<$core.int, ViewType> _byValue = $pb.ProtobufEnum.initByValue(values); diff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbjson.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbjson.dart index c50c801b98..acb1a48392 100644 --- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbjson.dart +++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-workspace/view_create.pbjson.dart @@ -12,12 +12,13 @@ import 'dart:typed_data' as $typed_data; const ViewType$json = const { '1': 'ViewType', '2': const [ - const {'1': 'Docs', '2': 0}, + const {'1': 'Blank', '2': 0}, + const {'1': 'Doc', '2': 1}, ], }; /// Descriptor for `ViewType`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List viewTypeDescriptor = $convert.base64Decode('CghWaWV3VHlwZRIICgREb2NzEAA='); +final $typed_data.Uint8List viewTypeDescriptor = $convert.base64Decode('CghWaWV3VHlwZRIJCgVCbGFuaxAAEgcKA0RvYxAB'); @$core.Deprecated('Use createViewRequestDescriptor instead') const CreateViewRequest$json = const { '1': 'CreateViewRequest', diff --git a/rust-lib/dart-ffi/Cargo.toml b/rust-lib/dart-ffi/Cargo.toml index 6feb76f4cc..fc345df327 100644 --- a/rust-lib/dart-ffi/Cargo.toml +++ b/rust-lib/dart-ffi/Cargo.toml @@ -7,11 +7,11 @@ edition = "2018" [lib] name = "dart_ffi" # this value will change depending on the target os -# for iOS it would be `cdylib` -# for Macos it would be `cdylib` +# for iOS it would be `rlib` +# for Macos it would be `rlib` # for android it would be `c-dylib` -# default cdylib -crate-type = ["cdylib"] +# default rlib +crate-type = ["rlib"] [dependencies] diff --git a/rust-lib/flowy-workspace/src/entities/view/parser/view_type.rs b/rust-lib/flowy-workspace/src/entities/view/parser/view_type.rs index 9fc7ae0a58..286d7d8c17 100644 --- a/rust-lib/flowy-workspace/src/entities/view/parser/view_type.rs +++ b/rust-lib/flowy-workspace/src/entities/view/parser/view_type.rs @@ -6,7 +6,10 @@ pub struct ViewTypeCheck(pub ViewTableType); impl ViewTypeCheck { pub fn parse(s: ViewType) -> Result { match s { - ViewType::Docs => Ok(Self(ViewTableType::Docs)), + ViewType::Blank => { + Err("Impossible to here, because you can create blank view".to_owned()) + }, + ViewType::Doc => Ok(Self(ViewTableType::Docs)), } } } diff --git a/rust-lib/flowy-workspace/src/entities/view/view_create.rs b/rust-lib/flowy-workspace/src/entities/view/view_create.rs index 1727c59609..4caf5a95bb 100644 --- a/rust-lib/flowy-workspace/src/entities/view/view_create.rs +++ b/rust-lib/flowy-workspace/src/entities/view/view_create.rs @@ -9,11 +9,12 @@ use std::convert::TryInto; #[derive(PartialEq, Debug, ProtoBuf_Enum)] pub enum ViewType { - Docs = 0, + Blank = 0, + Doc = 1, } impl std::default::Default for ViewType { - fn default() -> Self { ViewType::Docs } + fn default() -> Self { ViewType::Blank } } #[derive(Default, ProtoBuf)] diff --git a/rust-lib/flowy-workspace/src/protobuf/model/view_create.rs b/rust-lib/flowy-workspace/src/protobuf/model/view_create.rs index 4e6f80ca63..b11518212d 100644 --- a/rust-lib/flowy-workspace/src/protobuf/model/view_create.rs +++ b/rust-lib/flowy-workspace/src/protobuf/model/view_create.rs @@ -187,7 +187,7 @@ impl CreateViewRequest { self.view_type } pub fn clear_view_type(&mut self) { - self.view_type = ViewType::Docs; + self.view_type = ViewType::Blank; } // Param is passed by value, moved @@ -244,7 +244,7 @@ impl ::protobuf::Message for CreateViewRequest { if !self.desc.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.desc); } - if self.view_type != ViewType::Docs { + if self.view_type != ViewType::Blank { my_size += ::protobuf::rt::enum_size(5, self.view_type); } if let ::std::option::Option::Some(ref v) = self.one_of_thumbnail { @@ -269,7 +269,7 @@ impl ::protobuf::Message for CreateViewRequest { if !self.desc.is_empty() { os.write_string(3, &self.desc)?; } - if self.view_type != ViewType::Docs { + if self.view_type != ViewType::Blank { os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.view_type))?; } if let ::std::option::Option::Some(ref v) = self.one_of_thumbnail { @@ -362,7 +362,7 @@ impl ::protobuf::Clear for CreateViewRequest { self.name.clear(); self.desc.clear(); self.one_of_thumbnail = ::std::option::Option::None; - self.view_type = ViewType::Docs; + self.view_type = ViewType::Blank; self.unknown_fields.clear(); } } @@ -514,7 +514,7 @@ impl View { self.view_type } pub fn clear_view_type(&mut self) { - self.view_type = ViewType::Docs; + self.view_type = ViewType::Blank; } // Param is passed by value, moved @@ -571,7 +571,7 @@ impl ::protobuf::Message for View { if !self.desc.is_empty() { my_size += ::protobuf::rt::string_size(4, &self.desc); } - if self.view_type != ViewType::Docs { + if self.view_type != ViewType::Blank { my_size += ::protobuf::rt::enum_size(5, self.view_type); } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); @@ -592,7 +592,7 @@ impl ::protobuf::Message for View { if !self.desc.is_empty() { os.write_string(4, &self.desc)?; } - if self.view_type != ViewType::Docs { + if self.view_type != ViewType::Blank { os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.view_type))?; } os.write_unknown_fields(self.get_unknown_fields())?; @@ -678,7 +678,7 @@ impl ::protobuf::Clear for View { self.app_id.clear(); self.name.clear(); self.desc.clear(); - self.view_type = ViewType::Docs; + self.view_type = ViewType::Blank; self.unknown_fields.clear(); } } @@ -863,7 +863,8 @@ impl ::protobuf::reflect::ProtobufValue for RepeatedView { #[derive(Clone,PartialEq,Eq,Debug,Hash)] pub enum ViewType { - Docs = 0, + Blank = 0, + Doc = 1, } impl ::protobuf::ProtobufEnum for ViewType { @@ -873,14 +874,16 @@ impl ::protobuf::ProtobufEnum for ViewType { fn from_i32(value: i32) -> ::std::option::Option { match value { - 0 => ::std::option::Option::Some(ViewType::Docs), + 0 => ::std::option::Option::Some(ViewType::Blank), + 1 => ::std::option::Option::Some(ViewType::Doc), _ => ::std::option::Option::None } } fn values() -> &'static [Self] { static values: &'static [ViewType] = &[ - ViewType::Docs, + ViewType::Blank, + ViewType::Doc, ]; values } @@ -898,7 +901,7 @@ impl ::std::marker::Copy for ViewType { impl ::std::default::Default for ViewType { fn default() -> Self { - ViewType::Docs + ViewType::Blank } } @@ -918,47 +921,49 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x20\x01(\tR\x05appId\x12\x12\n\x04name\x18\x03\x20\x01(\tR\x04name\x12\ \x12\n\x04desc\x18\x04\x20\x01(\tR\x04desc\x12&\n\tview_type\x18\x05\x20\ \x01(\x0e2\t.ViewTypeR\x08viewType\"+\n\x0cRepeatedView\x12\x1b\n\x05ite\ - ms\x18\x01\x20\x03(\x0b2\x05.ViewR\x05items*\x14\n\x08ViewType\x12\x08\n\ - \x04Docs\x10\0J\xa1\x06\n\x06\x12\x04\0\0\x15\x01\n\x08\n\x01\x0c\x12\ - \x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x08\x01\n\n\n\x03\x04\0\x01\ - \x12\x03\x02\x08\x19\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x16\n\x0c\n\ - \x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\ - \x03\x03\x0b\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x14\x15\n\x0b\n\ - \x04\x04\0\x02\x01\x12\x03\x04\x04\x14\n\x0c\n\x05\x04\0\x02\x01\x05\x12\ - \x03\x04\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x0f\n\x0c\n\ - \x05\x04\0\x02\x01\x03\x12\x03\x04\x12\x13\n\x0b\n\x04\x04\0\x02\x02\x12\ - \x03\x05\x04\x14\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x04\n\n\x0c\n\ - \x05\x04\0\x02\x02\x01\x12\x03\x05\x0b\x0f\n\x0c\n\x05\x04\0\x02\x02\x03\ - \x12\x03\x05\x12\x13\n\x0b\n\x04\x04\0\x08\0\x12\x03\x06\x044\n\x0c\n\ - \x05\x04\0\x08\0\x01\x12\x03\x06\n\x1a\n\x0b\n\x04\x04\0\x02\x03\x12\x03\ - \x06\x1d2\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x06\x1d#\n\x0c\n\x05\x04\ - \0\x02\x03\x01\x12\x03\x06$-\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x0601\ - \n\x0b\n\x04\x04\0\x02\x04\x12\x03\x07\x04\x1b\n\x0c\n\x05\x04\0\x02\x04\ - \x06\x12\x03\x07\x04\x0c\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x07\r\x16\ - \n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x07\x19\x1a\n\n\n\x02\x04\x01\x12\ - \x04\t\0\x0f\x01\n\n\n\x03\x04\x01\x01\x12\x03\t\x08\x0c\n\x0b\n\x04\x04\ - \x01\x02\0\x12\x03\n\x04\x12\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\n\x04\ - \n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\n\x0b\r\n\x0c\n\x05\x04\x01\x02\ - \0\x03\x12\x03\n\x10\x11\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x0b\x04\x16\ - \n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x0b\x04\n\n\x0c\n\x05\x04\x01\ - \x02\x01\x01\x12\x03\x0b\x0b\x11\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\ - \x0b\x14\x15\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x0c\x04\x14\n\x0c\n\x05\ - \x04\x01\x02\x02\x05\x12\x03\x0c\x04\n\n\x0c\n\x05\x04\x01\x02\x02\x01\ - \x12\x03\x0c\x0b\x0f\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x0c\x12\x13\ - \n\x0b\n\x04\x04\x01\x02\x03\x12\x03\r\x04\x14\n\x0c\n\x05\x04\x01\x02\ - \x03\x05\x12\x03\r\x04\n\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\r\x0b\ - \x0f\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\r\x12\x13\n\x0b\n\x04\x04\ - \x01\x02\x04\x12\x03\x0e\x04\x1b\n\x0c\n\x05\x04\x01\x02\x04\x06\x12\x03\ - \x0e\x04\x0c\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03\x0e\r\x16\n\x0c\n\ - \x05\x04\x01\x02\x04\x03\x12\x03\x0e\x19\x1a\n\n\n\x02\x04\x02\x12\x04\ - \x10\0\x12\x01\n\n\n\x03\x04\x02\x01\x12\x03\x10\x08\x14\n\x0b\n\x04\x04\ - \x02\x02\0\x12\x03\x11\x04\x1c\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\x11\ - \x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x06\x12\x03\x11\r\x11\n\x0c\n\x05\x04\ - \x02\x02\0\x01\x12\x03\x11\x12\x17\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\ - \x11\x1a\x1b\n\n\n\x02\x05\0\x12\x04\x13\0\x15\x01\n\n\n\x03\x05\0\x01\ - \x12\x03\x13\x05\r\n\x0b\n\x04\x05\0\x02\0\x12\x03\x14\x04\r\n\x0c\n\x05\ - \x05\0\x02\0\x01\x12\x03\x14\x04\x08\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\ - \x14\x0b\x0cb\x06proto3\ + ms\x18\x01\x20\x03(\x0b2\x05.ViewR\x05items*\x1e\n\x08ViewType\x12\t\n\ + \x05Blank\x10\0\x12\x07\n\x03Doc\x10\x01J\xca\x06\n\x06\x12\x04\0\0\x16\ + \x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x08\ + \x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x19\n\x0b\n\x04\x04\0\x02\0\x12\ + \x03\x03\x04\x16\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\ + \x05\x04\0\x02\0\x01\x12\x03\x03\x0b\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\ + \x03\x03\x14\x15\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x14\n\x0c\n\ + \x05\x04\0\x02\x01\x05\x12\x03\x04\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\ + \x12\x03\x04\x0b\x0f\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x12\x13\n\ + \x0b\n\x04\x04\0\x02\x02\x12\x03\x05\x04\x14\n\x0c\n\x05\x04\0\x02\x02\ + \x05\x12\x03\x05\x04\n\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x05\x0b\x0f\ + \n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x05\x12\x13\n\x0b\n\x04\x04\0\x08\ + \0\x12\x03\x06\x044\n\x0c\n\x05\x04\0\x08\0\x01\x12\x03\x06\n\x1a\n\x0b\ + \n\x04\x04\0\x02\x03\x12\x03\x06\x1d2\n\x0c\n\x05\x04\0\x02\x03\x05\x12\ + \x03\x06\x1d#\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x06$-\n\x0c\n\x05\ + \x04\0\x02\x03\x03\x12\x03\x0601\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x07\ + \x04\x1b\n\x0c\n\x05\x04\0\x02\x04\x06\x12\x03\x07\x04\x0c\n\x0c\n\x05\ + \x04\0\x02\x04\x01\x12\x03\x07\r\x16\n\x0c\n\x05\x04\0\x02\x04\x03\x12\ + \x03\x07\x19\x1a\n\n\n\x02\x04\x01\x12\x04\t\0\x0f\x01\n\n\n\x03\x04\x01\ + \x01\x12\x03\t\x08\x0c\n\x0b\n\x04\x04\x01\x02\0\x12\x03\n\x04\x12\n\x0c\ + \n\x05\x04\x01\x02\0\x05\x12\x03\n\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\ + \x12\x03\n\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\n\x10\x11\n\x0b\n\ + \x04\x04\x01\x02\x01\x12\x03\x0b\x04\x16\n\x0c\n\x05\x04\x01\x02\x01\x05\ + \x12\x03\x0b\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x0b\x0b\x11\n\ + \x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x0b\x14\x15\n\x0b\n\x04\x04\x01\ + \x02\x02\x12\x03\x0c\x04\x14\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x0c\ + \x04\n\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x0c\x0b\x0f\n\x0c\n\x05\ + \x04\x01\x02\x02\x03\x12\x03\x0c\x12\x13\n\x0b\n\x04\x04\x01\x02\x03\x12\ + \x03\r\x04\x14\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\r\x04\n\n\x0c\n\ + \x05\x04\x01\x02\x03\x01\x12\x03\r\x0b\x0f\n\x0c\n\x05\x04\x01\x02\x03\ + \x03\x12\x03\r\x12\x13\n\x0b\n\x04\x04\x01\x02\x04\x12\x03\x0e\x04\x1b\n\ + \x0c\n\x05\x04\x01\x02\x04\x06\x12\x03\x0e\x04\x0c\n\x0c\n\x05\x04\x01\ + \x02\x04\x01\x12\x03\x0e\r\x16\n\x0c\n\x05\x04\x01\x02\x04\x03\x12\x03\ + \x0e\x19\x1a\n\n\n\x02\x04\x02\x12\x04\x10\0\x12\x01\n\n\n\x03\x04\x02\ + \x01\x12\x03\x10\x08\x14\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x11\x04\x1c\n\ + \x0c\n\x05\x04\x02\x02\0\x04\x12\x03\x11\x04\x0c\n\x0c\n\x05\x04\x02\x02\ + \0\x06\x12\x03\x11\r\x11\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x11\x12\ + \x17\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x11\x1a\x1b\n\n\n\x02\x05\0\ + \x12\x04\x13\0\x16\x01\n\n\n\x03\x05\0\x01\x12\x03\x13\x05\r\n\x0b\n\x04\ + \x05\0\x02\0\x12\x03\x14\x04\x0e\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x14\ + \x04\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x14\x0c\r\n\x0b\n\x04\x05\0\ + \x02\x01\x12\x03\x15\x04\x0c\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x15\ + \x04\x07\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x15\n\x0bb\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/rust-lib/flowy-workspace/src/protobuf/proto/view_create.proto b/rust-lib/flowy-workspace/src/protobuf/proto/view_create.proto index dbe967606e..d57cb2bfa7 100644 --- a/rust-lib/flowy-workspace/src/protobuf/proto/view_create.proto +++ b/rust-lib/flowy-workspace/src/protobuf/proto/view_create.proto @@ -18,5 +18,6 @@ message RepeatedView { repeated View items = 1; } enum ViewType { - Docs = 0; + Blank = 0; + Doc = 1; } diff --git a/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs b/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs index b43818dcfe..3a4ffc2f94 100644 --- a/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs +++ b/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs @@ -43,7 +43,7 @@ impl ViewTable { impl std::convert::Into for ViewTable { fn into(self) -> View { let view_type = match self.view_type { - ViewTableType::Docs => ViewType::Docs, + ViewTableType::Docs => ViewType::Doc, }; View { diff --git a/rust-lib/flowy-workspace/tests/event/app_test.rs b/rust-lib/flowy-workspace/tests/event/app_test.rs index 17cb3a728b..cc497d57a6 100644 --- a/rust-lib/flowy-workspace/tests/event/app_test.rs +++ b/rust-lib/flowy-workspace/tests/event/app_test.rs @@ -37,7 +37,7 @@ fn app_create_with_view_and_then_get_success() { name: "View A".to_string(), desc: "".to_string(), thumbnail: None, - view_type: ViewType::Docs, + view_type: ViewType::Doc, }; let request_b = CreateViewRequest { @@ -45,7 +45,7 @@ fn app_create_with_view_and_then_get_success() { name: "View B".to_string(), desc: "".to_string(), thumbnail: None, - view_type: ViewType::Docs, + view_type: ViewType::Doc, }; let view_a = create_view(request_a);