Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyrat committed Feb 21, 2024
1 parent 313a582 commit a28d62a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
6 changes: 3 additions & 3 deletions lib/src/kdbx_meta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ class KeeVaultEmbeddedConfig {
int get hashCode {
return version.hashCode ^
randomId.hashCode ^
addon.hashCode ^
vault.hashCode;
const MapEquality().hash(addon) ^
const MapEquality().hash(vault);
}
}

Expand Down Expand Up @@ -582,7 +582,7 @@ class BrowserDbSettings {
defaultPlaceholderHandling.hashCode ^
displayPriorityField.hashCode ^
displayGlobalPlaceholderOption.hashCode ^
matchedURLAccuracyOverrides.hashCode;
const MapEquality().hash(matchedURLAccuracyOverrides);
}
}

Expand Down
12 changes: 6 additions & 6 deletions lib/src/kee_vault_model/browser_entry_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class BrowserEntrySettings {
return o is BrowserEntrySettings &&
o.version == version &&
o.behaviour == behaviour &&
o.authenticationMethods == authenticationMethods &&
unOrdDeepEq(o.authenticationMethods, authenticationMethods) &&
o.realm == realm &&
unOrdDeepEq(o.matcherConfigs, matcherConfigs) &&
unOrdDeepEq(o.includeUrls, includeUrls) &&
Expand All @@ -206,11 +206,11 @@ class BrowserEntrySettings {
int get hashCode {
return version.hashCode ^
behaviour.hashCode ^
authenticationMethods.hashCode ^
const ListEquality().hash(authenticationMethods) ^
realm.hashCode ^
const ListEquality().hash(matcherConfigs) ^ //TODO: all other lists?
includeUrls.hashCode ^
excludeUrls.hashCode ^
fields.hashCode;
const ListEquality().hash(matcherConfigs) ^
const ListEquality().hash(includeUrls) ^
const ListEquality().hash(excludeUrls) ^
const ListEquality().hash(fields);
}
}
6 changes: 3 additions & 3 deletions lib/src/kee_vault_model/browser_entry_settings_v1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ class BrowserEntrySettingsV1 {
priority.hashCode ^
hide.hashCode ^
realm.hashCode ^
includeUrls.hashCode ^
excludeUrls.hashCode ^
fields.hashCode;
const ListEquality().hash(includeUrls) ^
const ListEquality().hash(excludeUrls) ^
const ListEquality().hash(fields);
}

BrowserEntrySettings convertToV2(IGuidService guidService) {
Expand Down
10 changes: 6 additions & 4 deletions lib/src/kee_vault_model/entry_matcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ class EntryMatcher {
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
final listEquals = const DeepCollectionEquality().equals;
final unOrdDeepEq = const DeepCollectionEquality.unordered().equals;

return other is EntryMatcher &&
other.matchLogic == matchLogic &&
listEquals(other.queries, queries) &&
listEquals(other.pageTitles, pageTitles);
unOrdDeepEq(other.queries, queries) &&
unOrdDeepEq(other.pageTitles, pageTitles);
}

@override
int get hashCode {
return matchLogic.hashCode ^ queries.hashCode ^ pageTitles.hashCode;
return matchLogic.hashCode ^
const ListEquality().hash(queries) ^
const ListEquality().hash(pageTitles);
}

MatcherLogic? matchLogic; // default to Client initially
Expand Down
6 changes: 3 additions & 3 deletions lib/src/kee_vault_model/field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Field {
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
final listEquals = const DeepCollectionEquality().equals;
final unOrdDeepEq = const DeepCollectionEquality.unordered().equals;

return other is Field &&
other.uuid == uuid &&
Expand All @@ -99,7 +99,7 @@ class Field {
other.page == page &&
other.type == type &&
other.placeholderHandling == placeholderHandling &&
listEquals(other.matcherConfigs, matcherConfigs);
unOrdDeepEq(other.matcherConfigs, matcherConfigs);
}

@override
Expand All @@ -111,7 +111,7 @@ class Field {
page.hashCode ^
type.hashCode ^
placeholderHandling.hashCode ^
matcherConfigs.hashCode;
const ListEquality().hash(matcherConfigs);
}

String? uuid;
Expand Down
12 changes: 6 additions & 6 deletions lib/src/kee_vault_model/field_matcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ class FieldMatcher {
@override
int get hashCode {
return matchLogic.hashCode ^
ids.hashCode ^
names.hashCode ^
types.hashCode ^
queries.hashCode ^
labels.hashCode ^
autocompleteValues.hashCode ^
const ListEquality().hash(ids) ^
const ListEquality().hash(names) ^
const ListEquality().hash(types) ^
const ListEquality().hash(queries) ^
const ListEquality().hash(labels) ^
const ListEquality().hash(autocompleteValues) ^
maxLength.hashCode ^
minLength.hashCode;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: kdbx
description: KeepassX format implementation in pure dart. (kdbx 3.x and 4.x support).
version: 0.6.0+2
version: 0.6.0+3
homepage: https://github.com/kee-org/kdbx.dart
publish_to: none

Expand Down

0 comments on commit a28d62a

Please sign in to comment.