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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
refactor: rename some class names
appflowyc1237452ab16
diff --git a/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.dart b/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.dartindex 2801fc049f..538c7b42b3 100644--- a/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.dart+++ b/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.dart@@ -1,11 +1,11 @@import 'dart:convert';-import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart';+import 'package:app_flowy/workspace/infrastructure/repos/document_repo.dart';import 'package:app_flowy/workspace/infrastructure/repos/trash_repo.dart';import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart';import 'package:flowy_sdk/protobuf/flowy-folder-data-model/trash.pb.dart';import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';-import 'package:flutter_quill/flutter_quill.dart';+import 'package:flutter_quill/flutter_quill.dart' show Document, Delta;import 'package:flowy_sdk/log.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:freezed_annotation/freezed_annotation.dart';@@ -13,21 +13,23 @@ import 'package:dartz/dartz.dart';import 'dart:async';part 'doc_bloc.freezed.dart';-class DocBloc extends Bloc<DocEvent, DocState> {+typedef FlutterQuillDocument = Document;++class DocumentBloc extends Bloc<DocumentEvent, DocumentState> {final View view;- final DocRepository repo;+ final DocumentRepository repo;final ViewListener listener;final TrashRepo trashRepo;- late Document document;+ late FlutterQuillDocument document;StreamSubscription? _subscription;- DocBloc({+ DocumentBloc({required this.view,required this.repo,required this.listener,required this.trashRepo,- }) : super(DocState.initial()) {- on<DocEvent>((event, emit) async {+ }) : super(DocumentState.initial()) {+ on<DocumentEvent>((event, emit) async {await event.map(initial: (Initial value) async {await _initial(value, emit);@@ -60,27 +62,27 @@ class DocBloc extends Bloc<DocEvent, DocState> {await _subscription?.cancel();}- repo.closeDoc();+ repo.closeDocument();return super.close();}- Future<void> _initial(Initial value, Emitter<DocState> emit) async {+ Future<void> _initial(Initial value, Emitter<DocumentState> emit) async {listener.deletedNotifier.addPublishListener((result) {result.fold(- (view) => add(const DocEvent.deleted()),+ (view) => add(const DocumentEvent.deleted()),(error) {},);});listener.restoredNotifier.addPublishListener((result) {result.fold(- (view) => add(const DocEvent.restore()),+ (view) => add(const DocumentEvent.restore()),(error) {},);});listener.start();- final result = await repo.readDoc();+ final result = await repo.openDocument();result.fold((doc) {document = _decodeJsonToDocument(doc.deltaJson);@@ -89,10 +91,10 @@ class DocBloc extends Bloc<DocEvent, DocState> {final documentDelta = document.toDelta();_composeDelta(delta, documentDelta);});- emit(state.copyWith(loadState: DocLoadState.finish(left(unit))));+ emit(state.copyWith(loadingState: DocumentLoadingState.finish(left(unit))));},(err) {- emit(state.copyWith(loadState: DocLoadState.finish(right(err))));+ emit(state.copyWith(loadingState: DocumentLoadingState.finish(right(err))));},);}@@ -126,31 +128,31 @@ class DocBloc extends Bloc<DocEvent, DocState> {}@freezed-class DocEvent with _$DocEvent {- const factory DocEvent.initial() = Initial;- const factory DocEvent.deleted() = Deleted;- const factory DocEvent.restore() = Restore;- const factory DocEvent.restorePage() = RestorePage;- const factory DocEvent.deletePermanently() = DeletePermanently;+class DocumentEvent with _$DocumentEvent {+ const factory DocumentEvent.initial() = Initial;+ const factory DocumentEvent.deleted() = Deleted;+ const factory DocumentEvent.restore() = Restore;+ const factory DocumentEvent.restorePage() = RestorePage;+ const factory DocumentEvent.deletePermanently() = DeletePermanently;}@freezed-class DocState with _$DocState {- const factory DocState({- required DocLoadState loadState,+class DocumentState with _$DocumentState {+ const factory DocumentState({+ required DocumentLoadingState loadingState,required bool isDeleted,required bool forceClose,- }) = _DocState;+ }) = _DocumentState;- factory DocState.initial() => const DocState(- loadState: _Loading(),+ factory DocumentState.initial() => const DocumentState(+ loadingState: _Loading(),isDeleted: false,forceClose: false,);}@freezed-class DocLoadState with _$DocLoadState {- const factory DocLoadState.loading() = _Loading;- const factory DocLoadState.finish(Either<Unit, FlowyError> successOrFail) = _Finish;+class DocumentLoadingState with _$DocumentLoadingState {+ const factory DocumentLoadingState.loading() = _Loading;+ const factory DocumentLoadingState.finish(Either<Unit, FlowyError> successOrFail) = _Finish;}diff --git a/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.freezed.dart b/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.freezed.dartindex 4b6f63f3d6..80804e8836 100644--- a/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.freezed.dart+++ b/frontend/app_flowy/lib/workspace/application/doc/doc_bloc.freezed.dart@@ -14,8 +14,8 @@ final _privateConstructorUsedError = UnsupportedError('It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');/// @nodoc-class _$DocEventTearOff {- const _$DocEventTearOff();+class _$DocumentEventTearOff {+ const _$DocumentEventTearOff();Initial initial() {return const Initial();@@ -39,10 +39,10 @@ class _$DocEventTearOff {}/// @nodoc-const $DocEvent = _$DocEventTearOff();+const $DocumentEvent = _$DocumentEventTearOff();/// @nodoc-mixin _$DocEvent {+mixin _$DocumentEvent {@optionalTypeArgsTResult when<TResult extends Object?>({required TResult Function() initial,@@ -102,18 +102,20 @@ mixin _$DocEvent {}/// @nodoc-abstract class $DocEventCopyWith<$Res> {- factory $DocEventCopyWith(DocEvent value, $Res Function(DocEvent) then) =- _$DocEventCopyWithImpl<$Res>;+abstract class $DocumentEventCopyWith<$Res> {+ factory $DocumentEventCopyWith(+ DocumentEvent value, $Res Function(DocumentEvent) then) =+ _$DocumentEventCopyWithImpl<$Res>;}/// @nodoc-class _$DocEventCopyWithImpl<$Res> implements $DocEventCopyWith<$Res> {- _$DocEventCopyWithImpl(this._value, this._then);+class _$DocumentEventCopyWithImpl<$Res>+ implements $DocumentEventCopyWith<$Res> {+ _$DocumentEventCopyWithImpl(this._value, this._then);- final DocEvent _value;+ final DocumentEvent _value;// ignore: unused_field- final $Res Function(DocEvent) _then;+ final $Res Function(DocumentEvent) _then;}/// @nodoc@@ -123,7 +125,7 @@ abstract class $InitialCopyWith<$Res> {}/// @nodoc-class _$InitialCopyWithImpl<$Res> extends _$DocEventCopyWithImpl<$Res>+class _$InitialCopyWithImpl<$Res> extends _$DocumentEventCopyWithImpl<$Res>implements $InitialCopyWith<$Res> {_$InitialCopyWithImpl(Initial _value, $Res Function(Initial) _then): super(_value, (v) => _then(v as Initial));@@ -139,7 +141,7 @@ class _$Initial implements Initial {@overrideString toString() {- return 'DocEvent.initial()';+ return 'DocumentEvent.initial()';}@override@@ -231,7 +233,7 @@ class _$Initial implements Initial {}}-abstract class Initial implements DocEvent {+abstract class Initial implements DocumentEvent {const factory Initial() = _$Initial;}@@ -242,7 +244,7 @@ abstract class $DeletedCopyWith<$Res> {}/// @nodoc-class _$DeletedCopyWithImpl<$Res> extends _$DocEventCopyWithImpl<$Res>+class _$DeletedCopyWithImpl<$Res> extends _$DocumentEventCopyWithImpl<$Res>implements $DeletedCopyWith<$Res> {_$DeletedCopyWithImpl(Deleted _value, $Res Function(Deleted) _then): super(_value, (v) => _then(v as Deleted));@@ -258,7 +260,7 @@ class _$Deleted implements Deleted {@overrideString toString() {- return 'DocEvent.deleted()';+ return 'DocumentEvent.deleted()';}@override@@ -350,7 +352,7 @@ class _$Deleted implements Deleted {}}-abstract class Deleted implements DocEvent {+abstract class Deleted implements DocumentEvent {const factory Deleted() = _$Deleted;}@@ -361,7 +363,7 @@ abstract class $RestoreCopyWith<$Res> {}/// @nodoc-class _$RestoreCopyWithImpl<$Res> extends _$DocEventCopyWithImpl<$Res>+class _$RestoreCopyWithImpl<$Res> extends _$DocumentEventCopyWithImpl<$Res>implements $RestoreCopyWith<$Res> {_$RestoreCopyWithImpl(Restore _value, $Res Function(Restore) _then): super(_value, (v) => _then(v as Restore));@@ -377,7 +379,7 @@ class _$Restore implements Restore {@overrideString toString() {- return 'DocEvent.restore()';+ return 'DocumentEvent.restore()';}@override@@ -469,7 +471,7 @@ class _$Restore implements Restore {}}-abstract class Restore implements DocEvent {+abstract class Restore implements DocumentEvent {const factory Restore() = _$Restore;}@@ -481,7 +483,7 @@ abstract class $RestorePageCopyWith<$Res> {}/// @nodoc-class _$RestorePageCopyWithImpl<$Res> extends _$DocEventCopyWithImpl<$Res>+class _$RestorePageCopyWithImpl<$Res> extends _$DocumentEventCopyWithImpl<$Res>implements $RestorePageCopyWith<$Res> {_$RestorePageCopyWithImpl(RestorePage _value, $Res Function(RestorePage) _then)@@ -498,7 +500,7 @@ class _$RestorePage implements RestorePage {@overrideString toString() {- return 'DocEvent.restorePage()';+ return 'DocumentEvent.restorePage()';}@override@@ -590,7 +592,7 @@ class _$RestorePage implements RestorePage {}}-abstract class RestorePage implements DocEvent {+abstract class RestorePage implements DocumentEvent {const factory RestorePage() = _$RestorePage;}@@ -602,7 +604,8 @@ abstract class $DeletePermanentlyCopyWith<$Res> {}/// @nodoc-class _$DeletePermanentlyCopyWithImpl<$Res> extends _$DocEventCopyWithImpl<$Res>+class _$DeletePermanentlyCopyWithImpl<$Res>+ extends _$DocumentEventCopyWithImpl<$Res>implements $DeletePermanentlyCopyWith<$Res> {_$DeletePermanentlyCopyWithImpl(DeletePermanently _value, $Res Function(DeletePermanently) _then)@@ -619,7 +622,7 @@ class _$DeletePermanently implements DeletePermanently {@overrideString toString() {- return 'DocEvent.deletePermanently()';+ return 'DocumentEvent.deletePermanently()';}@override@@ -711,20 +714,20 @@ class _$DeletePermanently implements DeletePermanently {}}-abstract class DeletePermanently implements DocEvent {+abstract class DeletePermanently implements DocumentEvent {const factory DeletePermanently() = _$DeletePermanently;}/// @nodoc-class _$DocStateTearOff {- const _$DocStateTearOff();+class _$DocumentStateTearOff {+ const _$DocumentStateTearOff();- _DocState call(- {required DocLoadState loadState,+ _DocumentState call(+ {required DocumentLoadingState loadingState,required bool isDeleted,required bool forceClose}) {- return _DocState(- loadState: loadState,+ return _DocumentState(+ loadingState: loadingState,isDeleted: isDeleted,forceClose: forceClose,);@@ -732,47 +735,50 @@ class _$DocStateTearOff {}/// @nodoc-const $DocState = _$DocStateTearOff();+const $DocumentState = _$DocumentStateTearOff();/// @nodoc-mixin _$DocState {- DocLoadState get loadState => throw _privateConstructorUsedError;+mixin _$DocumentState {+ DocumentLoadingState get loadingState => throw _privateConstructorUsedError;bool get isDeleted => throw _privateConstructorUsedError;bool get forceClose => throw _privateConstructorUsedError;@JsonKey(ignore: true)- $DocStateCopyWith<DocState> get copyWith =>+ $DocumentStateCopyWith<DocumentState> get copyWith =>throw _privateConstructorUsedError;}/// @nodoc-abstract class $DocStateCopyWith<$Res> {- factory $DocStateCopyWith(DocState value, $Res Function(DocState) then) =- _$DocStateCopyWithImpl<$Res>;- $Res call({DocLoadState loadState, bool isDeleted, bool forceClose});-- $DocLoadStateCopyWith<$Res> get loadState;+abstract class $DocumentStateCopyWith<$Res> {+ factory $DocumentStateCopyWith(+ DocumentState value, $Res Function(DocumentState) then) =+ _$DocumentStateCopyWithImpl<$Res>;+ $Res call(+ {DocumentLoadingState loadingState, bool isDeleted, bool forceClose});++ $DocumentLoadingStateCopyWith<$Res> get loadingState;}/// @nodoc-class _$DocStateCopyWithImpl<$Res> implements $DocStateCopyWith<$Res> {- _$DocStateCopyWithImpl(this._value, this._then);+class _$DocumentStateCopyWithImpl<$Res>+ implements $DocumentStateCopyWith<$Res> {+ _$DocumentStateCopyWithImpl(this._value, this._then);- final DocState _value;+ final DocumentState _value;// ignore: unused_field- final $Res Function(DocState) _then;+ final $Res Function(DocumentState) _then;@override$Res call({- Object? loadState = freezed,+ Object? loadingState = freezed,Object? isDeleted = freezed,Object? forceClose = freezed,}) {return _then(_value.copyWith(- loadState: loadState == freezed- ? _value.loadState- : loadState // ignore: cast_nullable_to_non_nullable- as DocLoadState,+ loadingState: loadingState == freezed+ ? _value.loadingState+ : loadingState // ignore: cast_nullable_to_non_nullable+ as DocumentLoadingState,isDeleted: isDeleted == freezed? _value.isDeleted: isDeleted // ignore: cast_nullable_to_non_nullable@@ -785,44 +791,49 @@ class _$DocStateCopyWithImpl<$Res> implements $DocStateCopyWith<$Res> {}@override- $DocLoadStateCopyWith<$Res> get loadState {- return $DocLoadStateCopyWith<$Res>(_value.loadState, (value) {- return _then(_value.copyWith(loadState: value));+ $DocumentLoadingStateCopyWith<$Res> get loadingState {+ return $DocumentLoadingStateCopyWith<$Res>(_value.loadingState, (value) {+ return _then(_value.copyWith(loadingState: value));});}}/// @nodoc-abstract class _$DocStateCopyWith<$Res> implements $DocStateCopyWith<$Res> {- factory _$DocStateCopyWith(_DocState value, $Res Function(_DocState) then) =- __$DocStateCopyWithImpl<$Res>;+abstract class _$DocumentStateCopyWith<$Res>+ implements $DocumentStateCopyWith<$Res> {+ factory _$DocumentStateCopyWith(+ _DocumentState value, $Res Function(_DocumentState) then) =+ __$DocumentStateCopyWithImpl<$Res>;@override- $Res call({DocLoadState loadState, bool isDeleted, bool forceClose});+ $Res call(+ {DocumentLoadingState loadingState, bool isDeleted, bool forceClose});@override- $DocLoadStateCopyWith<$Res> get loadState;+ $DocumentLoadingStateCopyWith<$Res> get loadingState;}/// @nodoc-class __$DocStateCopyWithImpl<$Res> extends _$DocStateCopyWithImpl<$Res>- implements _$DocStateCopyWith<$Res> {- __$DocStateCopyWithImpl(_DocState _value, $Res Function(_DocState) _then)- : super(_value, (v) => _then(v as _DocState));+class __$DocumentStateCopyWithImpl<$Res>+ extends _$DocumentStateCopyWithImpl<$Res>+ implements _$DocumentStateCopyWith<$Res> {+ __$DocumentStateCopyWithImpl(+ _DocumentState _value, $Res Function(_DocumentState) _then)+ : super(_value, (v) => _then(v as _DocumentState));@override- _DocState get _value => super._value as _DocState;+ _DocumentState get _value => super._value as _DocumentState;@override$Res call({- Object? loadState = freezed,+ Object? loadingState = freezed,Object? isDeleted = freezed,Object? forceClose = freezed,}) {- return _then(_DocState(- loadState: loadState == freezed- ? _value.loadState- : loadState // ignore: cast_nullable_to_non_nullable- as DocLoadState,+ return _then(_DocumentState(+ loadingState: loadingState == freezed+ ? _value.loadingState+ : loadingState // ignore: cast_nullable_to_non_nullable+ as DocumentLoadingState,isDeleted: isDeleted == freezed? _value.isDeleted: isDeleted // ignore: cast_nullable_to_non_nullable@@ -837,14 +848,14 @@ class __$DocStateCopyWithImpl<$Res> extends _$DocStateCopyWithImpl<$Res>/// @nodoc-class _$_DocState implements _DocState {- const _$_DocState(- {required this.loadState,+class _$_DocumentState implements _DocumentState {+ const _$_DocumentState(+ {required this.loadingState,required this.isDeleted,required this.forceClose});@override- final DocLoadState loadState;+ final DocumentLoadingState loadingState;@overridefinal bool isDeleted;@override@@ -852,16 +863,16 @@ class _$_DocState implements _DocState {@overrideString toString() {- return 'DocState(loadState: $loadState, isDeleted: $isDeleted, forceClose: $forceClose)';+ return 'DocumentState(loadingState: $loadingState, isDeleted: $isDeleted, forceClose: $forceClose)';}@overridebool operator ==(dynamic other) {return identical(this, other) ||- (other is _DocState &&- (identical(other.loadState, loadState) ||+ (other is _DocumentState &&+ (identical(other.loadingState, loadingState) ||const DeepCollectionEquality()- .equals(other.loadState, loadState)) &&+ .equals(other.loadingState, loadingState)) &&(identical(other.isDeleted, isDeleted) ||const DeepCollectionEquality().equals(other.isDeleted, isDeleted)) &&@@ -873,37 +884,37 @@ class _$_DocState implements _DocState {@overrideint get hashCode =>runtimeType.hashCode ^- const DeepCollectionEquality().hash(loadState) ^+ const DeepCollectionEquality().hash(loadingState) ^const DeepCollectionEquality().hash(isDeleted) ^const DeepCollectionEquality().hash(forceClose);@JsonKey(ignore: true)@override- _$DocStateCopyWith<_DocState> get copyWith =>- __$DocStateCopyWithImpl<_DocState>(this, _$identity);+ _$DocumentStateCopyWith<_DocumentState> get copyWith =>+ __$DocumentStateCopyWithImpl<_DocumentState>(this, _$identity);}-abstract class _DocState implements DocState {- const factory _DocState(- {required DocLoadState loadState,+abstract class _DocumentState implements DocumentState {+ const factory _DocumentState(+ {required DocumentLoadingState loadingState,required bool isDeleted,- required bool forceClose}) = _$_DocState;+ required bool forceClose}) = _$_DocumentState;@override- DocLoadState get loadState => throw _privateConstructorUsedError;+ DocumentLoadingState get loadingState => throw _privateConstructorUsedError;@overridebool get isDeleted => throw _privateConstructorUsedError;@overridebool get forceClose => throw _privateConstructorUsedError;@override@JsonKey(ignore: true)- _$DocStateCopyWith<_DocState> get copyWith =>+ _$DocumentStateCopyWith<_DocumentState> get copyWith =>throw _privateConstructorUsedError;}/// @nodoc-class _$DocLoadStateTearOff {- const _$DocLoadStateTearOff();+class _$DocumentLoadingStateTearOff {+ const _$DocumentLoadingStateTearOff();_Loading loading() {return const _Loading();@@ -917,15 +928,14 @@ class _$DocLoadStateTearOff {}/// @nodoc-const $DocLoadState = _$DocLoadStateTearOff();+const $DocumentLoadingState = _$DocumentLoadingStateTearOff();/// @nodoc-mixin _$DocLoadState {+mixin _$DocumentLoadingState {@optionalTypeArgsTResult when<TResult extends Object?>({required TResult Function() loading,- required TResult Function(Either<Unit, FlowyError> successOrFail)- finish,+ required TResult Function(Either<Unit, FlowyError> successOrFail) finish,}) =>throw _privateConstructorUsedError;@optionalTypeArgs@@ -963,19 +973,20 @@ mixin _$DocLoadState {}/// @nodoc-abstract class $DocLoadStateCopyWith<$Res> {- factory $DocLoadStateCopyWith(- DocLoadState value, $Res Function(DocLoadState) then) =- _$DocLoadStateCopyWithImpl<$Res>;+abstract class $DocumentLoadingStateCopyWith<$Res> {+ factory $DocumentLoadingStateCopyWith(DocumentLoadingState value,+ $Res Function(DocumentLoadingState) then) =+ _$DocumentLoadingStateCopyWithImpl<$Res>;}/// @nodoc-class _$DocLoadStateCopyWithImpl<$Res> implements $DocLoadStateCopyWith<$Res> {- _$DocLoadStateCopyWithImpl(this._value, this._then);+class _$DocumentLoadingStateCopyWithImpl<$Res>+ implements $DocumentLoadingStateCopyWith<$Res> {+ _$DocumentLoadingStateCopyWithImpl(this._value, this._then);- final DocLoadState _value;+ final DocumentLoadingState _value;// ignore: unused_field- final $Res Function(DocLoadState) _then;+ final $Res Function(DocumentLoadingState) _then;}/// @nodoc@@ -985,7 +996,8 @@ abstract class _$LoadingCopyWith<$Res> {}/// @nodoc-class __$LoadingCopyWithImpl<$Res> extends _$DocLoadStateCopyWithImpl<$Res>+class __$LoadingCopyWithImpl<$Res>+ extends _$DocumentLoadingStateCopyWithImpl<$Res>implements _$LoadingCopyWith<$Res> {__$LoadingCopyWithImpl(_Loading _value, $Res Function(_Loading) _then): super(_value, (v) => _then(v as _Loading));@@ -1001,7 +1013,7 @@ class _$_Loading implements _Loading {@overrideString toString() {- return 'DocLoadState.loading()';+ return 'DocumentLoadingState.loading()';}@override@@ -1016,8 +1028,7 @@ class _$_Loading implements _Loading {@optionalTypeArgsTResult when<TResult extends Object?>({required TResult Function() loading,- required TResult Function(Either<Unit, FlowyError> successOrFail)- finish,+ required TResult Function(Either<Unit, FlowyError> successOrFail) finish,}) {return loading();}@@ -1076,7 +1087,7 @@ class _$_Loading implements _Loading {}}-abstract class _Loading implements DocLoadState {+abstract class _Loading implements DocumentLoadingState {const factory _Loading() = _$_Loading;}@@ -1088,7 +1099,8 @@ abstract class _$FinishCopyWith<$Res> {}/// @nodoc-class __$FinishCopyWithImpl<$Res> extends _$DocLoadStateCopyWithImpl<$Res>+class __$FinishCopyWithImpl<$Res>+ extends _$DocumentLoadingStateCopyWithImpl<$Res>implements _$FinishCopyWith<$Res> {__$FinishCopyWithImpl(_Finish _value, $Res Function(_Finish) _then): super(_value, (v) => _then(v as _Finish));@@ -1119,7 +1131,7 @@ class _$_Finish implements _Finish {@overrideString toString() {- return 'DocLoadState.finish(successOrFail: $successOrFail)';+ return 'DocumentLoadingState.finish(successOrFail: $successOrFail)';}@override@@ -1144,8 +1156,7 @@ class _$_Finish implements _Finish {@optionalTypeArgsTResult when<TResult extends Object?>({required TResult Function() loading,- required TResult Function(Either<Unit, FlowyError> successOrFail)- finish,+ required TResult Function(Either<Unit, FlowyError> successOrFail) finish,}) {return finish(successOrFail);}@@ -1204,7 +1215,7 @@ class _$_Finish implements _Finish {}}-abstract class _Finish implements DocLoadState {+abstract class _Finish implements DocumentLoadingState {const factory _Finish(Either<Unit, FlowyError> successOrFail) = _$_Finish;Either<Unit, FlowyError> get successOrFail =>diff --git a/frontend/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart b/frontend/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dartindex a23f8bcd04..0eefbf12c8 100644--- a/frontend/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart+++ b/frontend/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart@@ -67,8 +67,7 @@ mixin _$MenuEvent {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,}) =>throw _privateConstructorUsedError;@optionalTypeArgs@@ -77,8 +76,7 @@ mixin _$MenuEvent {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,required TResult orElse(),}) =>throw _privateConstructorUsedError;@@ -182,8 +180,7 @@ class _$_Initial implements _Initial {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,}) {return initial?.call();}@@ -195,8 +192,7 @@ class _$_Initial implements _Initial {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,required TResult orElse(),}) {if (initial != null) {@@ -305,8 +301,7 @@ class _$Collapse implements Collapse {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,}) {return collapse?.call();}@@ -318,8 +313,7 @@ class _$Collapse implements Collapse {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,required TResult orElse(),}) {if (collapse != null) {@@ -453,8 +447,7 @@ class _$OpenPage implements OpenPage {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,}) {return openPage?.call(context);}@@ -466,8 +459,7 @@ class _$OpenPage implements OpenPage {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,required TResult orElse(),}) {if (openPage != null) {@@ -619,8 +611,7 @@ class _$CreateApp implements CreateApp {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,}) {return createApp?.call(name, desc);}@@ -632,8 +623,7 @@ class _$CreateApp implements CreateApp {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,required TResult orElse(),}) {if (createApp != null) {@@ -776,8 +766,7 @@ class _$ReceiveApps implements ReceiveApps {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,}) {return didReceiveApps?.call(appsOrFail);}@@ -789,8 +778,7 @@ class _$ReceiveApps implements ReceiveApps {TResult Function()? collapse,TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,TResult Function(String name, String? desc)? createApp,- TResult Function(Either<List<App>, FlowyError> appsOrFail)?- didReceiveApps,+ TResult Function(Either<List<App>, FlowyError> appsOrFail)? didReceiveApps,required TResult orElse(),}) {if (didReceiveApps != null) {diff --git a/frontend/app_flowy/lib/workspace/application/trash/trash_bloc.freezed.dart b/frontend/app_flowy/lib/workspace/application/trash/trash_bloc.freezed.dartindex 5fc468749e..2a2d9bcaa3 100644--- a/frontend/app_flowy/lib/workspace/application/trash/trash_bloc.freezed.dart+++ b/frontend/app_flowy/lib/workspace/application/trash/trash_bloc.freezed.dart@@ -1007,8 +1007,7 @@ abstract class $TrashStateCopyWith<$Res> {factory $TrashStateCopyWith(TrashState value, $Res Function(TrashState) then) =_$TrashStateCopyWithImpl<$Res>;- $Res call(- {List<Trash> objects, Either<Unit, FlowyError> successOrFailure});+ $Res call({List<Trash> objects, Either<Unit, FlowyError> successOrFailure});}/// @nodoc@@ -1043,8 +1042,7 @@ abstract class _$TrashStateCopyWith<$Res> implements $TrashStateCopyWith<$Res> {_TrashState value, $Res Function(_TrashState) then) =__$TrashStateCopyWithImpl<$Res>;@override- $Res call(- {List<Trash> objects, Either<Unit, FlowyError> successOrFailure});+ $Res call({List<Trash> objects, Either<Unit, FlowyError> successOrFailure});}/// @nodocdiff --git a/frontend/app_flowy/lib/workspace/application/view/view_bloc.freezed.dart b/frontend/app_flowy/lib/workspace/application/view/view_bloc.freezed.dartindex 4f1fe4b838..51729bca73 100644--- a/frontend/app_flowy/lib/workspace/application/view/view_bloc.freezed.dart+++ b/frontend/app_flowy/lib/workspace/application/view/view_bloc.freezed.dart@@ -60,8 +60,7 @@ mixin _$ViewEvent {required TResult Function(String newName) rename,required TResult Function() delete,required TResult Function() duplicate,- required TResult Function(Either<View, FlowyError> result)- viewDidUpdate,+ required TResult Function(Either<View, FlowyError> result) viewDidUpdate,}) =>throw _privateConstructorUsedError;@optionalTypeArgs@@ -175,8 +174,7 @@ class _$Initial implements Initial {required TResult Function(String newName) rename,required TResult Function() delete,required TResult Function() duplicate,- required TResult Function(Either<View, FlowyError> result)- viewDidUpdate,+ required TResult Function(Either<View, FlowyError> result) viewDidUpdate,}) {return initial();}@@ -328,8 +326,7 @@ class _$SetEditing implements SetEditing {required TResult Function(String newName) rename,required TResult Function() delete,required TResult Function() duplicate,- required TResult Function(Either<View, FlowyError> result)- viewDidUpdate,+ required TResult Function(Either<View, FlowyError> result) viewDidUpdate,}) {return setIsEditing(isEditing);}@@ -484,8 +481,7 @@ class _$Rename implements Rename {required TResult Function(String newName) rename,required TResult Function() delete,required TResult Function() duplicate,- required TResult Function(Either<View, FlowyError> result)- viewDidUpdate,+ required TResult Function(Either<View, FlowyError> result) viewDidUpdate,}) {return rename(newName);}@@ -614,8 +610,7 @@ class _$Delete implements Delete {required TResult Function(String newName) rename,required TResult Function() delete,required TResult Function() duplicate,- required TResult Function(Either<View, FlowyError> result)- viewDidUpdate,+ required TResult Function(Either<View, FlowyError> result) viewDidUpdate,}) {return delete();}@@ -740,8 +735,7 @@ class _$Duplicate implements Duplicate {required TResult Function(String newName) rename,required TResult Function() delete,required TResult Function() duplicate,- required TResult Function(Either<View, FlowyError> result)- viewDidUpdate,+ required TResult Function(Either<View, FlowyError> result) viewDidUpdate,}) {return duplicate();}@@ -893,8 +887,7 @@ class _$ViewDidUpdate implements ViewDidUpdate {required TResult Function(String newName) rename,required TResult Function() delete,required TResult Function() duplicate,- required TResult Function(Either<View, FlowyError> result)- viewDidUpdate,+ required TResult Function(Either<View, FlowyError> result) viewDidUpdate,}) {return viewDidUpdate(result);}@@ -1019,9 +1012,7 @@ abstract class $ViewStateCopyWith<$Res> {factory $ViewStateCopyWith(ViewState value, $Res Function(ViewState) then) =_$ViewStateCopyWithImpl<$Res>;$Res call(- {View view,- bool isEditing,- Either<Unit, FlowyError> successOrFailure});+ {View view, bool isEditing, Either<Unit, FlowyError> successOrFailure});}/// @nodoc@@ -1062,9 +1053,7 @@ abstract class _$ViewStateCopyWith<$Res> implements $ViewStateCopyWith<$Res> {__$ViewStateCopyWithImpl<$Res>;@override$Res call(- {View view,- bool isEditing,- Either<Unit, FlowyError> successOrFailure});+ {View view, bool isEditing, Either<Unit, FlowyError> successOrFailure});}/// @nodocdiff --git a/frontend/app_flowy/lib/workspace/application/workspace/welcome_bloc.freezed.dart b/frontend/app_flowy/lib/workspace/application/workspace/welcome_bloc.freezed.dartindex 6bd2c9bf4f..b82475bc73 100644--- a/frontend/app_flowy/lib/workspace/application/workspace/welcome_bloc.freezed.dart+++ b/frontend/app_flowy/lib/workspace/application/workspace/welcome_bloc.freezed.dart@@ -872,10 +872,9 @@ class _$_WelcomeState implements _WelcomeState {abstract class _WelcomeState implements WelcomeState {const factory _WelcomeState(- {required bool isLoading,- required List<Workspace> workspaces,- required Either<Unit, FlowyError> successOrFailure}) =- _$_WelcomeState;+ {required bool isLoading,+ required List<Workspace> workspaces,+ required Either<Unit, FlowyError> successOrFailure}) = _$_WelcomeState;@overridebool get isLoading => throw _privateConstructorUsedError;diff --git a/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dart b/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dartindex f902c9607a..43502772af 100644--- a/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dart+++ b/frontend/app_flowy/lib/workspace/infrastructure/deps_resolver.dart@@ -9,7 +9,7 @@ import 'package:app_flowy/workspace/application/view/view_bloc.dart';import 'package:app_flowy/workspace/application/workspace/welcome_bloc.dart';import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart';-import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart';+import 'package:app_flowy/workspace/infrastructure/repos/document_repo.dart';import 'package:app_flowy/workspace/infrastructure/repos/trash_repo.dart';import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart';@@ -80,10 +80,10 @@ class HomeDepsResolver {);// Doc- getIt.registerFactoryParam<DocBloc, View, void>(- (view, _) => DocBloc(+ getIt.registerFactoryParam<DocumentBloc, View, void>(+ (view, _) => DocumentBloc(view: view,- repo: DocRepository(docId: view.id),+ repo: DocumentRepository(docId: view.id),listener: getIt<ViewListener>(param1: view),trashRepo: getIt<TrashRepo>(),),diff --git a/frontend/app_flowy/lib/workspace/infrastructure/repos/doc_repo.dart b/frontend/app_flowy/lib/workspace/infrastructure/repos/document_repo.dartsimilarity index 83%rename from frontend/app_flowy/lib/workspace/infrastructure/repos/doc_repo.dartrename to frontend/app_flowy/lib/workspace/infrastructure/repos/document_repo.dartindex 9ee62fd8d4..1bf613af29 100644--- a/frontend/app_flowy/lib/workspace/infrastructure/repos/doc_repo.dart+++ b/frontend/app_flowy/lib/workspace/infrastructure/repos/document_repo.dart@@ -4,13 +4,13 @@ import 'package:flowy_sdk/protobuf/flowy-collaboration/document_info.pb.dart';import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';-class DocRepository {+class DocumentRepository {final String docId;- DocRepository({+ DocumentRepository({required this.docId,});- Future<Either<DocumentDelta, FlowyError>> readDoc() {+ Future<Either<DocumentDelta, FlowyError>> openDocument() {final request = QueryViewRequest(viewIds: [docId]);return FolderEventOpenDocument(request).send();}@@ -22,7 +22,7 @@ class DocRepository {return FolderEventApplyDocDelta(request).send();}- Future<Either<Unit, FlowyError>> closeDoc() {+ Future<Either<Unit, FlowyError>> closeDocument() {final request = QueryViewRequest(viewIds: [docId]);return FolderEventCloseView(request).send();}diff --git a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dartindex 32ff4e6501..8094a81f73 100644--- a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart+++ b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart@@ -22,7 +22,7 @@ import 'package:clipboard/clipboard.dart';import 'package:app_flowy/generated/locale_keys.g.dart';import 'package:provider/provider.dart';-import 'doc_page.dart';+import 'document_page.dart';class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {View _view;@@ -56,7 +56,7 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {HomeStackType get type => _view.stackType();@override- Widget buildWidget() => DocPage(view: _view, key: ValueKey(_view.id));+ Widget buildWidget() => DocumentPage(view: _view, key: ValueKey(_view.id));@overrideList<NavigationItem> get navigationItems => _makeNavigationItems();diff --git a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_page.dart b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/document_page.dartsimilarity index 77%rename from frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_page.dartrename to frontend/app_flowy/lib/workspace/presentation/stack_page/doc/document_page.dartindex 35f1ff0364..d611da0c9c 100644--- a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_page.dart+++ b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/document_page.dart@@ -14,23 +14,23 @@ import 'styles.dart';import 'widget/banner.dart';import 'widget/toolbar/tool_bar.dart';-class DocPage extends StatefulWidget {+class DocumentPage extends StatefulWidget {final View view;- DocPage({Key? key, required this.view}) : super(key: ValueKey(view.id));+ DocumentPage({Key? key, required this.view}) : super(key: ValueKey(view.id));@override- State<DocPage> createState() => _DocPageState();+ State<DocumentPage> createState() => _DocumentPageState();}-class _DocPageState extends State<DocPage> {- late DocBloc docBloc;+class _DocumentPageState extends State<DocumentPage> {+ late DocumentBloc documentBloc;final scrollController = ScrollController();final FocusNode _focusNode = FocusNode();@overridevoid initState() {- docBloc = getIt<DocBloc>(param1: super.widget.view)..add(const DocEvent.initial());+ documentBloc = getIt<DocumentBloc>(param1: super.widget.view)..add(const DocumentEvent.initial());super.initState();}@@ -38,10 +38,10 @@ class _DocPageState extends State<DocPage> {Widget build(BuildContext context) {return MultiBlocProvider(providers: [- BlocProvider<DocBloc>.value(value: docBloc),+ BlocProvider<DocumentBloc>.value(value: documentBloc),],- child: BlocBuilder<DocBloc, DocState>(builder: (context, state) {- return state.loadState.map(+ child: BlocBuilder<DocumentBloc, DocumentState>(builder: (context, state) {+ return state.loadingState.map(// loading: (_) => const FlowyProgressIndicator(),loading: (_) => SizedBox.expand(child: Container(color: Colors.transparent)),finish: (result) => result.successOrFail.fold(@@ -49,7 +49,7 @@ class _DocPageState extends State<DocPage> {if (state.forceClose) {return _renderAppPage();} else {- return _renderDoc(context, state);+ return _renderDocument(context, state);}},(err) => FlowyErrorPage(err.toString()),@@ -61,13 +61,13 @@ class _DocPageState extends State<DocPage> {@overrideFuture<void> dispose() async {- docBloc.close();+ documentBloc.close();super.dispose();}- Widget _renderDoc(BuildContext context, DocState state) {+ Widget _renderDocument(BuildContext context, DocumentState state) {quill.QuillController controller = quill.QuillController(- document: context.read<DocBloc>().document,+ document: context.read<DocumentBloc>().document,selection: const TextSelection.collapsed(offset: 0),);return Column(@@ -89,9 +89,9 @@ class _DocPageState extends State<DocPage> {}Widget _renderBanner(BuildContext context) {- return DocBanner(- onRestore: () => context.read<DocBloc>().add(const DocEvent.restorePage()),- onDelete: () => context.read<DocBloc>().add(const DocEvent.deletePermanently()),+ return DocumentBanner(+ onRestore: () => context.read<DocumentBloc>().add(const DocumentEvent.restorePage()),+ onDelete: () => context.read<DocumentBloc>().add(const DocumentEvent.deletePermanently()),);}diff --git a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/widget/banner.dart b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/widget/banner.dartindex 89cb0e713a..27e44f85fc 100644--- a/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/widget/banner.dart+++ b/frontend/app_flowy/lib/workspace/presentation/stack_page/doc/widget/banner.dart@@ -8,10 +8,10 @@ import 'package:flutter/material.dart';import 'package:provider/provider.dart';import 'package:app_flowy/generated/locale_keys.g.dart';-class DocBanner extends StatelessWidget {+class DocumentBanner extends StatelessWidget {final void Function() onRestore;final void Function() onDelete;- const DocBanner({required this.onRestore, required this.onDelete, Key? key}) : super(key: key);+ const DocumentBanner({required this.onRestore, required this.onDelete, Key? key}) : super(key: key);@overrideWidget build(BuildContext context) {diff --git a/frontend/app_flowy/packages/flowy_sdk/pubspec.yaml b/frontend/app_flowy/packages/flowy_sdk/pubspec.yamlindex f123a48729..95ca835649 100644--- a/frontend/app_flowy/packages/flowy_sdk/pubspec.yaml+++ b/frontend/app_flowy/packages/flowy_sdk/pubspec.yaml@@ -15,13 +15,14 @@ dependencies:isolates: ^3.0.3+8protobuf: "2.0.0"dartz: "0.10.0-nullsafety.2"- freezed_annotation: ^0.14.1+ freezed_annotation:logger: ^1.0.0dev_dependencies:flutter_test:sdk: flutter- build_runner: "1.12.2"+ build_runner:+ freezed:flutter_lints: ^1.0.0# For information on the generic Dart part of this file, see thediff --git a/frontend/app_flowy/pubspec.lock b/frontend/app_flowy/pubspec.lockindex f8d24d0552..18bc260d4f 100644--- a/frontend/app_flowy/pubspec.lock+++ b/frontend/app_flowy/pubspec.lock@@ -329,7 +329,7 @@ packages:name: easy_localizationurl: "https://pub.dartlang.org"source: hosted- version: "3.0.0"+ version: "3.0.1-dev"easy_logger:dependency: transitivedescription:@@ -645,7 +645,7 @@ packages:name: jsurl: "https://pub.dartlang.org"source: hosted- version: "0.6.3"+ version: "0.6.4"json_annotation:dependency: transitivedescription:@@ -799,7 +799,7 @@ packages:name: pathurl: "https://pub.dartlang.org"source: hosted- version: "1.8.0"+ version: "1.8.1"path_drawing:dependency: transitivedescription:@@ -1133,21 +1133,21 @@ packages:name: testurl: "https://pub.dartlang.org"source: hosted- version: "1.19.5"+ version: "1.20.1"test_api:dependency: transitivedescription:name: test_apiurl: "https://pub.dartlang.org"source: hosted- version: "0.4.8"+ version: "0.4.9"test_core:dependency: transitivedescription:name: test_coreurl: "https://pub.dartlang.org"source: hosted- version: "0.4.9"+ version: "0.4.11"textstyle_extensions:dependency: transitivedescription:@@ -1354,5 +1354,5 @@ packages:source: hostedversion: "8.0.0"sdks:- dart: ">=2.15.0-116.0.dev <3.0.0"+ dart: ">=2.16.0-100.0.dev <3.0.0"flutter: ">=2.5.0"diff --git a/frontend/app_flowy/pubspec.yaml b/frontend/app_flowy/pubspec.yamlindex 31721eb5d1..7f642f51b3 100644--- a/frontend/app_flowy/pubspec.yaml+++ b/frontend/app_flowy/pubspec.yaml@@ -79,7 +79,7 @@ dev_dependencies:flutter_test:sdk: flutterbuild_runner:- freezed: "^0.14.2"+ freezed:bloc_test: ^9.0.2# The "flutter_lints" package below contains a set of recommended lints to