Настройки, авторизация
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'user.freezed.dart';
|
||||
// part 'user.g.dart';
|
||||
part 'user.g.dart';
|
||||
|
||||
@freezed
|
||||
class User with _$User {
|
||||
@@ -15,5 +15,5 @@ class User with _$User {
|
||||
bool? isOnline,
|
||||
}) = _User;
|
||||
|
||||
// factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
|
||||
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@ T _$identity<T>(T value) => value;
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
User _$UserFromJson(Map<String, dynamic> json) {
|
||||
return _User.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$User {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
@@ -24,6 +28,7 @@ mixin _$User {
|
||||
DateTime? get lastSeen => throw _privateConstructorUsedError;
|
||||
bool? get isOnline => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$UserCopyWith<User> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -166,7 +171,7 @@ class __$$UserImplCopyWithImpl<$Res>
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
@JsonSerializable()
|
||||
class _$UserImpl implements _User {
|
||||
const _$UserImpl(
|
||||
{required this.id,
|
||||
@@ -177,6 +182,9 @@ class _$UserImpl implements _User {
|
||||
this.lastSeen,
|
||||
this.isOnline});
|
||||
|
||||
factory _$UserImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$UserImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
@@ -215,6 +223,7 @@ class _$UserImpl implements _User {
|
||||
other.isOnline == isOnline));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, id, email, name, avatarUrl, phoneNumber, lastSeen, isOnline);
|
||||
@@ -224,6 +233,13 @@ class _$UserImpl implements _User {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
__$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$UserImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _User implements User {
|
||||
@@ -236,6 +252,8 @@ abstract class _User implements User {
|
||||
final DateTime? lastSeen,
|
||||
final bool? isOnline}) = _$UserImpl;
|
||||
|
||||
factory _User.fromJson(Map<String, dynamic> json) = _$UserImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$UserImpl _$$UserImplFromJson(Map<String, dynamic> json) => _$UserImpl(
|
||||
id: json['id'] as String,
|
||||
email: json['email'] as String,
|
||||
name: json['name'] as String,
|
||||
avatarUrl: json['avatarUrl'] as String?,
|
||||
phoneNumber: json['phoneNumber'] as String?,
|
||||
lastSeen: json['lastSeen'] == null
|
||||
? null
|
||||
: DateTime.parse(json['lastSeen'] as String),
|
||||
isOnline: json['isOnline'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$UserImplToJson(_$UserImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'email': instance.email,
|
||||
'name': instance.name,
|
||||
'avatarUrl': instance.avatarUrl,
|
||||
'phoneNumber': instance.phoneNumber,
|
||||
'lastSeen': instance.lastSeen?.toIso8601String(),
|
||||
'isOnline': instance.isOnline,
|
||||
};
|
||||
@@ -2,8 +2,8 @@ import '../../../../core/errors/result.dart';
|
||||
import '../entities/user.dart';
|
||||
|
||||
abstract class AuthRepository {
|
||||
Future<Result<User>> login(String email, String password);
|
||||
Future<Result<User>> register(String email, String password, String name);
|
||||
Future<Result<User>> login(String username, String password);
|
||||
Future<Result<User>> register(String username, String password, String name);
|
||||
Future<Result<void>> logout();
|
||||
Future<Result<User>> getCurrentUser();
|
||||
Future<Result<void>> refreshToken();
|
||||
|
||||
Reference in New Issue
Block a user