Skip to content

Commit

Permalink
fix(cat-voices): equatable lint issue fix (#1280)
Browse files Browse the repository at this point in the history
* fix: resolve equatable lint issue

* fix: missing override
  • Loading branch information
dtscalac authored Nov 27, 2024
1 parent 31d2e8d commit e551c61
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion catalyst_voices/apps/voices/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
path: ../../packages/internal/catalyst_voices_view_models
collection: ^1.18.0
dotted_border: ^2.1.0
equatable: ^2.0.5
equatable: ^2.0.7
file_picker: ^8.0.7
flutter:
sdk: flutter
Expand Down
2 changes: 1 addition & 1 deletion catalyst_voices/melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ command:
cryptography: ^2.7.0
dotted_border: ^2.1.0
ed25519_hd_key: ^2.3.0
equatable: ^2.0.5
equatable: ^2.0.7
ffi: ^2.1.0
ffigen: ^11.0.0
file_picker: ^8.0.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
catalyst_voices_view_models:
path: ../catalyst_voices_view_models
collection: ^1.18.0
equatable: ^2.0.5
equatable: ^2.0.7
flutter:
sdk: flutter
flutter_bloc: ^8.1.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
catalyst_cardano_web: ^0.3.0
collection: ^1.18.0
convert: ^3.1.1
equatable: ^2.0.5
equatable: ^2.0.7
meta: ^1.10.0
password_strength: ^0.2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,4 @@ final class VaultKeychain extends SecureStorageVault implements Keychain {

@override
String toString() => 'VaultKeychain[$id]';

@override
List<Object?> get props => [id];
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ import 'package:catalyst_voices_services/src/crypto/crypto_service.dart';
import 'package:catalyst_voices_services/src/crypto/vault_crypto_service.dart';
import 'package:catalyst_voices_services/src/storage/storage_string_mixin.dart';
import 'package:catalyst_voices_services/src/storage/vault/vault.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';

const _lockKey = 'LockKey';

/// Implementation of [Vault] that uses [FlutterSecureStorage] as
/// facade for read/write operations.
base class SecureStorageVault
with StorageAsStringMixin, EquatableMixin
implements Vault {
base class SecureStorageVault with StorageAsStringMixin implements Vault {
@override
final String id;
@protected
final FlutterSecureStorage secureStorage;
Expand Down Expand Up @@ -171,6 +169,11 @@ base class SecureStorageVault
}
}

@override
String toString() {
return 'SecureStorageVault{id: $id}';
}

/// Allows operation only when [isUnlocked] it true, otherwise returns null.
///
/// Returns value assigned to [key]. May return null if not found for [key].
Expand Down Expand Up @@ -246,7 +249,4 @@ base class SecureStorageVault
void _erase(Uint8List list) {
list.fillRange(0, list.length, 0);
}

@override
List<Object?> get props => [id];
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ import 'package:catalyst_voices_services/src/storage/storage.dart';
///
/// In order to unlock [Vault] sufficient [LockFactor] have to be
/// set via [unlock] that can unlock [LockFactor] from [setLock].
abstract interface class Vault implements Storage, Lockable {}
abstract interface class Vault implements Storage, Lockable {
String get id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies:
convert: ^3.1.1
cryptography: ^2.7.0
ed25519_hd_key: ^2.3.0
equatable: ^2.0.5
equatable: ^2.0.7
flutter:
sdk: flutter
flutter_secure_storage: ^9.2.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ void main() {

// Then
expect(await provider.exists(id), isTrue);
expect([keychain], await provider.getAll());
expect(
[keychain.id],
await provider.getAll().then((value) => value.map((e) => e.id)),
);
});

test('calling create twice on keychain will empty previous data', () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void main() {
);
});

test('are equal when id is matching', () async {
test('are not equal when id is matching', () async {
// Given
final id = const Uuid().v4();

Expand All @@ -77,7 +77,7 @@ void main() {
final vaultTwo = VaultKeychain(id: id);

// Then
expect(vaultOne, equals(vaultTwo));
expect(vaultOne, isNot(equals(vaultTwo)));
});

test('metadata dates are in UTC', () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void main() {
// Then
final currentKeychain = service.keychain;

expect(currentKeychain, keychain);
expect(currentKeychain?.id, keychain.id);
});

test('using different keychain emits update in stream', () async {
Expand All @@ -48,8 +48,8 @@ void main() {
keychainStream,
emitsInOrder([
isNull,
keychainOne,
keychainTwo,
predicate<Keychain>((e) => e.id == keychainOne.id),
predicate<Keychain>((e) => e.id == keychainTwo.id),
isNull,
]),
);
Expand All @@ -75,7 +75,7 @@ void main() {
// Then
final serviceKeychains = await service.keychains;

expect(serviceKeychains, keychains);
expect(serviceKeychains.map((e) => e.id), keychains.map((e) => e.id));
});
});

Expand All @@ -92,7 +92,7 @@ void main() {
await service.useLastAccount();

// Then
expect(service.keychain, expectedKeychain);
expect(service.keychain?.id, expectedKeychain.id);
});

test('use last account does nothing on clear instance', () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
path: ../catalyst_voices_localization
catalyst_voices_models:
path: ../catalyst_voices_models
equatable: ^2.0.5
equatable: ^2.0.7
flutter:
sdk: flutter
formz: ^0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
cbor: ^6.2.0
convert: ^3.1.1
cupertino_icons: ^1.0.6
equatable: ^2.0.5
equatable: ^2.0.7
flutter:
sdk: flutter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:

dependencies:
catalyst_cardano_serialization: ^0.4.0
equatable: ^2.0.5
equatable: ^2.0.7
flutter:
sdk: flutter
plugin_platform_interface: ^2.1.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
cbor: ^6.2.0
convert: ^3.1.1
cryptography: ^2.7.0
equatable: ^2.0.5
equatable: ^2.0.7
pinenacl: ^0.6.0
ulid: ^2.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
flutter: ">=3.24.1"

dependencies:
equatable: ^2.0.5
equatable: ^2.0.7
flutter:
sdk: flutter
plugin_platform_interface: ^2.1.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
cbor: ^6.2.0
convert: ^3.1.1
cryptography: ^2.7.0
equatable: ^2.0.5
equatable: ^2.0.7
flutter:
sdk: flutter
flutter_rust_bridge: 2.5.1
Expand Down

0 comments on commit e551c61

Please sign in to comment.