[flutter]: build with offline mode

This commit is contained in:
appflowy 2021-11-06 22:35:45 +08:00
parent e588f15277
commit dd357c18cf
11 changed files with 235 additions and 94 deletions

View File

@ -11,6 +11,8 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
CARGO_MAKE_CRATE_NAME = "dart-ffi"
VERSION = "0.0.1"
FEATURES = "flutter,http_server"
PRODUCT_NAME = "AppFlowy"
#CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html
[env.development-mac]
@ -22,7 +24,9 @@ CRATE_TYPE = "cdylib"
BUILD_FLAG = "debug"
FLUTTER_PLATFORM = "macos"
FLUTTER_OUTPUT_DIR = "Debug"
PRODUCT_NAME = "app_flowy.app"
FEATURES = "flutter"
PRODUCT_EXT = "app"
[env.production-mac]
DEV = false
@ -33,7 +37,8 @@ CRATE_TYPE = "cdylib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "macos"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_NAME = "app_flowy.app"
FEATURES = "flutter"
PRODUCT_EXT = "app"
[env.production-ios]
DEV = false
@ -43,7 +48,7 @@ CRATE_TYPE = "staticlib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "ios"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_NAME = "app_flowy.ipa"
PRODUCT_EXT = "ipa"
[env.production-android]
DEV = false
@ -53,7 +58,7 @@ CRATE_TYPE = "cdylib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "apk"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_NAME = "app_flowy.apk"
PRODUCT_EXT = "apk"
[env.production-win]
DEV = false
@ -63,7 +68,7 @@ CRATE_TYPE = "cdylib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "apk"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_NAME = "app_flowy.exe"
PRODUCT_EXT = "exe"
[tasks.setup-crate-type]
private = true

View File

@ -13,6 +13,7 @@ class SignInRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignInRequest', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..hasRequiredFields = false
;
@ -20,6 +21,7 @@ class SignInRequest extends $pb.GeneratedMessage {
factory SignInRequest({
$core.String? email,
$core.String? password,
$core.String? name,
}) {
final _result = create();
if (email != null) {
@ -28,6 +30,9 @@ class SignInRequest extends $pb.GeneratedMessage {
if (password != null) {
_result.password = password;
}
if (name != null) {
_result.name = name;
}
return _result;
}
factory SignInRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
@ -68,12 +73,22 @@ class SignInRequest extends $pb.GeneratedMessage {
$core.bool hasPassword() => $_has(1);
@$pb.TagNumber(2)
void clearPassword() => clearField(2);
@$pb.TagNumber(3)
$core.String get name => $_getSZ(2);
@$pb.TagNumber(3)
set name($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasName() => $_has(2);
@$pb.TagNumber(3)
void clearName() => clearField(3);
}
class SignInParams extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignInParams', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..hasRequiredFields = false
;
@ -81,6 +96,7 @@ class SignInParams extends $pb.GeneratedMessage {
factory SignInParams({
$core.String? email,
$core.String? password,
$core.String? name,
}) {
final _result = create();
if (email != null) {
@ -89,6 +105,9 @@ class SignInParams extends $pb.GeneratedMessage {
if (password != null) {
_result.password = password;
}
if (name != null) {
_result.name = name;
}
return _result;
}
factory SignInParams.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
@ -129,6 +148,15 @@ class SignInParams extends $pb.GeneratedMessage {
$core.bool hasPassword() => $_has(1);
@$pb.TagNumber(2)
void clearPassword() => clearField(2);
@$pb.TagNumber(3)
$core.String get name => $_getSZ(2);
@$pb.TagNumber(3)
set name($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasName() => $_has(2);
@$pb.TagNumber(3)
void clearName() => clearField(3);
}
class SignInResponse extends $pb.GeneratedMessage {

View File

@ -14,22 +14,24 @@ const SignInRequest$json = const {
'2': const [
const {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'},
const {'1': 'password', '3': 2, '4': 1, '5': 9, '10': 'password'},
const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'},
],
};
/// Descriptor for `SignInRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List signInRequestDescriptor = $convert.base64Decode('Cg1TaWduSW5SZXF1ZXN0EhQKBWVtYWlsGAEgASgJUgVlbWFpbBIaCghwYXNzd29yZBgCIAEoCVIIcGFzc3dvcmQ=');
final $typed_data.Uint8List signInRequestDescriptor = $convert.base64Decode('Cg1TaWduSW5SZXF1ZXN0EhQKBWVtYWlsGAEgASgJUgVlbWFpbBIaCghwYXNzd29yZBgCIAEoCVIIcGFzc3dvcmQSEgoEbmFtZRgDIAEoCVIEbmFtZQ==');
@$core.Deprecated('Use signInParamsDescriptor instead')
const SignInParams$json = const {
'1': 'SignInParams',
'2': const [
const {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'},
const {'1': 'password', '3': 2, '4': 1, '5': 9, '10': 'password'},
const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'},
],
};
/// Descriptor for `SignInParams`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List signInParamsDescriptor = $convert.base64Decode('CgxTaWduSW5QYXJhbXMSFAoFZW1haWwYASABKAlSBWVtYWlsEhoKCHBhc3N3b3JkGAIgASgJUghwYXNzd29yZA==');
final $typed_data.Uint8List signInParamsDescriptor = $convert.base64Decode('CgxTaWduSW5QYXJhbXMSFAoFZW1haWwYASABKAlSBWVtYWlsEhoKCHBhc3N3b3JkGAIgASgJUghwYXNzd29yZBISCgRuYW1lGAMgASgJUgRuYW1l');
@$core.Deprecated('Use signInResponseDescriptor instead')
const SignInResponse$json = const {
'1': 'SignInResponse',

View File

@ -71,9 +71,12 @@ struct WsSenderImpl {
impl DocumentWebSocket for WsSenderImpl {
fn send(&self, data: WsDocumentData) -> Result<(), DocError> {
let msg: WsMessage = data.into();
let sender = self.user.ws_controller.sender().map_err(internal_error)?;
sender.send_msg(msg).map_err(internal_error)?;
if cfg!(feature = "http_server") {
let msg: WsMessage = data.into();
let sender = self.user.ws_controller.sender().map_err(internal_error)?;
sender.send_msg(msg).map_err(internal_error)?;
}
Ok(())
}

View File

@ -9,6 +9,9 @@ pub struct SignInRequest {
#[pb(index = 2)]
pub password: String,
#[pb(index = 3)]
pub name: String,
}
#[derive(Default, ProtoBuf, Debug)]
@ -18,6 +21,9 @@ pub struct SignInParams {
#[pb(index = 2)]
pub password: String,
#[pb(index = 3)]
pub name: String,
}
#[derive(Debug, Default, ProtoBuf)]
@ -45,6 +51,7 @@ impl TryInto<SignInParams> for SignInRequest {
Ok(SignInParams {
email: email.0,
password: password.0,
name: self.name,
})
}
}

View File

@ -28,6 +28,7 @@ pub struct SignInRequest {
// message fields
pub email: ::std::string::String,
pub password: ::std::string::String,
pub name: ::std::string::String,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -95,6 +96,32 @@ impl SignInRequest {
pub fn take_password(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.password, ::std::string::String::new())
}
// string name = 3;
pub fn get_name(&self) -> &str {
&self.name
}
pub fn clear_name(&mut self) {
self.name.clear();
}
// Param is passed by value, moved
pub fn set_name(&mut self, v: ::std::string::String) {
self.name = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_name(&mut self) -> &mut ::std::string::String {
&mut self.name
}
// Take field
pub fn take_name(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.name, ::std::string::String::new())
}
}
impl ::protobuf::Message for SignInRequest {
@ -112,6 +139,9 @@ impl ::protobuf::Message for SignInRequest {
2 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
},
3 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
@ -130,6 +160,9 @@ impl ::protobuf::Message for SignInRequest {
if !self.password.is_empty() {
my_size += ::protobuf::rt::string_size(2, &self.password);
}
if !self.name.is_empty() {
my_size += ::protobuf::rt::string_size(3, &self.name);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
@ -142,6 +175,9 @@ impl ::protobuf::Message for SignInRequest {
if !self.password.is_empty() {
os.write_string(2, &self.password)?;
}
if !self.name.is_empty() {
os.write_string(3, &self.name)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
@ -190,6 +226,11 @@ impl ::protobuf::Message for SignInRequest {
|m: &SignInRequest| { &m.password },
|m: &mut SignInRequest| { &mut m.password },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"name",
|m: &SignInRequest| { &m.name },
|m: &mut SignInRequest| { &mut m.name },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<SignInRequest>(
"SignInRequest",
fields,
@ -208,6 +249,7 @@ impl ::protobuf::Clear for SignInRequest {
fn clear(&mut self) {
self.email.clear();
self.password.clear();
self.name.clear();
self.unknown_fields.clear();
}
}
@ -229,6 +271,7 @@ pub struct SignInParams {
// message fields
pub email: ::std::string::String,
pub password: ::std::string::String,
pub name: ::std::string::String,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -296,6 +339,32 @@ impl SignInParams {
pub fn take_password(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.password, ::std::string::String::new())
}
// string name = 3;
pub fn get_name(&self) -> &str {
&self.name
}
pub fn clear_name(&mut self) {
self.name.clear();
}
// Param is passed by value, moved
pub fn set_name(&mut self, v: ::std::string::String) {
self.name = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_name(&mut self) -> &mut ::std::string::String {
&mut self.name
}
// Take field
pub fn take_name(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.name, ::std::string::String::new())
}
}
impl ::protobuf::Message for SignInParams {
@ -313,6 +382,9 @@ impl ::protobuf::Message for SignInParams {
2 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
},
3 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
@ -331,6 +403,9 @@ impl ::protobuf::Message for SignInParams {
if !self.password.is_empty() {
my_size += ::protobuf::rt::string_size(2, &self.password);
}
if !self.name.is_empty() {
my_size += ::protobuf::rt::string_size(3, &self.name);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
@ -343,6 +418,9 @@ impl ::protobuf::Message for SignInParams {
if !self.password.is_empty() {
os.write_string(2, &self.password)?;
}
if !self.name.is_empty() {
os.write_string(3, &self.name)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
@ -391,6 +469,11 @@ impl ::protobuf::Message for SignInParams {
|m: &SignInParams| { &m.password },
|m: &mut SignInParams| { &mut m.password },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"name",
|m: &SignInParams| { &m.name },
|m: &mut SignInParams| { &mut m.name },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<SignInParams>(
"SignInParams",
fields,
@ -409,6 +492,7 @@ impl ::protobuf::Clear for SignInParams {
fn clear(&mut self) {
self.email.clear();
self.password.clear();
self.name.clear();
self.unknown_fields.clear();
}
}
@ -1482,79 +1566,86 @@ impl ::protobuf::reflect::ProtobufValue for SignUpResponse {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\nauth.proto\"A\n\rSignInRequest\x12\x14\n\x05email\x18\x01\x20\x01(\t\
R\x05email\x12\x1a\n\x08password\x18\x02\x20\x01(\tR\x08password\"@\n\
\x0cSignInParams\x12\x14\n\x05email\x18\x01\x20\x01(\tR\x05email\x12\x1a\
\n\x08password\x18\x02\x20\x01(\tR\x08password\"i\n\x0eSignInResponse\
\x12\x17\n\x07user_id\x18\x01\x20\x01(\tR\x06userId\x12\x12\n\x04name\
\x18\x02\x20\x01(\tR\x04name\x12\x14\n\x05email\x18\x03\x20\x01(\tR\x05e\
mail\x12\x14\n\x05token\x18\x04\x20\x01(\tR\x05token\"U\n\rSignUpRequest\
\x12\x14\n\x05email\x18\x01\x20\x01(\tR\x05email\x12\x12\n\x04name\x18\
\x02\x20\x01(\tR\x04name\x12\x1a\n\x08password\x18\x03\x20\x01(\tR\x08pa\
ssword\"T\n\x0cSignUpParams\x12\x14\n\x05email\x18\x01\x20\x01(\tR\x05em\
ail\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x1a\n\x08password\
\x18\x03\x20\x01(\tR\x08password\"i\n\x0eSignUpResponse\x12\x17\n\x07use\
r_id\x18\x01\x20\x01(\tR\x06userId\x12\x12\n\x04name\x18\x02\x20\x01(\tR\
\x04name\x12\x14\n\x05email\x18\x03\x20\x01(\tR\x05email\x12\x14\n\x05to\
ken\x18\x04\x20\x01(\tR\x05tokenJ\x80\t\n\x06\x12\x04\0\0\x1f\x01\n\x08\
\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\
\x03\x04\0\x01\x12\x03\x02\x08\x15\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\
\x04\x15\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\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\
\x13\x14\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x18\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\x13\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x16\x17\n\n\n\x02\x04\
\x01\x12\x04\x06\0\t\x01\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x14\n\x0b\
\n\x04\x04\x01\x02\0\x12\x03\x07\x04\x15\n\x0c\n\x05\x04\x01\x02\0\x05\
\x12\x03\x07\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x07\x0b\x10\n\
\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x07\x13\x14\n\x0b\n\x04\x04\x01\x02\
\x01\x12\x03\x08\x04\x18\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x08\x04\
\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x08\x0b\x13\n\x0c\n\x05\x04\
\x01\x02\x01\x03\x12\x03\x08\x16\x17\n\n\n\x02\x04\x02\x12\x04\n\0\x0f\
\x01\n\n\n\x03\x04\x02\x01\x12\x03\n\x08\x16\n\x0b\n\x04\x04\x02\x02\0\
\x12\x03\x0b\x04\x17\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x0b\x04\n\n\
\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x0b\x0b\x12\n\x0c\n\x05\x04\x02\x02\
\0\x03\x12\x03\x0b\x15\x16\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x0c\x04\
\x14\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x0c\x04\n\n\x0c\n\x05\x04\
\x02\x02\x01\x01\x12\x03\x0c\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\
\x03\x0c\x12\x13\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\r\x04\x15\n\x0c\n\
\x05\x04\x02\x02\x02\x05\x12\x03\r\x04\n\n\x0c\n\x05\x04\x02\x02\x02\x01\
\x12\x03\r\x0b\x10\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\r\x13\x14\n\
\x0b\n\x04\x04\x02\x02\x03\x12\x03\x0e\x04\x15\n\x0c\n\x05\x04\x02\x02\
\x03\x05\x12\x03\x0e\x04\n\n\x0c\n\x05\x04\x02\x02\x03\x01\x12\x03\x0e\
\x0b\x10\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\x03\x0e\x13\x14\n\n\n\x02\
\x04\x03\x12\x04\x10\0\x14\x01\n\n\n\x03\x04\x03\x01\x12\x03\x10\x08\x15\
\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x11\x04\x15\n\x0c\n\x05\x04\x03\x02\0\
\x05\x12\x03\x11\x04\n\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x11\x0b\x10\
\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x11\x13\x14\n\x0b\n\x04\x04\x03\
\x02\x01\x12\x03\x12\x04\x14\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x12\
\x04\n\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x12\x0b\x0f\n\x0c\n\x05\
\x04\x03\x02\x01\x03\x12\x03\x12\x12\x13\n\x0b\n\x04\x04\x03\x02\x02\x12\
\x03\x13\x04\x18\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\x03\x13\x04\n\n\x0c\
\n\x05\x04\x03\x02\x02\x01\x12\x03\x13\x0b\x13\n\x0c\n\x05\x04\x03\x02\
\x02\x03\x12\x03\x13\x16\x17\n\n\n\x02\x04\x04\x12\x04\x15\0\x19\x01\n\n\
\n\x03\x04\x04\x01\x12\x03\x15\x08\x14\n\x0b\n\x04\x04\x04\x02\0\x12\x03\
\x16\x04\x15\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03\x16\x04\n\n\x0c\n\x05\
\x04\x04\x02\0\x01\x12\x03\x16\x0b\x10\n\x0c\n\x05\x04\x04\x02\0\x03\x12\
\x03\x16\x13\x14\n\x0b\n\x04\x04\x04\x02\x01\x12\x03\x17\x04\x14\n\x0c\n\
\x05\x04\x04\x02\x01\x05\x12\x03\x17\x04\n\n\x0c\n\x05\x04\x04\x02\x01\
\x01\x12\x03\x17\x0b\x0f\n\x0c\n\x05\x04\x04\x02\x01\x03\x12\x03\x17\x12\
\x13\n\x0b\n\x04\x04\x04\x02\x02\x12\x03\x18\x04\x18\n\x0c\n\x05\x04\x04\
\x02\x02\x05\x12\x03\x18\x04\n\n\x0c\n\x05\x04\x04\x02\x02\x01\x12\x03\
\x18\x0b\x13\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x03\x18\x16\x17\n\n\n\
\x02\x04\x05\x12\x04\x1a\0\x1f\x01\n\n\n\x03\x04\x05\x01\x12\x03\x1a\x08\
\x16\n\x0b\n\x04\x04\x05\x02\0\x12\x03\x1b\x04\x17\n\x0c\n\x05\x04\x05\
\x02\0\x05\x12\x03\x1b\x04\n\n\x0c\n\x05\x04\x05\x02\0\x01\x12\x03\x1b\
\x0b\x12\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03\x1b\x15\x16\n\x0b\n\x04\
\x04\x05\x02\x01\x12\x03\x1c\x04\x14\n\x0c\n\x05\x04\x05\x02\x01\x05\x12\
\x03\x1c\x04\n\n\x0c\n\x05\x04\x05\x02\x01\x01\x12\x03\x1c\x0b\x0f\n\x0c\
\n\x05\x04\x05\x02\x01\x03\x12\x03\x1c\x12\x13\n\x0b\n\x04\x04\x05\x02\
\x02\x12\x03\x1d\x04\x15\n\x0c\n\x05\x04\x05\x02\x02\x05\x12\x03\x1d\x04\
\n\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03\x1d\x0b\x10\n\x0c\n\x05\x04\
\x05\x02\x02\x03\x12\x03\x1d\x13\x14\n\x0b\n\x04\x04\x05\x02\x03\x12\x03\
\x1e\x04\x15\n\x0c\n\x05\x04\x05\x02\x03\x05\x12\x03\x1e\x04\n\n\x0c\n\
\x05\x04\x05\x02\x03\x01\x12\x03\x1e\x0b\x10\n\x0c\n\x05\x04\x05\x02\x03\
\x03\x12\x03\x1e\x13\x14b\x06proto3\
\n\nauth.proto\"U\n\rSignInRequest\x12\x14\n\x05email\x18\x01\x20\x01(\t\
R\x05email\x12\x1a\n\x08password\x18\x02\x20\x01(\tR\x08password\x12\x12\
\n\x04name\x18\x03\x20\x01(\tR\x04name\"T\n\x0cSignInParams\x12\x14\n\
\x05email\x18\x01\x20\x01(\tR\x05email\x12\x1a\n\x08password\x18\x02\x20\
\x01(\tR\x08password\x12\x12\n\x04name\x18\x03\x20\x01(\tR\x04name\"i\n\
\x0eSignInResponse\x12\x17\n\x07user_id\x18\x01\x20\x01(\tR\x06userId\
\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x14\n\x05email\x18\
\x03\x20\x01(\tR\x05email\x12\x14\n\x05token\x18\x04\x20\x01(\tR\x05toke\
n\"U\n\rSignUpRequest\x12\x14\n\x05email\x18\x01\x20\x01(\tR\x05email\
\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x1a\n\x08password\x18\
\x03\x20\x01(\tR\x08password\"T\n\x0cSignUpParams\x12\x14\n\x05email\x18\
\x01\x20\x01(\tR\x05email\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\
\x12\x1a\n\x08password\x18\x03\x20\x01(\tR\x08password\"i\n\x0eSignUpRes\
ponse\x12\x17\n\x07user_id\x18\x01\x20\x01(\tR\x06userId\x12\x12\n\x04na\
me\x18\x02\x20\x01(\tR\x04name\x12\x14\n\x05email\x18\x03\x20\x01(\tR\
\x05email\x12\x14\n\x05token\x18\x04\x20\x01(\tR\x05tokenJ\xee\t\n\x06\
\x12\x04\0\0!\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\
\x04\x02\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x15\n\x0b\n\x04\
\x04\0\x02\0\x12\x03\x03\x04\x15\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\x10\n\x0c\n\x05\x04\0\
\x02\0\x03\x12\x03\x03\x13\x14\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\
\x18\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\x13\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\
\x04\x16\x17\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\n\n\
\x02\x04\x01\x12\x04\x07\0\x0b\x01\n\n\n\x03\x04\x01\x01\x12\x03\x07\x08\
\x14\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x08\x04\x15\n\x0c\n\x05\x04\x01\
\x02\0\x05\x12\x03\x08\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x08\
\x0b\x10\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x08\x13\x14\n\x0b\n\x04\
\x04\x01\x02\x01\x12\x03\t\x04\x18\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\
\x03\t\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\t\x0b\x13\n\x0c\n\
\x05\x04\x01\x02\x01\x03\x12\x03\t\x16\x17\n\x0b\n\x04\x04\x01\x02\x02\
\x12\x03\n\x04\x14\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\n\x04\n\n\x0c\
\n\x05\x04\x01\x02\x02\x01\x12\x03\n\x0b\x0f\n\x0c\n\x05\x04\x01\x02\x02\
\x03\x12\x03\n\x12\x13\n\n\n\x02\x04\x02\x12\x04\x0c\0\x11\x01\n\n\n\x03\
\x04\x02\x01\x12\x03\x0c\x08\x16\n\x0b\n\x04\x04\x02\x02\0\x12\x03\r\x04\
\x17\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\r\x04\n\n\x0c\n\x05\x04\x02\
\x02\0\x01\x12\x03\r\x0b\x12\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\r\x15\
\x16\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x0e\x04\x14\n\x0c\n\x05\x04\x02\
\x02\x01\x05\x12\x03\x0e\x04\n\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\
\x0e\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x0e\x12\x13\n\x0b\n\
\x04\x04\x02\x02\x02\x12\x03\x0f\x04\x15\n\x0c\n\x05\x04\x02\x02\x02\x05\
\x12\x03\x0f\x04\n\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x0f\x0b\x10\n\
\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\x0f\x13\x14\n\x0b\n\x04\x04\x02\
\x02\x03\x12\x03\x10\x04\x15\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03\x10\
\x04\n\n\x0c\n\x05\x04\x02\x02\x03\x01\x12\x03\x10\x0b\x10\n\x0c\n\x05\
\x04\x02\x02\x03\x03\x12\x03\x10\x13\x14\n\n\n\x02\x04\x03\x12\x04\x12\0\
\x16\x01\n\n\n\x03\x04\x03\x01\x12\x03\x12\x08\x15\n\x0b\n\x04\x04\x03\
\x02\0\x12\x03\x13\x04\x15\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03\x13\x04\
\n\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x13\x0b\x10\n\x0c\n\x05\x04\x03\
\x02\0\x03\x12\x03\x13\x13\x14\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x14\
\x04\x14\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x14\x04\n\n\x0c\n\x05\
\x04\x03\x02\x01\x01\x12\x03\x14\x0b\x0f\n\x0c\n\x05\x04\x03\x02\x01\x03\
\x12\x03\x14\x12\x13\n\x0b\n\x04\x04\x03\x02\x02\x12\x03\x15\x04\x18\n\
\x0c\n\x05\x04\x03\x02\x02\x05\x12\x03\x15\x04\n\n\x0c\n\x05\x04\x03\x02\
\x02\x01\x12\x03\x15\x0b\x13\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x03\x15\
\x16\x17\n\n\n\x02\x04\x04\x12\x04\x17\0\x1b\x01\n\n\n\x03\x04\x04\x01\
\x12\x03\x17\x08\x14\n\x0b\n\x04\x04\x04\x02\0\x12\x03\x18\x04\x15\n\x0c\
\n\x05\x04\x04\x02\0\x05\x12\x03\x18\x04\n\n\x0c\n\x05\x04\x04\x02\0\x01\
\x12\x03\x18\x0b\x10\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03\x18\x13\x14\n\
\x0b\n\x04\x04\x04\x02\x01\x12\x03\x19\x04\x14\n\x0c\n\x05\x04\x04\x02\
\x01\x05\x12\x03\x19\x04\n\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03\x19\
\x0b\x0f\n\x0c\n\x05\x04\x04\x02\x01\x03\x12\x03\x19\x12\x13\n\x0b\n\x04\
\x04\x04\x02\x02\x12\x03\x1a\x04\x18\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\
\x03\x1a\x04\n\n\x0c\n\x05\x04\x04\x02\x02\x01\x12\x03\x1a\x0b\x13\n\x0c\
\n\x05\x04\x04\x02\x02\x03\x12\x03\x1a\x16\x17\n\n\n\x02\x04\x05\x12\x04\
\x1c\0!\x01\n\n\n\x03\x04\x05\x01\x12\x03\x1c\x08\x16\n\x0b\n\x04\x04\
\x05\x02\0\x12\x03\x1d\x04\x17\n\x0c\n\x05\x04\x05\x02\0\x05\x12\x03\x1d\
\x04\n\n\x0c\n\x05\x04\x05\x02\0\x01\x12\x03\x1d\x0b\x12\n\x0c\n\x05\x04\
\x05\x02\0\x03\x12\x03\x1d\x15\x16\n\x0b\n\x04\x04\x05\x02\x01\x12\x03\
\x1e\x04\x14\n\x0c\n\x05\x04\x05\x02\x01\x05\x12\x03\x1e\x04\n\n\x0c\n\
\x05\x04\x05\x02\x01\x01\x12\x03\x1e\x0b\x0f\n\x0c\n\x05\x04\x05\x02\x01\
\x03\x12\x03\x1e\x12\x13\n\x0b\n\x04\x04\x05\x02\x02\x12\x03\x1f\x04\x15\
\n\x0c\n\x05\x04\x05\x02\x02\x05\x12\x03\x1f\x04\n\n\x0c\n\x05\x04\x05\
\x02\x02\x01\x12\x03\x1f\x0b\x10\n\x0c\n\x05\x04\x05\x02\x02\x03\x12\x03\
\x1f\x13\x14\n\x0b\n\x04\x04\x05\x02\x03\x12\x03\x20\x04\x15\n\x0c\n\x05\
\x04\x05\x02\x03\x05\x12\x03\x20\x04\n\n\x0c\n\x05\x04\x05\x02\x03\x01\
\x12\x03\x20\x0b\x10\n\x0c\n\x05\x04\x05\x02\x03\x03\x12\x03\x20\x13\x14\
b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -3,10 +3,12 @@ syntax = "proto3";
message SignInRequest {
string email = 1;
string password = 2;
string name = 3;
}
message SignInParams {
string email = 1;
string password = 2;
string name = 3;
}
message SignInResponse {
string user_id = 1;

View File

@ -28,7 +28,7 @@ impl UserServerAPI for UserServerMock {
ResultFuture::new(async {
Ok(SignInResponse {
user_id: user_id.clone(),
name: "fake name".to_owned(),
name: params.name,
email: params.email,
token: user_id,
})
@ -42,7 +42,7 @@ impl UserServerAPI for UserServerMock {
}
fn get_user(&self, _token: &str) -> ResultFuture<UserProfile, UserError> {
ResultFuture::new(async { Err(UserError::internal().context("mock data, ignore this error")) })
ResultFuture::new(async { Ok(UserProfile::default()) })
}
fn ws_addr(&self) -> String { "ws://localhost:8000/ws/".to_owned() }

View File

@ -147,8 +147,8 @@ impl UserSession {
pub async fn init_user(&self) -> Result<(), UserError> {
let (_, token) = self.get_session()?.into_part();
let _ = self.start_ws_connection(&token).await?;
Ok(())
}
@ -282,10 +282,11 @@ impl UserSession {
#[tracing::instrument(level = "debug", skip(self, token))]
pub async fn start_ws_connection(&self, token: &str) -> Result<(), UserError> {
let addr = format!("{}/{}", self.server.ws_addr(), token);
self.listen_on_websocket();
let _ = self.ws_controller.start_connect(addr).await?;
if cfg!(feature = "http_server") {
let addr = format!("{}/{}", self.server.ws_addr(), token);
self.listen_on_websocket();
let _ = self.ws_controller.start_connect(addr).await?;
}
Ok(())
}

View File

@ -18,9 +18,9 @@ script = [
cd rust-lib/
if [ ${PROD} == true ]
then
cargo build --${BUILD_FLAG} --package=dart-ffi --target ${DESKTOP_TARGET} --features="flutter","http_server"
cargo build --${BUILD_FLAG} --package=dart-ffi --target ${DESKTOP_TARGET} --features=${FEATURES}
else
cargo build --package=dart-ffi --target ${DESKTOP_TARGET} --features="flutter","http_server"
cargo build --package=dart-ffi --target ${DESKTOP_TARGET} --features=${FEATURES}
fi
cd ../
""",

View File

@ -26,8 +26,10 @@ script = [
fi
mkdir -p ${output_path}
cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/build/${FLUTTER_PLATFORM}/Build/Products/${FLUTTER_OUTPUT_DIR}/${PRODUCT_NAME} \
${output_path}/${PRODUCT_NAME}
product=${PRODUCT_NAME}.${PRODUCT_EXT}
cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/build/${FLUTTER_PLATFORM}/Build/Products/${FLUTTER_OUTPUT_DIR}/${product} \
${output_path}/${product}
""",
]
script_runner = "@shell"