move network state to lib-infra

This commit is contained in:
appflowy 2021-12-05 09:29:42 +08:00
parent b701abed12
commit bb07eeb2e2
46 changed files with 476 additions and 5033 deletions

View File

@ -3,7 +3,7 @@ import 'dart:async';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flowy_log/flowy_log.dart';
import 'package:flowy_sdk/dispatch/dispatch.dart';
import 'package:flowy_sdk/protobuf/flowy-user/observable.pb.dart';
import 'package:flowy_sdk/protobuf/lib-infra/protobuf.dart';
import 'package:flutter/services.dart';
class NetworkMonitor {

View File

@ -4,6 +4,7 @@ import 'package:flowy_log/flowy_log.dart';
import 'package:flowy_sdk/protobuf/dart-ffi/ffi_response.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/event.pb.dart';
import 'package:flowy_sdk/protobuf/lib-infra/network_state.pb.dart';
import 'package:isolates/isolates.dart';
import 'package:isolates/ports.dart';
import 'package:ffi/ffi.dart';

View File

@ -1,489 +0,0 @@
///
// Generated code. Do not modify.
// source: auth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
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
;
SignInRequest._() : super();
factory SignInRequest({
$core.String? email,
$core.String? password,
$core.String? name,
}) {
final _result = create();
if (email != null) {
_result.email = email;
}
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);
factory SignInRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SignInRequest clone() => SignInRequest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SignInRequest copyWith(void Function(SignInRequest) updates) => super.copyWith((message) => updates(message as SignInRequest)) as SignInRequest; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SignInRequest create() => SignInRequest._();
SignInRequest createEmptyInstance() => create();
static $pb.PbList<SignInRequest> createRepeated() => $pb.PbList<SignInRequest>();
@$core.pragma('dart2js:noInline')
static SignInRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignInRequest>(create);
static SignInRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get email => $_getSZ(0);
@$pb.TagNumber(1)
set email($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasEmail() => $_has(0);
@$pb.TagNumber(1)
void clearEmail() => clearField(1);
@$pb.TagNumber(2)
$core.String get password => $_getSZ(1);
@$pb.TagNumber(2)
set password($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$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
;
SignInParams._() : super();
factory SignInParams({
$core.String? email,
$core.String? password,
$core.String? name,
}) {
final _result = create();
if (email != null) {
_result.email = email;
}
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);
factory SignInParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SignInParams clone() => SignInParams()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SignInParams copyWith(void Function(SignInParams) updates) => super.copyWith((message) => updates(message as SignInParams)) as SignInParams; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SignInParams create() => SignInParams._();
SignInParams createEmptyInstance() => create();
static $pb.PbList<SignInParams> createRepeated() => $pb.PbList<SignInParams>();
@$core.pragma('dart2js:noInline')
static SignInParams getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignInParams>(create);
static SignInParams? _defaultInstance;
@$pb.TagNumber(1)
$core.String get email => $_getSZ(0);
@$pb.TagNumber(1)
set email($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasEmail() => $_has(0);
@$pb.TagNumber(1)
void clearEmail() => clearField(1);
@$pb.TagNumber(2)
$core.String get password => $_getSZ(1);
@$pb.TagNumber(2)
set password($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$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 {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignInResponse', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'userId')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'token')
..hasRequiredFields = false
;
SignInResponse._() : super();
factory SignInResponse({
$core.String? userId,
$core.String? name,
$core.String? email,
$core.String? token,
}) {
final _result = create();
if (userId != null) {
_result.userId = userId;
}
if (name != null) {
_result.name = name;
}
if (email != null) {
_result.email = email;
}
if (token != null) {
_result.token = token;
}
return _result;
}
factory SignInResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SignInResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SignInResponse clone() => SignInResponse()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SignInResponse copyWith(void Function(SignInResponse) updates) => super.copyWith((message) => updates(message as SignInResponse)) as SignInResponse; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SignInResponse create() => SignInResponse._();
SignInResponse createEmptyInstance() => create();
static $pb.PbList<SignInResponse> createRepeated() => $pb.PbList<SignInResponse>();
@$core.pragma('dart2js:noInline')
static SignInResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignInResponse>(create);
static SignInResponse? _defaultInstance;
@$pb.TagNumber(1)
$core.String get userId => $_getSZ(0);
@$pb.TagNumber(1)
set userId($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasUserId() => $_has(0);
@$pb.TagNumber(1)
void clearUserId() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get email => $_getSZ(2);
@$pb.TagNumber(3)
set email($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasEmail() => $_has(2);
@$pb.TagNumber(3)
void clearEmail() => clearField(3);
@$pb.TagNumber(4)
$core.String get token => $_getSZ(3);
@$pb.TagNumber(4)
set token($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4)
$core.bool hasToken() => $_has(3);
@$pb.TagNumber(4)
void clearToken() => clearField(4);
}
class SignUpRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignUpRequest', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
..hasRequiredFields = false
;
SignUpRequest._() : super();
factory SignUpRequest({
$core.String? email,
$core.String? name,
$core.String? password,
}) {
final _result = create();
if (email != null) {
_result.email = email;
}
if (name != null) {
_result.name = name;
}
if (password != null) {
_result.password = password;
}
return _result;
}
factory SignUpRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SignUpRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SignUpRequest clone() => SignUpRequest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SignUpRequest copyWith(void Function(SignUpRequest) updates) => super.copyWith((message) => updates(message as SignUpRequest)) as SignUpRequest; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SignUpRequest create() => SignUpRequest._();
SignUpRequest createEmptyInstance() => create();
static $pb.PbList<SignUpRequest> createRepeated() => $pb.PbList<SignUpRequest>();
@$core.pragma('dart2js:noInline')
static SignUpRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignUpRequest>(create);
static SignUpRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get email => $_getSZ(0);
@$pb.TagNumber(1)
set email($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasEmail() => $_has(0);
@$pb.TagNumber(1)
void clearEmail() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get password => $_getSZ(2);
@$pb.TagNumber(3)
set password($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasPassword() => $_has(2);
@$pb.TagNumber(3)
void clearPassword() => clearField(3);
}
class SignUpParams extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignUpParams', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
..hasRequiredFields = false
;
SignUpParams._() : super();
factory SignUpParams({
$core.String? email,
$core.String? name,
$core.String? password,
}) {
final _result = create();
if (email != null) {
_result.email = email;
}
if (name != null) {
_result.name = name;
}
if (password != null) {
_result.password = password;
}
return _result;
}
factory SignUpParams.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SignUpParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SignUpParams clone() => SignUpParams()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SignUpParams copyWith(void Function(SignUpParams) updates) => super.copyWith((message) => updates(message as SignUpParams)) as SignUpParams; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SignUpParams create() => SignUpParams._();
SignUpParams createEmptyInstance() => create();
static $pb.PbList<SignUpParams> createRepeated() => $pb.PbList<SignUpParams>();
@$core.pragma('dart2js:noInline')
static SignUpParams getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignUpParams>(create);
static SignUpParams? _defaultInstance;
@$pb.TagNumber(1)
$core.String get email => $_getSZ(0);
@$pb.TagNumber(1)
set email($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasEmail() => $_has(0);
@$pb.TagNumber(1)
void clearEmail() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get password => $_getSZ(2);
@$pb.TagNumber(3)
set password($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasPassword() => $_has(2);
@$pb.TagNumber(3)
void clearPassword() => clearField(3);
}
class SignUpResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignUpResponse', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'userId')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'token')
..hasRequiredFields = false
;
SignUpResponse._() : super();
factory SignUpResponse({
$core.String? userId,
$core.String? name,
$core.String? email,
$core.String? token,
}) {
final _result = create();
if (userId != null) {
_result.userId = userId;
}
if (name != null) {
_result.name = name;
}
if (email != null) {
_result.email = email;
}
if (token != null) {
_result.token = token;
}
return _result;
}
factory SignUpResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SignUpResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SignUpResponse clone() => SignUpResponse()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SignUpResponse copyWith(void Function(SignUpResponse) updates) => super.copyWith((message) => updates(message as SignUpResponse)) as SignUpResponse; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SignUpResponse create() => SignUpResponse._();
SignUpResponse createEmptyInstance() => create();
static $pb.PbList<SignUpResponse> createRepeated() => $pb.PbList<SignUpResponse>();
@$core.pragma('dart2js:noInline')
static SignUpResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignUpResponse>(create);
static SignUpResponse? _defaultInstance;
@$pb.TagNumber(1)
$core.String get userId => $_getSZ(0);
@$pb.TagNumber(1)
set userId($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasUserId() => $_has(0);
@$pb.TagNumber(1)
void clearUserId() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get email => $_getSZ(2);
@$pb.TagNumber(3)
set email($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasEmail() => $_has(2);
@$pb.TagNumber(3)
void clearEmail() => clearField(3);
@$pb.TagNumber(4)
$core.String get token => $_getSZ(3);
@$pb.TagNumber(4)
set token($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4)
$core.bool hasToken() => $_has(3);
@$pb.TagNumber(4)
void clearToken() => clearField(4);
}

View File

@ -1,7 +0,0 @@
///
// Generated code. Do not modify.
// source: auth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields

View File

@ -1,84 +0,0 @@
///
// Generated code. Do not modify.
// source: auth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use signInRequestDescriptor instead')
const SignInRequest$json = const {
'1': 'SignInRequest',
'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('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('CgxTaWduSW5QYXJhbXMSFAoFZW1haWwYASABKAlSBWVtYWlsEhoKCHBhc3N3b3JkGAIgASgJUghwYXNzd29yZBISCgRuYW1lGAMgASgJUgRuYW1l');
@$core.Deprecated('Use signInResponseDescriptor instead')
const SignInResponse$json = const {
'1': 'SignInResponse',
'2': const [
const {'1': 'user_id', '3': 1, '4': 1, '5': 9, '10': 'userId'},
const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
const {'1': 'email', '3': 3, '4': 1, '5': 9, '10': 'email'},
const {'1': 'token', '3': 4, '4': 1, '5': 9, '10': 'token'},
],
};
/// Descriptor for `SignInResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List signInResponseDescriptor = $convert.base64Decode('Cg5TaWduSW5SZXNwb25zZRIXCgd1c2VyX2lkGAEgASgJUgZ1c2VySWQSEgoEbmFtZRgCIAEoCVIEbmFtZRIUCgVlbWFpbBgDIAEoCVIFZW1haWwSFAoFdG9rZW4YBCABKAlSBXRva2Vu');
@$core.Deprecated('Use signUpRequestDescriptor instead')
const SignUpRequest$json = const {
'1': 'SignUpRequest',
'2': const [
const {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'},
const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
const {'1': 'password', '3': 3, '4': 1, '5': 9, '10': 'password'},
],
};
/// Descriptor for `SignUpRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List signUpRequestDescriptor = $convert.base64Decode('Cg1TaWduVXBSZXF1ZXN0EhQKBWVtYWlsGAEgASgJUgVlbWFpbBISCgRuYW1lGAIgASgJUgRuYW1lEhoKCHBhc3N3b3JkGAMgASgJUghwYXNzd29yZA==');
@$core.Deprecated('Use signUpParamsDescriptor instead')
const SignUpParams$json = const {
'1': 'SignUpParams',
'2': const [
const {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'},
const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
const {'1': 'password', '3': 3, '4': 1, '5': 9, '10': 'password'},
],
};
/// Descriptor for `SignUpParams`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List signUpParamsDescriptor = $convert.base64Decode('CgxTaWduVXBQYXJhbXMSFAoFZW1haWwYASABKAlSBWVtYWlsEhIKBG5hbWUYAiABKAlSBG5hbWUSGgoIcGFzc3dvcmQYAyABKAlSCHBhc3N3b3Jk');
@$core.Deprecated('Use signUpResponseDescriptor instead')
const SignUpResponse$json = const {
'1': 'SignUpResponse',
'2': const [
const {'1': 'user_id', '3': 1, '4': 1, '5': 9, '10': 'userId'},
const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
const {'1': 'email', '3': 3, '4': 1, '5': 9, '10': 'email'},
const {'1': 'token', '3': 4, '4': 1, '5': 9, '10': 'token'},
],
};
/// Descriptor for `SignUpResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List signUpResponseDescriptor = $convert.base64Decode('Cg5TaWduVXBSZXNwb25zZRIXCgd1c2VyX2lkGAEgASgJUgZ1c2VySWQSEgoEbmFtZRgCIAEoCVIEbmFtZRIUCgVlbWFpbBgDIAEoCVIFZW1haWwSFAoFdG9rZW4YBCABKAlSBXRva2Vu');

View File

@ -1,9 +0,0 @@
///
// Generated code. Do not modify.
// source: auth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
export 'auth.pb.dart';

View File

@ -7,56 +7,5 @@
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'observable.pbenum.dart';
export 'observable.pbenum.dart';
class NetworkState extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'NetworkState', createEmptyInstance: create)
..e<NetworkType>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'ty', $pb.PbFieldType.OE, defaultOrMaker: NetworkType.UnknownNetworkType, valueOf: NetworkType.valueOf, enumValues: NetworkType.values)
..hasRequiredFields = false
;
NetworkState._() : super();
factory NetworkState({
NetworkType? ty,
}) {
final _result = create();
if (ty != null) {
_result.ty = ty;
}
return _result;
}
factory NetworkState.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory NetworkState.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
NetworkState clone() => NetworkState()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
NetworkState copyWith(void Function(NetworkState) updates) => super.copyWith((message) => updates(message as NetworkState)) as NetworkState; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static NetworkState create() => NetworkState._();
NetworkState createEmptyInstance() => create();
static $pb.PbList<NetworkState> createRepeated() => $pb.PbList<NetworkState>();
@$core.pragma('dart2js:noInline')
static NetworkState getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<NetworkState>(create);
static NetworkState? _defaultInstance;
@$pb.TagNumber(1)
NetworkType get ty => $_getN(0);
@$pb.TagNumber(1)
set ty(NetworkType v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasTy() => $_has(0);
@$pb.TagNumber(1)
void clearTy() => clearField(1);
}

View File

@ -30,22 +30,3 @@ class UserNotification extends $pb.ProtobufEnum {
const UserNotification._($core.int v, $core.String n) : super(v, n);
}
class NetworkType extends $pb.ProtobufEnum {
static const NetworkType UnknownNetworkType = NetworkType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UnknownNetworkType');
static const NetworkType Wifi = NetworkType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Wifi');
static const NetworkType Cell = NetworkType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Cell');
static const NetworkType Ethernet = NetworkType._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Ethernet');
static const $core.List<NetworkType> values = <NetworkType> [
UnknownNetworkType,
Wifi,
Cell,
Ethernet,
];
static final $core.Map<$core.int, NetworkType> _byValue = $pb.ProtobufEnum.initByValue(values);
static NetworkType? valueOf($core.int value) => _byValue[value];
const NetworkType._($core.int v, $core.String n) : super(v, n);
}

View File

@ -22,26 +22,3 @@ const UserNotification$json = const {
/// Descriptor for `UserNotification`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List userNotificationDescriptor = $convert.base64Decode('ChBVc2VyTm90aWZpY2F0aW9uEgsKB1Vua25vd24QABITCg9Vc2VyQXV0aENoYW5nZWQQARIWChJVc2VyUHJvZmlsZVVwZGF0ZWQQAhIUChBVc2VyVW5hdXRob3JpemVkEAMSHQoZVXNlcldzQ29ubmVjdFN0YXRlQ2hhbmdlZBAE');
@$core.Deprecated('Use networkTypeDescriptor instead')
const NetworkType$json = const {
'1': 'NetworkType',
'2': const [
const {'1': 'UnknownNetworkType', '2': 0},
const {'1': 'Wifi', '2': 1},
const {'1': 'Cell', '2': 2},
const {'1': 'Ethernet', '2': 3},
],
};
/// Descriptor for `NetworkType`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List networkTypeDescriptor = $convert.base64Decode('CgtOZXR3b3JrVHlwZRIWChJVbmtub3duTmV0d29ya1R5cGUQABIICgRXaWZpEAESCAoEQ2VsbBACEgwKCEV0aGVybmV0EAM=');
@$core.Deprecated('Use networkStateDescriptor instead')
const NetworkState$json = const {
'1': 'NetworkState',
'2': const [
const {'1': 'ty', '3': 1, '4': 1, '5': 14, '6': '.NetworkType', '10': 'ty'},
],
};
/// Descriptor for `NetworkState`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List networkStateDescriptor = $convert.base64Decode('CgxOZXR3b3JrU3RhdGUSHAoCdHkYASABKA4yDC5OZXR3b3JrVHlwZVICdHk=');

View File

@ -1,7 +1,4 @@
// Auto-generated, do not edit
export './observable.pb.dart';
export './user_table.pb.dart';
export './errors.pb.dart';
export './user_profile.pb.dart';
export './event.pb.dart';
export './auth.pb.dart';

View File

@ -1,403 +0,0 @@
///
// Generated code. Do not modify.
// source: user_profile.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class UserToken extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UserToken', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'token')
..hasRequiredFields = false
;
UserToken._() : super();
factory UserToken({
$core.String? token,
}) {
final _result = create();
if (token != null) {
_result.token = token;
}
return _result;
}
factory UserToken.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory UserToken.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
UserToken clone() => UserToken()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
UserToken copyWith(void Function(UserToken) updates) => super.copyWith((message) => updates(message as UserToken)) as UserToken; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static UserToken create() => UserToken._();
UserToken createEmptyInstance() => create();
static $pb.PbList<UserToken> createRepeated() => $pb.PbList<UserToken>();
@$core.pragma('dart2js:noInline')
static UserToken getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UserToken>(create);
static UserToken? _defaultInstance;
@$pb.TagNumber(1)
$core.String get token => $_getSZ(0);
@$pb.TagNumber(1)
set token($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasToken() => $_has(0);
@$pb.TagNumber(1)
void clearToken() => clearField(1);
}
class UserProfile extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UserProfile', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'token')
..hasRequiredFields = false
;
UserProfile._() : super();
factory UserProfile({
$core.String? id,
$core.String? email,
$core.String? name,
$core.String? token,
}) {
final _result = create();
if (id != null) {
_result.id = id;
}
if (email != null) {
_result.email = email;
}
if (name != null) {
_result.name = name;
}
if (token != null) {
_result.token = token;
}
return _result;
}
factory UserProfile.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory UserProfile.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
UserProfile clone() => UserProfile()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
UserProfile copyWith(void Function(UserProfile) updates) => super.copyWith((message) => updates(message as UserProfile)) as UserProfile; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static UserProfile create() => UserProfile._();
UserProfile createEmptyInstance() => create();
static $pb.PbList<UserProfile> createRepeated() => $pb.PbList<UserProfile>();
@$core.pragma('dart2js:noInline')
static UserProfile getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UserProfile>(create);
static UserProfile? _defaultInstance;
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
@$pb.TagNumber(2)
$core.String get email => $_getSZ(1);
@$pb.TagNumber(2)
set email($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasEmail() => $_has(1);
@$pb.TagNumber(2)
void clearEmail() => 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);
@$pb.TagNumber(4)
$core.String get token => $_getSZ(3);
@$pb.TagNumber(4)
set token($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4)
$core.bool hasToken() => $_has(3);
@$pb.TagNumber(4)
void clearToken() => clearField(4);
}
enum UpdateUserRequest_OneOfName {
name,
notSet
}
enum UpdateUserRequest_OneOfEmail {
email,
notSet
}
enum UpdateUserRequest_OneOfPassword {
password,
notSet
}
class UpdateUserRequest extends $pb.GeneratedMessage {
static const $core.Map<$core.int, UpdateUserRequest_OneOfName> _UpdateUserRequest_OneOfNameByTag = {
2 : UpdateUserRequest_OneOfName.name,
0 : UpdateUserRequest_OneOfName.notSet
};
static const $core.Map<$core.int, UpdateUserRequest_OneOfEmail> _UpdateUserRequest_OneOfEmailByTag = {
3 : UpdateUserRequest_OneOfEmail.email,
0 : UpdateUserRequest_OneOfEmail.notSet
};
static const $core.Map<$core.int, UpdateUserRequest_OneOfPassword> _UpdateUserRequest_OneOfPasswordByTag = {
4 : UpdateUserRequest_OneOfPassword.password,
0 : UpdateUserRequest_OneOfPassword.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateUserRequest', createEmptyInstance: create)
..oo(0, [2])
..oo(1, [3])
..oo(2, [4])
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
..hasRequiredFields = false
;
UpdateUserRequest._() : super();
factory UpdateUserRequest({
$core.String? id,
$core.String? name,
$core.String? email,
$core.String? password,
}) {
final _result = create();
if (id != null) {
_result.id = id;
}
if (name != null) {
_result.name = name;
}
if (email != null) {
_result.email = email;
}
if (password != null) {
_result.password = password;
}
return _result;
}
factory UpdateUserRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory UpdateUserRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
UpdateUserRequest clone() => UpdateUserRequest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
UpdateUserRequest copyWith(void Function(UpdateUserRequest) updates) => super.copyWith((message) => updates(message as UpdateUserRequest)) as UpdateUserRequest; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static UpdateUserRequest create() => UpdateUserRequest._();
UpdateUserRequest createEmptyInstance() => create();
static $pb.PbList<UpdateUserRequest> createRepeated() => $pb.PbList<UpdateUserRequest>();
@$core.pragma('dart2js:noInline')
static UpdateUserRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UpdateUserRequest>(create);
static UpdateUserRequest? _defaultInstance;
UpdateUserRequest_OneOfName whichOneOfName() => _UpdateUserRequest_OneOfNameByTag[$_whichOneof(0)]!;
void clearOneOfName() => clearField($_whichOneof(0));
UpdateUserRequest_OneOfEmail whichOneOfEmail() => _UpdateUserRequest_OneOfEmailByTag[$_whichOneof(1)]!;
void clearOneOfEmail() => clearField($_whichOneof(1));
UpdateUserRequest_OneOfPassword whichOneOfPassword() => _UpdateUserRequest_OneOfPasswordByTag[$_whichOneof(2)]!;
void clearOneOfPassword() => clearField($_whichOneof(2));
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get email => $_getSZ(2);
@$pb.TagNumber(3)
set email($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasEmail() => $_has(2);
@$pb.TagNumber(3)
void clearEmail() => clearField(3);
@$pb.TagNumber(4)
$core.String get password => $_getSZ(3);
@$pb.TagNumber(4)
set password($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4)
$core.bool hasPassword() => $_has(3);
@$pb.TagNumber(4)
void clearPassword() => clearField(4);
}
enum UpdateUserParams_OneOfName {
name,
notSet
}
enum UpdateUserParams_OneOfEmail {
email,
notSet
}
enum UpdateUserParams_OneOfPassword {
password,
notSet
}
class UpdateUserParams extends $pb.GeneratedMessage {
static const $core.Map<$core.int, UpdateUserParams_OneOfName> _UpdateUserParams_OneOfNameByTag = {
2 : UpdateUserParams_OneOfName.name,
0 : UpdateUserParams_OneOfName.notSet
};
static const $core.Map<$core.int, UpdateUserParams_OneOfEmail> _UpdateUserParams_OneOfEmailByTag = {
3 : UpdateUserParams_OneOfEmail.email,
0 : UpdateUserParams_OneOfEmail.notSet
};
static const $core.Map<$core.int, UpdateUserParams_OneOfPassword> _UpdateUserParams_OneOfPasswordByTag = {
4 : UpdateUserParams_OneOfPassword.password,
0 : UpdateUserParams_OneOfPassword.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateUserParams', createEmptyInstance: create)
..oo(0, [2])
..oo(1, [3])
..oo(2, [4])
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
..hasRequiredFields = false
;
UpdateUserParams._() : super();
factory UpdateUserParams({
$core.String? id,
$core.String? name,
$core.String? email,
$core.String? password,
}) {
final _result = create();
if (id != null) {
_result.id = id;
}
if (name != null) {
_result.name = name;
}
if (email != null) {
_result.email = email;
}
if (password != null) {
_result.password = password;
}
return _result;
}
factory UpdateUserParams.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory UpdateUserParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
UpdateUserParams clone() => UpdateUserParams()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
UpdateUserParams copyWith(void Function(UpdateUserParams) updates) => super.copyWith((message) => updates(message as UpdateUserParams)) as UpdateUserParams; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static UpdateUserParams create() => UpdateUserParams._();
UpdateUserParams createEmptyInstance() => create();
static $pb.PbList<UpdateUserParams> createRepeated() => $pb.PbList<UpdateUserParams>();
@$core.pragma('dart2js:noInline')
static UpdateUserParams getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UpdateUserParams>(create);
static UpdateUserParams? _defaultInstance;
UpdateUserParams_OneOfName whichOneOfName() => _UpdateUserParams_OneOfNameByTag[$_whichOneof(0)]!;
void clearOneOfName() => clearField($_whichOneof(0));
UpdateUserParams_OneOfEmail whichOneOfEmail() => _UpdateUserParams_OneOfEmailByTag[$_whichOneof(1)]!;
void clearOneOfEmail() => clearField($_whichOneof(1));
UpdateUserParams_OneOfPassword whichOneOfPassword() => _UpdateUserParams_OneOfPasswordByTag[$_whichOneof(2)]!;
void clearOneOfPassword() => clearField($_whichOneof(2));
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get email => $_getSZ(2);
@$pb.TagNumber(3)
set email($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasEmail() => $_has(2);
@$pb.TagNumber(3)
void clearEmail() => clearField(3);
@$pb.TagNumber(4)
$core.String get password => $_getSZ(3);
@$pb.TagNumber(4)
set password($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4)
$core.bool hasPassword() => $_has(3);
@$pb.TagNumber(4)
void clearPassword() => clearField(4);
}

View File

@ -1,7 +0,0 @@
///
// Generated code. Do not modify.
// source: user_profile.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields

View File

@ -1,69 +0,0 @@
///
// Generated code. Do not modify.
// source: user_profile.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use userTokenDescriptor instead')
const UserToken$json = const {
'1': 'UserToken',
'2': const [
const {'1': 'token', '3': 1, '4': 1, '5': 9, '10': 'token'},
],
};
/// Descriptor for `UserToken`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List userTokenDescriptor = $convert.base64Decode('CglVc2VyVG9rZW4SFAoFdG9rZW4YASABKAlSBXRva2Vu');
@$core.Deprecated('Use userProfileDescriptor instead')
const UserProfile$json = const {
'1': 'UserProfile',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'email', '3': 2, '4': 1, '5': 9, '10': 'email'},
const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'},
const {'1': 'token', '3': 4, '4': 1, '5': 9, '10': 'token'},
],
};
/// Descriptor for `UserProfile`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List userProfileDescriptor = $convert.base64Decode('CgtVc2VyUHJvZmlsZRIOCgJpZBgBIAEoCVICaWQSFAoFZW1haWwYAiABKAlSBWVtYWlsEhIKBG5hbWUYAyABKAlSBG5hbWUSFAoFdG9rZW4YBCABKAlSBXRva2Vu');
@$core.Deprecated('Use updateUserRequestDescriptor instead')
const UpdateUserRequest$json = const {
'1': 'UpdateUserRequest',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'name', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'name'},
const {'1': 'email', '3': 3, '4': 1, '5': 9, '9': 1, '10': 'email'},
const {'1': 'password', '3': 4, '4': 1, '5': 9, '9': 2, '10': 'password'},
],
'8': const [
const {'1': 'one_of_name'},
const {'1': 'one_of_email'},
const {'1': 'one_of_password'},
],
};
/// Descriptor for `UpdateUserRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List updateUserRequestDescriptor = $convert.base64Decode('ChFVcGRhdGVVc2VyUmVxdWVzdBIOCgJpZBgBIAEoCVICaWQSFAoEbmFtZRgCIAEoCUgAUgRuYW1lEhYKBWVtYWlsGAMgASgJSAFSBWVtYWlsEhwKCHBhc3N3b3JkGAQgASgJSAJSCHBhc3N3b3JkQg0KC29uZV9vZl9uYW1lQg4KDG9uZV9vZl9lbWFpbEIRCg9vbmVfb2ZfcGFzc3dvcmQ=');
@$core.Deprecated('Use updateUserParamsDescriptor instead')
const UpdateUserParams$json = const {
'1': 'UpdateUserParams',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'name', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'name'},
const {'1': 'email', '3': 3, '4': 1, '5': 9, '9': 1, '10': 'email'},
const {'1': 'password', '3': 4, '4': 1, '5': 9, '9': 2, '10': 'password'},
],
'8': const [
const {'1': 'one_of_name'},
const {'1': 'one_of_email'},
const {'1': 'one_of_password'},
],
};
/// Descriptor for `UpdateUserParams`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List updateUserParamsDescriptor = $convert.base64Decode('ChBVcGRhdGVVc2VyUGFyYW1zEg4KAmlkGAEgASgJUgJpZBIUCgRuYW1lGAIgASgJSABSBG5hbWUSFgoFZW1haWwYAyABKAlIAVIFZW1haWwSHAoIcGFzc3dvcmQYBCABKAlIAlIIcGFzc3dvcmRCDQoLb25lX29mX25hbWVCDgoMb25lX29mX2VtYWlsQhEKD29uZV9vZl9wYXNzd29yZA==');

View File

@ -1,9 +0,0 @@
///
// Generated code. Do not modify.
// source: user_profile.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
export 'user_profile.pb.dart';

View File

@ -1,100 +0,0 @@
///
// Generated code. Do not modify.
// source: user_table.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class User extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'User', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
..hasRequiredFields = false
;
User._() : super();
factory User({
$core.String? id,
$core.String? name,
$core.String? email,
$core.String? password,
}) {
final _result = create();
if (id != null) {
_result.id = id;
}
if (name != null) {
_result.name = name;
}
if (email != null) {
_result.email = email;
}
if (password != null) {
_result.password = password;
}
return _result;
}
factory User.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory User.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
User clone() => User()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
User copyWith(void Function(User) updates) => super.copyWith((message) => updates(message as User)) as User; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static User create() => User._();
User createEmptyInstance() => create();
static $pb.PbList<User> createRepeated() => $pb.PbList<User>();
@$core.pragma('dart2js:noInline')
static User getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<User>(create);
static User? _defaultInstance;
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get email => $_getSZ(2);
@$pb.TagNumber(3)
set email($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasEmail() => $_has(2);
@$pb.TagNumber(3)
void clearEmail() => clearField(3);
@$pb.TagNumber(4)
$core.String get password => $_getSZ(3);
@$pb.TagNumber(4)
set password($core.String v) { $_setString(3, v); }
@$pb.TagNumber(4)
$core.bool hasPassword() => $_has(3);
@$pb.TagNumber(4)
void clearPassword() => clearField(4);
}

View File

@ -1,7 +0,0 @@
///
// Generated code. Do not modify.
// source: user_table.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields

View File

@ -1,23 +0,0 @@
///
// Generated code. Do not modify.
// source: user_table.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use userDescriptor instead')
const User$json = const {
'1': 'User',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
const {'1': 'email', '3': 3, '4': 1, '5': 9, '10': 'email'},
const {'1': 'password', '3': 4, '4': 1, '5': 9, '10': 'password'},
],
};
/// Descriptor for `User`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List userDescriptor = $convert.base64Decode('CgRVc2VyEg4KAmlkGAEgASgJUgJpZBISCgRuYW1lGAIgASgJUgRuYW1lEhQKBWVtYWlsGAMgASgJUgVlbWFpbBIaCghwYXNzd29yZBgEIAEoCVIIcGFzc3dvcmQ=');

View File

@ -0,0 +1,62 @@
///
// Generated code. Do not modify.
// source: network_state.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'network_state.pbenum.dart';
export 'network_state.pbenum.dart';
class NetworkState extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'NetworkState', createEmptyInstance: create)
..e<NetworkType>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'ty', $pb.PbFieldType.OE, defaultOrMaker: NetworkType.UnknownNetworkType, valueOf: NetworkType.valueOf, enumValues: NetworkType.values)
..hasRequiredFields = false
;
NetworkState._() : super();
factory NetworkState({
NetworkType? ty,
}) {
final _result = create();
if (ty != null) {
_result.ty = ty;
}
return _result;
}
factory NetworkState.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory NetworkState.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
NetworkState clone() => NetworkState()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
NetworkState copyWith(void Function(NetworkState) updates) => super.copyWith((message) => updates(message as NetworkState)) as NetworkState; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static NetworkState create() => NetworkState._();
NetworkState createEmptyInstance() => create();
static $pb.PbList<NetworkState> createRepeated() => $pb.PbList<NetworkState>();
@$core.pragma('dart2js:noInline')
static NetworkState getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<NetworkState>(create);
static NetworkState? _defaultInstance;
@$pb.TagNumber(1)
NetworkType get ty => $_getN(0);
@$pb.TagNumber(1)
set ty(NetworkType v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasTy() => $_has(0);
@$pb.TagNumber(1)
void clearTy() => clearField(1);
}

View File

@ -0,0 +1,30 @@
///
// Generated code. Do not modify.
// source: network_state.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: UNDEFINED_SHOWN_NAME
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class NetworkType extends $pb.ProtobufEnum {
static const NetworkType UnknownNetworkType = NetworkType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UnknownNetworkType');
static const NetworkType Wifi = NetworkType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Wifi');
static const NetworkType Cell = NetworkType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Cell');
static const NetworkType Ethernet = NetworkType._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Ethernet');
static const $core.List<NetworkType> values = <NetworkType> [
UnknownNetworkType,
Wifi,
Cell,
Ethernet,
];
static final $core.Map<$core.int, NetworkType> _byValue = $pb.ProtobufEnum.initByValue(values);
static NetworkType? valueOf($core.int value) => _byValue[value];
const NetworkType._($core.int v, $core.String n) : super(v, n);
}

View File

@ -0,0 +1,33 @@
///
// Generated code. Do not modify.
// source: network_state.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use networkTypeDescriptor instead')
const NetworkType$json = const {
'1': 'NetworkType',
'2': const [
const {'1': 'UnknownNetworkType', '2': 0},
const {'1': 'Wifi', '2': 1},
const {'1': 'Cell', '2': 2},
const {'1': 'Ethernet', '2': 3},
],
};
/// Descriptor for `NetworkType`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List networkTypeDescriptor = $convert.base64Decode('CgtOZXR3b3JrVHlwZRIWChJVbmtub3duTmV0d29ya1R5cGUQABIICgRXaWZpEAESCAoEQ2VsbBACEgwKCEV0aGVybmV0EAM=');
@$core.Deprecated('Use networkStateDescriptor instead')
const NetworkState$json = const {
'1': 'NetworkState',
'2': const [
const {'1': 'ty', '3': 1, '4': 1, '5': 14, '6': '.NetworkType', '10': 'ty'},
],
};
/// Descriptor for `NetworkState`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List networkStateDescriptor = $convert.base64Decode('CgxOZXR3b3JrU3RhdGUSHAoCdHkYASABKA4yDC5OZXR3b3JrVHlwZVICdHk=');

View File

@ -1,9 +1,9 @@
///
// Generated code. Do not modify.
// source: user_table.proto
// source: network_state.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
export 'user_table.pb.dart';
export 'network_state.pb.dart';

View File

@ -1,2 +1,3 @@
// Auto-generated, do not edit
export './kv.pb.dart';
export './network_state.pb.dart';

View File

@ -5,12 +5,12 @@ use crate::deps_resolve::WorkspaceDepsResolver;
use backend_service::config::ServerConfig;
use flowy_document::module::FlowyDocument;
use flowy_user::{
notify::{NetworkState, NetworkType},
prelude::UserStatus,
services::user::{UserSession, UserSessionConfig},
};
use flowy_workspace::{errors::WorkspaceError, prelude::WorkspaceController};
use lib_dispatch::prelude::*;
use lib_infra::entities::network_state::NetworkState;
use module::mk_modules;
pub use module::*;
use std::sync::{
@ -102,10 +102,14 @@ impl FlowySDK {
fn _init(dispatch: &EventDispatcher, user_session: Arc<UserSession>, workspace_controller: Arc<WorkspaceController>) {
let user_status_subscribe = user_session.notifier.user_status_subscribe();
let network_status_subscribe = user_session.notifier.network_status_subscribe();
let cloned_workspace_controller = workspace_controller.clone();
dispatch.spawn(async move {
user_session.init();
_listen_user_status(user_status_subscribe, workspace_controller.clone()).await;
_listen_network_status(network_status_subscribe, workspace_controller).await;
});
dispatch.spawn(async move {
_listen_network_status(network_status_subscribe, cloned_workspace_controller).await;
});
}
@ -142,23 +146,10 @@ async fn _listen_user_status(
async fn _listen_network_status(
mut subscribe: broadcast::Receiver<NetworkState>,
_workspace_controller: Arc<WorkspaceController>,
workspace_controller: Arc<WorkspaceController>,
) {
while let Ok(status) = subscribe.recv().await {
let result = || async {
match status.ty {
NetworkType::UnknownNetworkType => {},
NetworkType::Wifi => {},
NetworkType::Cell => {},
NetworkType::Ethernet => {},
}
Ok::<(), WorkspaceError>(())
};
match result().await {
Ok(_) => {},
Err(e) => log::error!("{}", e),
}
while let Ok(state) = subscribe.recv().await {
workspace_controller.network_state_changed(state);
}
}

View File

@ -1,7 +1,6 @@
use crate::{entities::*, errors::UserError, services::user::UserSession};
use lib_dispatch::prelude::*;
use crate::notify::NetworkState;
use lib_infra::entities::network_state::NetworkState;
use std::{convert::TryInto, sync::Arc};
#[tracing::instrument(skip(session))]
@ -38,7 +37,7 @@ pub async fn update_user_handler(
Ok(())
}
#[tracing::instrument(name = "update_user", skip(data, session))]
#[tracing::instrument(skip(data, session))]
pub async fn update_network_ty(data: Data<NetworkState>, session: Unit<Arc<UserSession>>) -> Result<(), UserError> {
let network_state = data.into_inner();
session.update_network_state(network_state);

View File

@ -1,2 +1,2 @@
mod observable;
pub use observable::*;
pub(crate) use observable::*;

View File

@ -1,6 +1,5 @@
use dart_notify::DartNotifyBuilder;
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
use flowy_derive::ProtoBuf_Enum;
const OBSERVABLE_CATEGORY: &str = "User";
#[derive(ProtoBuf_Enum, Debug)]
@ -23,21 +22,3 @@ impl std::convert::From<UserNotification> for i32 {
pub(crate) fn dart_notify(id: &str, ty: UserNotification) -> DartNotifyBuilder {
DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
}
#[derive(ProtoBuf_Enum, Debug, Clone)]
pub enum NetworkType {
UnknownNetworkType = 0,
Wifi = 1,
Cell = 2,
Ethernet = 3,
}
impl std::default::Default for NetworkType {
fn default() -> Self { NetworkType::UnknownNetworkType }
}
#[derive(ProtoBuf, Debug, Default, Clone)]
pub struct NetworkState {
#[pb(index = 1)]
pub ty: NetworkType,
}

File diff suppressed because it is too large Load Diff

View File

@ -4,17 +4,8 @@
mod observable;
pub use observable::*;
mod user_table;
pub use user_table::*;
mod errors;
pub use errors::*;
mod user_profile;
pub use user_profile::*;
mod event;
pub use event::*;
mod auth;
pub use auth::*;

View File

@ -23,154 +23,6 @@
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
#[derive(PartialEq,Clone,Default)]
pub struct NetworkState {
// message fields
pub ty: NetworkType,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a NetworkState {
fn default() -> &'a NetworkState {
<NetworkState as ::protobuf::Message>::default_instance()
}
}
impl NetworkState {
pub fn new() -> NetworkState {
::std::default::Default::default()
}
// .NetworkType ty = 1;
pub fn get_ty(&self) -> NetworkType {
self.ty
}
pub fn clear_ty(&mut self) {
self.ty = NetworkType::UnknownNetworkType;
}
// Param is passed by value, moved
pub fn set_ty(&mut self, v: NetworkType) {
self.ty = v;
}
}
impl ::protobuf::Message for NetworkState {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.ty, 1, &mut self.unknown_fields)?
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if self.ty != NetworkType::UnknownNetworkType {
my_size += ::protobuf::rt::enum_size(1, self.ty);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if self.ty != NetworkType::UnknownNetworkType {
os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.ty))?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> NetworkState {
NetworkState::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<NetworkType>>(
"ty",
|m: &NetworkState| { &m.ty },
|m: &mut NetworkState| { &mut m.ty },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<NetworkState>(
"NetworkState",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static NetworkState {
static instance: ::protobuf::rt::LazyV2<NetworkState> = ::protobuf::rt::LazyV2::INIT;
instance.get(NetworkState::new)
}
}
impl ::protobuf::Clear for NetworkState {
fn clear(&mut self) {
self.ty = NetworkType::UnknownNetworkType;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for NetworkState {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for NetworkState {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum UserNotification {
Unknown = 0,
@ -230,95 +82,23 @@ impl ::protobuf::reflect::ProtobufValue for UserNotification {
}
}
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum NetworkType {
UnknownNetworkType = 0,
Wifi = 1,
Cell = 2,
Ethernet = 3,
}
impl ::protobuf::ProtobufEnum for NetworkType {
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<NetworkType> {
match value {
0 => ::std::option::Option::Some(NetworkType::UnknownNetworkType),
1 => ::std::option::Option::Some(NetworkType::Wifi),
2 => ::std::option::Option::Some(NetworkType::Cell),
3 => ::std::option::Option::Some(NetworkType::Ethernet),
_ => ::std::option::Option::None
}
}
fn values() -> &'static [Self] {
static values: &'static [NetworkType] = &[
NetworkType::UnknownNetworkType,
NetworkType::Wifi,
NetworkType::Cell,
NetworkType::Ethernet,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
::protobuf::reflect::EnumDescriptor::new_pb_name::<NetworkType>("NetworkType", file_descriptor_proto())
})
}
}
impl ::std::marker::Copy for NetworkType {
}
impl ::std::default::Default for NetworkType {
fn default() -> Self {
NetworkType::UnknownNetworkType
}
}
impl ::protobuf::reflect::ProtobufValue for NetworkType {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x10observable.proto\",\n\x0cNetworkState\x12\x1c\n\x02ty\x18\x01\x20\
\x01(\x0e2\x0c.NetworkTypeR\x02ty*\x81\x01\n\x10UserNotification\x12\x0b\
\n\x07Unknown\x10\0\x12\x13\n\x0fUserAuthChanged\x10\x01\x12\x16\n\x12Us\
erProfileUpdated\x10\x02\x12\x14\n\x10UserUnauthorized\x10\x03\x12\x1d\n\
\x19UserWsConnectStateChanged\x10\x04*G\n\x0bNetworkType\x12\x16\n\x12Un\
knownNetworkType\x10\0\x12\x08\n\x04Wifi\x10\x01\x12\x08\n\x04Cell\x10\
\x02\x12\x0c\n\x08Ethernet\x10\x03J\x82\x04\n\x06\x12\x04\0\0\x11\x01\n\
\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\n\
\n\x03\x04\0\x01\x12\x03\x02\x08\x14\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\
\x04\x17\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03\x03\x04\x0f\n\x0c\n\x05\x04\
\0\x02\0\x01\x12\x03\x03\x10\x12\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\
\x15\x16\n\n\n\x02\x05\0\x12\x04\x05\0\x0b\x01\n\n\n\x03\x05\0\x01\x12\
\x03\x05\x05\x15\n\x0b\n\x04\x05\0\x02\0\x12\x03\x06\x04\x10\n\x0c\n\x05\
\x05\0\x02\0\x01\x12\x03\x06\x04\x0b\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\
\x06\x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x07\x04\x18\n\x0c\n\x05\
\x05\0\x02\x01\x01\x12\x03\x07\x04\x13\n\x0c\n\x05\x05\0\x02\x01\x02\x12\
\x03\x07\x16\x17\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x08\x04\x1b\n\x0c\n\
\x05\x05\0\x02\x02\x01\x12\x03\x08\x04\x16\n\x0c\n\x05\x05\0\x02\x02\x02\
\x12\x03\x08\x19\x1a\n\x0b\n\x04\x05\0\x02\x03\x12\x03\t\x04\x19\n\x0c\n\
\x05\x05\0\x02\x03\x01\x12\x03\t\x04\x14\n\x0c\n\x05\x05\0\x02\x03\x02\
\x12\x03\t\x17\x18\n\x0b\n\x04\x05\0\x02\x04\x12\x03\n\x04\"\n\x0c\n\x05\
\x05\0\x02\x04\x01\x12\x03\n\x04\x1d\n\x0c\n\x05\x05\0\x02\x04\x02\x12\
\x03\n\x20!\n\n\n\x02\x05\x01\x12\x04\x0c\0\x11\x01\n\n\n\x03\x05\x01\
\x01\x12\x03\x0c\x05\x10\n\x0b\n\x04\x05\x01\x02\0\x12\x03\r\x04\x1b\n\
\x0c\n\x05\x05\x01\x02\0\x01\x12\x03\r\x04\x16\n\x0c\n\x05\x05\x01\x02\0\
\x02\x12\x03\r\x19\x1a\n\x0b\n\x04\x05\x01\x02\x01\x12\x03\x0e\x04\r\n\
\x0c\n\x05\x05\x01\x02\x01\x01\x12\x03\x0e\x04\x08\n\x0c\n\x05\x05\x01\
\x02\x01\x02\x12\x03\x0e\x0b\x0c\n\x0b\n\x04\x05\x01\x02\x02\x12\x03\x0f\
\x04\r\n\x0c\n\x05\x05\x01\x02\x02\x01\x12\x03\x0f\x04\x08\n\x0c\n\x05\
\x05\x01\x02\x02\x02\x12\x03\x0f\x0b\x0c\n\x0b\n\x04\x05\x01\x02\x03\x12\
\x03\x10\x04\x11\n\x0c\n\x05\x05\x01\x02\x03\x01\x12\x03\x10\x04\x0c\n\
\x0c\n\x05\x05\x01\x02\x03\x02\x12\x03\x10\x0f\x10b\x06proto3\
\n\x10observable.proto*\x81\x01\n\x10UserNotification\x12\x0b\n\x07Unkno\
wn\x10\0\x12\x13\n\x0fUserAuthChanged\x10\x01\x12\x16\n\x12UserProfileUp\
dated\x10\x02\x12\x14\n\x10UserUnauthorized\x10\x03\x12\x1d\n\x19UserWsC\
onnectStateChanged\x10\x04J\xf7\x01\n\x06\x12\x04\0\0\x08\x01\n\x08\n\
\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x05\0\x12\x04\x02\0\x08\x01\n\n\n\x03\
\x05\0\x01\x12\x03\x02\x05\x15\n\x0b\n\x04\x05\0\x02\0\x12\x03\x03\x04\
\x10\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x03\x04\x0b\n\x0c\n\x05\x05\0\
\x02\0\x02\x12\x03\x03\x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x04\x04\
\x18\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x04\x04\x13\n\x0c\n\x05\x05\0\
\x02\x01\x02\x12\x03\x04\x16\x17\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x05\
\x04\x1b\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x05\x04\x16\n\x0c\n\x05\
\x05\0\x02\x02\x02\x12\x03\x05\x19\x1a\n\x0b\n\x04\x05\0\x02\x03\x12\x03\
\x06\x04\x19\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03\x06\x04\x14\n\x0c\n\
\x05\x05\0\x02\x03\x02\x12\x03\x06\x17\x18\n\x0b\n\x04\x05\0\x02\x04\x12\
\x03\x07\x04\"\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03\x07\x04\x1d\n\x0c\n\
\x05\x05\0\x02\x04\x02\x12\x03\x07\x20!b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

File diff suppressed because it is too large Load Diff

View File

@ -1,341 +0,0 @@
// This file is generated by rust-protobuf 2.22.1. Do not edit
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![allow(unused_attributes)]
#![cfg_attr(rustfmt, rustfmt::skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unused_imports)]
#![allow(unused_results)]
//! Generated file from `user_table.proto`
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
#[derive(PartialEq,Clone,Default)]
pub struct User {
// message fields
pub id: ::std::string::String,
pub name: ::std::string::String,
pub email: ::std::string::String,
pub password: ::std::string::String,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a User {
fn default() -> &'a User {
<User as ::protobuf::Message>::default_instance()
}
}
impl User {
pub fn new() -> User {
::std::default::Default::default()
}
// string id = 1;
pub fn get_id(&self) -> &str {
&self.id
}
pub fn clear_id(&mut self) {
self.id.clear();
}
// Param is passed by value, moved
pub fn set_id(&mut self, v: ::std::string::String) {
self.id = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_id(&mut self) -> &mut ::std::string::String {
&mut self.id
}
// Take field
pub fn take_id(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.id, ::std::string::String::new())
}
// string name = 2;
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())
}
// string email = 3;
pub fn get_email(&self) -> &str {
&self.email
}
pub fn clear_email(&mut self) {
self.email.clear();
}
// Param is passed by value, moved
pub fn set_email(&mut self, v: ::std::string::String) {
self.email = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_email(&mut self) -> &mut ::std::string::String {
&mut self.email
}
// Take field
pub fn take_email(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.email, ::std::string::String::new())
}
// string password = 4;
pub fn get_password(&self) -> &str {
&self.password
}
pub fn clear_password(&mut self) {
self.password.clear();
}
// Param is passed by value, moved
pub fn set_password(&mut self, v: ::std::string::String) {
self.password = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_password(&mut self) -> &mut ::std::string::String {
&mut self.password
}
// Take field
pub fn take_password(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.password, ::std::string::String::new())
}
}
impl ::protobuf::Message for User {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?;
},
2 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
},
3 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.email)?;
},
4 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.password)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if !self.id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.id);
}
if !self.name.is_empty() {
my_size += ::protobuf::rt::string_size(2, &self.name);
}
if !self.email.is_empty() {
my_size += ::protobuf::rt::string_size(3, &self.email);
}
if !self.password.is_empty() {
my_size += ::protobuf::rt::string_size(4, &self.password);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.id.is_empty() {
os.write_string(1, &self.id)?;
}
if !self.name.is_empty() {
os.write_string(2, &self.name)?;
}
if !self.email.is_empty() {
os.write_string(3, &self.email)?;
}
if !self.password.is_empty() {
os.write_string(4, &self.password)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> User {
User::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"id",
|m: &User| { &m.id },
|m: &mut User| { &mut m.id },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"name",
|m: &User| { &m.name },
|m: &mut User| { &mut m.name },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"email",
|m: &User| { &m.email },
|m: &mut User| { &mut m.email },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"password",
|m: &User| { &m.password },
|m: &mut User| { &mut m.password },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<User>(
"User",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static User {
static instance: ::protobuf::rt::LazyV2<User> = ::protobuf::rt::LazyV2::INIT;
instance.get(User::new)
}
}
impl ::protobuf::Clear for User {
fn clear(&mut self) {
self.id.clear();
self.name.clear();
self.email.clear();
self.password.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for User {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for User {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x10user_table.proto\"\\\n\x04User\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\
\x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x14\n\x05email\
\x18\x03\x20\x01(\tR\x05email\x12\x1a\n\x08password\x18\x04\x20\x01(\tR\
\x08passwordJ\x86\x02\n\x06\x12\x04\0\0\x07\x01\n\x08\n\x01\x0c\x12\x03\
\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x07\x01\n\n\n\x03\x04\0\x01\x12\
\x03\x02\x08\x0c\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x12\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\r\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x10\x11\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\x15\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\x10\n\x0c\n\x05\x04\0\x02\x02\x03\x12\
\x03\x05\x13\x14\n\x0b\n\x04\x04\0\x02\x03\x12\x03\x06\x04\x18\n\x0c\n\
\x05\x04\0\x02\x03\x05\x12\x03\x06\x04\n\n\x0c\n\x05\x04\0\x02\x03\x01\
\x12\x03\x06\x0b\x13\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x06\x16\x17b\
\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
}
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
file_descriptor_proto_lazy.get(|| {
parse_descriptor_proto()
})
}

View File

@ -1,34 +0,0 @@
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;
string name = 2;
string email = 3;
string token = 4;
}
message SignUpRequest {
string email = 1;
string name = 2;
string password = 3;
}
message SignUpParams {
string email = 1;
string name = 2;
string password = 3;
}
message SignUpResponse {
string user_id = 1;
string name = 2;
string email = 3;
string token = 4;
}

View File

@ -1,8 +1,5 @@
syntax = "proto3";
message NetworkState {
NetworkType ty = 1;
}
enum UserNotification {
Unknown = 0;
UserAuthChanged = 1;
@ -10,9 +7,3 @@ enum UserNotification {
UserUnauthorized = 3;
UserWsConnectStateChanged = 4;
}
enum NetworkType {
UnknownNetworkType = 0;
Wifi = 1;
Cell = 2;
Ethernet = 3;
}

View File

@ -1,23 +0,0 @@
syntax = "proto3";
message UserToken {
string token = 1;
}
message UserProfile {
string id = 1;
string email = 2;
string name = 3;
string token = 4;
}
message UpdateUserRequest {
string id = 1;
oneof one_of_name { string name = 2; };
oneof one_of_email { string email = 3; };
oneof one_of_password { string password = 4; };
}
message UpdateUserParams {
string id = 1;
oneof one_of_name { string name = 2; };
oneof one_of_email { string email = 3; };
oneof one_of_password { string password = 4; };
}

View File

@ -1,8 +0,0 @@
syntax = "proto3";
message User {
string id = 1;
string name = 2;
string email = 3;
string password = 4;
}

View File

@ -1,7 +1,5 @@
use crate::{
entities::{UserProfile, UserStatus},
notify::NetworkState,
};
use crate::entities::{UserProfile, UserStatus};
use lib_infra::entities::network_state::NetworkState;
use tokio::sync::{broadcast, mpsc};
pub struct UserNotifier {

View File

@ -20,7 +20,7 @@ use flowy_database::{
ExpressionMethods,
UserDatabaseConnection,
};
use lib_infra::kv::KV;
use lib_infra::{entities::network_state::NetworkState, kv::KV};
use lib_sqlite::ConnectionPool;
use lib_ws::{WsController, WsMessageHandler, WsState};
use parking_lot::RwLock;
@ -189,9 +189,7 @@ impl UserSession {
let _ = self.ws_controller.add_handler(handler);
}
pub fn update_network_state(&self, state: NetworkState) {
log::info!("{:?}", state);
}
pub fn update_network_state(&self, state: NetworkState) { self.notifier.update_network_state(state); }
}
impl UserSession {

View File

@ -13,7 +13,10 @@ use flowy_workspace_infra::{
user_default,
};
use lazy_static::lazy_static;
use lib_infra::kv::KV;
use lib_infra::{
entities::network_state::{NetworkState, NetworkType},
kv::KV,
};
use parking_lot::RwLock;
use std::{collections::HashMap, sync::Arc};
@ -73,6 +76,15 @@ impl WorkspaceController {
Ok(())
}
pub fn network_state_changed(&self, network_state: NetworkState) {
match network_state.ty {
NetworkType::UnknownNetworkType => {},
NetworkType::Wifi => {},
NetworkType::Cell => {},
NetworkType::Ethernet => {},
}
}
pub async fn user_did_sign_in(&self, token: &str) -> WorkspaceResult<()> {
// TODO: (nathan) do something here

View File

@ -1,2 +1,2 @@
proto_crates = ["src/kv"]
proto_crates = ["src/kv", "src/entities"]
event_files = []

View File

@ -0,0 +1 @@
pub mod network_state;

View File

@ -0,0 +1,19 @@
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
#[derive(ProtoBuf_Enum, Debug, Clone)]
pub enum NetworkType {
UnknownNetworkType = 0,
Wifi = 1,
Cell = 2,
Ethernet = 3,
}
impl std::default::Default for NetworkType {
fn default() -> Self { NetworkType::UnknownNetworkType }
}
#[derive(ProtoBuf, Debug, Default, Clone)]
pub struct NetworkState {
#[pb(index = 1)]
pub ty: NetworkType,
}

View File

@ -4,6 +4,7 @@ extern crate diesel;
#[macro_use]
extern crate diesel_derives;
pub mod entities;
pub mod future;
pub mod kv;
mod protobuf;

View File

@ -3,3 +3,6 @@
mod kv;
pub use kv::*;
mod network_state;
pub use network_state::*;

View File

@ -0,0 +1,261 @@
// This file is generated by rust-protobuf 2.22.1. Do not edit
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![allow(unused_attributes)]
#![cfg_attr(rustfmt, rustfmt::skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unused_imports)]
#![allow(unused_results)]
//! Generated file from `network_state.proto`
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
#[derive(PartialEq,Clone,Default)]
pub struct NetworkState {
// message fields
pub ty: NetworkType,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a NetworkState {
fn default() -> &'a NetworkState {
<NetworkState as ::protobuf::Message>::default_instance()
}
}
impl NetworkState {
pub fn new() -> NetworkState {
::std::default::Default::default()
}
// .NetworkType ty = 1;
pub fn get_ty(&self) -> NetworkType {
self.ty
}
pub fn clear_ty(&mut self) {
self.ty = NetworkType::UnknownNetworkType;
}
// Param is passed by value, moved
pub fn set_ty(&mut self, v: NetworkType) {
self.ty = v;
}
}
impl ::protobuf::Message for NetworkState {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.ty, 1, &mut self.unknown_fields)?
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if self.ty != NetworkType::UnknownNetworkType {
my_size += ::protobuf::rt::enum_size(1, self.ty);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if self.ty != NetworkType::UnknownNetworkType {
os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.ty))?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> NetworkState {
NetworkState::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<NetworkType>>(
"ty",
|m: &NetworkState| { &m.ty },
|m: &mut NetworkState| { &mut m.ty },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<NetworkState>(
"NetworkState",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static NetworkState {
static instance: ::protobuf::rt::LazyV2<NetworkState> = ::protobuf::rt::LazyV2::INIT;
instance.get(NetworkState::new)
}
}
impl ::protobuf::Clear for NetworkState {
fn clear(&mut self) {
self.ty = NetworkType::UnknownNetworkType;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for NetworkState {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for NetworkState {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum NetworkType {
UnknownNetworkType = 0,
Wifi = 1,
Cell = 2,
Ethernet = 3,
}
impl ::protobuf::ProtobufEnum for NetworkType {
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<NetworkType> {
match value {
0 => ::std::option::Option::Some(NetworkType::UnknownNetworkType),
1 => ::std::option::Option::Some(NetworkType::Wifi),
2 => ::std::option::Option::Some(NetworkType::Cell),
3 => ::std::option::Option::Some(NetworkType::Ethernet),
_ => ::std::option::Option::None
}
}
fn values() -> &'static [Self] {
static values: &'static [NetworkType] = &[
NetworkType::UnknownNetworkType,
NetworkType::Wifi,
NetworkType::Cell,
NetworkType::Ethernet,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
::protobuf::reflect::EnumDescriptor::new_pb_name::<NetworkType>("NetworkType", file_descriptor_proto())
})
}
}
impl ::std::marker::Copy for NetworkType {
}
impl ::std::default::Default for NetworkType {
fn default() -> Self {
NetworkType::UnknownNetworkType
}
}
impl ::protobuf::reflect::ProtobufValue for NetworkType {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x13network_state.proto\",\n\x0cNetworkState\x12\x1c\n\x02ty\x18\x01\
\x20\x01(\x0e2\x0c.NetworkTypeR\x02ty*G\n\x0bNetworkType\x12\x16\n\x12Un\
knownNetworkType\x10\0\x12\x08\n\x04Wifi\x10\x01\x12\x08\n\x04Cell\x10\
\x02\x12\x0c\n\x08Ethernet\x10\x03J\x9d\x02\n\x06\x12\x04\0\0\n\x01\n\
\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\n\
\n\x03\x04\0\x01\x12\x03\x02\x08\x14\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\
\x04\x17\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03\x03\x04\x0f\n\x0c\n\x05\x04\
\0\x02\0\x01\x12\x03\x03\x10\x12\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\
\x15\x16\n\n\n\x02\x05\0\x12\x04\x05\0\n\x01\n\n\n\x03\x05\0\x01\x12\x03\
\x05\x05\x10\n\x0b\n\x04\x05\0\x02\0\x12\x03\x06\x04\x1b\n\x0c\n\x05\x05\
\0\x02\0\x01\x12\x03\x06\x04\x16\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x06\
\x19\x1a\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x07\x04\r\n\x0c\n\x05\x05\0\
\x02\x01\x01\x12\x03\x07\x04\x08\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\
\x07\x0b\x0c\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x08\x04\r\n\x0c\n\x05\x05\
\0\x02\x02\x01\x12\x03\x08\x04\x08\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\
\x08\x0b\x0c\n\x0b\n\x04\x05\0\x02\x03\x12\x03\t\x04\x11\n\x0c\n\x05\x05\
\0\x02\x03\x01\x12\x03\t\x04\x0c\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\t\
\x0f\x10b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
}
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
file_descriptor_proto_lazy.get(|| {
parse_descriptor_proto()
})
}

View File

@ -0,0 +1,11 @@
syntax = "proto3";
message NetworkState {
NetworkType ty = 1;
}
enum NetworkType {
UnknownNetworkType = 0;
Wifi = 1;
Cell = 2;
Ethernet = 3;
}

View File

@ -17,13 +17,13 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
"u8" => TypeCategory::Bytes,
"String" => TypeCategory::Str,
"KeyValue"
| "NetworkState"
| "WorkspaceError"
| "DocError"
| "FFIRequest"
| "FFIResponse"
| "SubscribeObject"
| "UserError"
| "NetworkState"
| "QueryAppRequest"
| "AppIdentifier"
| "CreateAppRequest"
@ -80,14 +80,14 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
| "UpdateUserRequest"
| "UpdateUserParams"
=> TypeCategory::Protobuf,
"WorkspaceEvent"
"NetworkType"
| "WorkspaceEvent"
| "WorkspaceNotification"
| "ErrorCode"
| "DocObservable"
| "FFIStatusCode"
| "UserEvent"
| "UserNotification"
| "NetworkType"
| "TrashType"
| "ViewType"
| "ExportType"