Skip to content

Commit

Permalink
Merge pull request #1421 from elliotsayes/PE-4727-meta-mask-login
Browse files Browse the repository at this point in the history
[WIP] Fixes for PE-4727 meta mask login
  • Loading branch information
thiagocarvalhodev authored Oct 17, 2023
2 parents 6e53031 + 79b54ac commit 6f1f3ac
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
7 changes: 1 addition & 6 deletions lib/authentication/login/blocs/login_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,6 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
await _arDriveAuth.logout();
}

if (_isArConnectWallet()) {
await _arConnectService.disconnect();
}

emit(LoginInitial(_arConnectService.isExtensionPresent(),
_ethereumProviderService.isExtensionPresent()));
}
Expand Down Expand Up @@ -477,8 +473,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
final wallet = event.wallet;

profileType = ProfileType.json;
// Wallet could be from Ethereum or Arweave wallet file
// profileSource = ProfileSource(type: ProfileSourceType.arweaveKey);
// Wallet could be from Ethereum or Arweave wallet file, so don't set profileSource

try {
if (await _arDriveAuth.userHasPassword(wallet)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/authentication/login/views/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class _LoginPageScaffoldState extends State<LoginPageScaffold> {
content = PromptWalletView(
key: const Key('promptWalletView'),
isArConnectAvailable: (state as LoginInitial).isArConnectAvailable,
isEthereumProviderAvailable: (state).isEthereumProviderAvailable,
isEthereumProviderAvailable: state.isEthereumProviderAvailable,
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/blocs/profile/profile_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class ProfileCubit extends Cubit<ProfileState> {
}();

final profileSource = ProfileSource(
type: ProfileSourceType.values[profile.details.profileSourceType ?? 0],
type: ProfileSourceType.values[profile.details.profileSourceType],
address: profile.details.profileSourceAddress,
);

Expand Down
1 change: 1 addition & 0 deletions lib/components/profile_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class _ProfileCardState extends State<ProfileCard> {
children: [
SizedBox(
child: Text(
// TODO: localize?
'AR:',
style: ArDriveTypography.body.captionRegular().copyWith(
fontWeight: FontWeight.w600,
Expand Down
2 changes: 1 addition & 1 deletion lib/models/tables/profiles.drift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ CREATE TABLE profiles (
profileType INTEGER NOT NULL,

-- Added in schema v18
profileSourceType INTEGER,
profileSourceType INTEGER NOT NULL DEFAULT 0,
profileSourceAddress TEXT
);
4 changes: 2 additions & 2 deletions lib/user/repositories/user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class _UserRepository implements UserRepository {
final user = User(
profileType: ProfileType.values[profileDetails.details.profileType],
profileSource: ProfileSource(
type: ProfileSourceType
.values[profileDetails.details.profileSourceType ?? 0],
type:
ProfileSourceType.values[profileDetails.details.profileSourceType],
address: profileDetails.details.walletPublicKey,
),
wallet: profileDetails.wallet,
Expand Down
4 changes: 4 additions & 0 deletions test/user/repositories/user_repository_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void main() {
encryptedWallet: Uint8List.fromList([]),
keySalt: Uint8List.fromList([]),
profileType: 0, //json
profileSourceType: 0, //standalone
username: '',
walletPublicKey: '',
id: 'id',
Expand All @@ -61,6 +62,7 @@ void main() {
encryptedWallet: Uint8List.fromList([]),
keySalt: Uint8List.fromList([]),
profileType: 0, //json
profileSourceType: 0, //standalone
username: '',
walletPublicKey: '',
id: 'id',
Expand Down Expand Up @@ -113,6 +115,7 @@ void main() {
encryptedWallet: Uint8List.fromList([]),
keySalt: Uint8List.fromList([]),
profileType: 0, //json
profileSourceType: 0, //standalone
username: '',
walletPublicKey: '',
id: 'id',
Expand Down Expand Up @@ -176,6 +179,7 @@ void main() {
encryptedWallet: Uint8List.fromList([]),
keySalt: Uint8List.fromList([]),
profileType: 0, //json
profileSourceType: 0, //standalone
username: '',
walletPublicKey: '',
id: 'id',
Expand Down

0 comments on commit 6f1f3ac

Please sign in to comment.