Use TupleKey(ObjectKey-AccountId-UserName) to store data to hive
(cherry picked from commit e0ace535d5f3af71eb13598d92524caf2c6d9bbf)
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:model/account/authentication_type.dart';
|
||||
import 'package:model/account/password.dart';
|
||||
import 'package:model/oidc/token.dart';
|
||||
|
||||
class AccountRequest with EquatableMixin {
|
||||
final UserName? userName;
|
||||
@@ -16,8 +19,7 @@ class AccountRequest with EquatableMixin {
|
||||
this.authenticationType = AuthenticationType.none,
|
||||
});
|
||||
|
||||
String get basicAuth =>
|
||||
'Basic ${base64Encode(utf8.encode('${userName?.userName}:${password?.value}'))}';
|
||||
String get basicAuth => 'Basic ${base64Encode(utf8.encode('${userName?.value}:${password?.value}'))}';
|
||||
|
||||
String get bearerToken => 'Bearer ${token?.token}';
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/account/account.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/capability/capability_properties.dart';
|
||||
|
||||
class JmapAccount with EquatableMixin {
|
||||
|
||||
final AccountId accountId;
|
||||
final AccountName name;
|
||||
final bool isPersonal;
|
||||
final bool isReadOnly;
|
||||
final Map<CapabilityIdentifier, CapabilityProperties> accountCapabilities;
|
||||
|
||||
JmapAccount(
|
||||
this.accountId,
|
||||
this.name,
|
||||
this.isPersonal,
|
||||
this.isReadOnly,
|
||||
this.accountCapabilities,
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object> get props => [
|
||||
accountId,
|
||||
name,
|
||||
isPersonal,
|
||||
isReadOnly,
|
||||
accountCapabilities
|
||||
];
|
||||
}
|
||||
@@ -1,21 +1,24 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:model/account/authentication_type.dart';
|
||||
|
||||
class Account with EquatableMixin {
|
||||
class PersonalAccount with EquatableMixin {
|
||||
final String id;
|
||||
final AuthenticationType authenticationType;
|
||||
final bool isSelected;
|
||||
final AccountId? accountId;
|
||||
final String? apiUrl;
|
||||
final UserName? userName;
|
||||
|
||||
Account(
|
||||
PersonalAccount(
|
||||
this.id,
|
||||
this.authenticationType,
|
||||
{
|
||||
required this.isSelected,
|
||||
this.accountId,
|
||||
this.apiUrl,
|
||||
this.userName
|
||||
}
|
||||
);
|
||||
|
||||
@@ -25,6 +28,7 @@ class Account with EquatableMixin {
|
||||
authenticationType,
|
||||
isSelected,
|
||||
accountId,
|
||||
apiUrl
|
||||
apiUrl,
|
||||
userName
|
||||
];
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class UserName with EquatableMixin {
|
||||
final String userName;
|
||||
|
||||
UserName(this.userName);
|
||||
|
||||
@override
|
||||
List<Object> get props => [userName];
|
||||
}
|
||||
Reference in New Issue
Block a user