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
[code gen]: return unit if there is no ouput
appflowy1f42fa557b99
diff --git a/app_flowy/lib/user/domain/interface.dart b/app_flowy/lib/user/domain/interface.dartindex c5d82a3e2b..26849ee528 100644--- a/app_flowy/lib/user/domain/interface.dart+++ b/app_flowy/lib/user/domain/interface.dart@@ -6,4 +6,6 @@ abstract class IAuth {Future<Either<UserDetail, UserError>> signIn(String? email, String? password);Future<Either<UserDetail, UserError>> signUp(String? name, String? password, String? email);++ Future<Either<Unit, UserError>> signOut();}diff --git a/app_flowy/lib/user/infrastructure/auth_repo.dart b/app_flowy/lib/user/infrastructure/auth_repo.dartindex b468c945d6..0108f5bccc 100644--- a/app_flowy/lib/user/infrastructure/auth_repo.dart+++ b/app_flowy/lib/user/infrastructure/auth_repo.dart@@ -27,4 +27,8 @@ class AuthRepository {return UserEventSignUp(request).send();}++ Future<Either<Unit, UserError>> signOut() {+ return UserEventSignOut().send();+ }}diff --git a/app_flowy/lib/user/infrastructure/interface_impl.dart b/app_flowy/lib/user/infrastructure/interface_impl.dartindex bfe7b1cb63..ca224f42cf 100644--- a/app_flowy/lib/user/infrastructure/interface_impl.dart+++ b/app_flowy/lib/user/infrastructure/interface_impl.dart@@ -36,4 +36,9 @@ class AuthImpl extends IAuth {String? name, String? password, String? email) {return repo.signUp(name: name, password: password, email: email);}++ @override+ Future<Either<Unit, UserError>> signOut() {+ return repo.signOut();+ }}diff --git a/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart b/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dartindex 570ef07eb2..799493ba24 100644--- a/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart+++ b/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart@@ -53,12 +53,12 @@ class UserEventSignUp {class UserEventSignOut {UserEventSignOut();- Future<Either<Uint8List, UserError>> send() {+ Future<Either<Unit, UserError>> send() {final request = FFIRequest.create()..event = UserEvent.SignOut.toString();return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(bytes),+ (bytes) => left(unit),(errBytes) => right(UserError.fromBuffer(errBytes)),));}diff --git a/scripts/flowy-tool/src/dart_event/event_template.rs b/scripts/flowy-tool/src/dart_event/event_template.rsindex fd111ddf4d..3ba4baefe3 100644--- a/scripts/flowy-tool/src/dart_event/event_template.rs+++ b/scripts/flowy-tool/src/dart_event/event_template.rs@@ -40,14 +40,14 @@ impl EventTemplate {self.tera_context.insert("has_input", &ctx.input_deserializer.is_some());match ctx.input_deserializer {- None => self.tera_context.insert("input_deserializer", "Uint8List"),+ None => self.tera_context.insert("input_deserializer", "Unit"),Some(ref input) => self.tera_context.insert("input_deserializer", input),}self.tera_context.insert("has_output", &ctx.output_deserializer.is_some());match ctx.output_deserializer {- None => self.tera_context.insert("output_deserializer", "Uint8List"),+ None => self.tera_context.insert("output_deserializer", "Unit"),Some(ref output) => self.tera_context.insert("output_deserializer", output),}diff --git a/scripts/flowy-tool/src/dart_event/event_template.tera b/scripts/flowy-tool/src/dart_event/event_template.teraindex acdfa8efbc..9f155c8790 100644--- a/scripts/flowy-tool/src/dart_event/event_template.tera+++ b/scripts/flowy-tool/src/dart_event/event_template.tera@@ -34,7 +34,7 @@ class {{ event_class }} {{%- if has_output %}(okBytes) => left({{ output_deserializer }}.fromBuffer(okBytes)),{%- else %}- (bytes) => left(bytes),+ (bytes) => left(unit),{%- endif %}(errBytes) => right({{ error_deserializer }}.fromBuffer(errBytes)),));