Skip to content

Commit

Permalink
Merge PR Yubico#1346.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamVe committed Jan 24, 2024
2 parents ab6d44d + 6597bf5 commit 2843066
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 49 deletions.
10 changes: 5 additions & 5 deletions lib/app/models.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class _$YubiKeyDataImpl implements _YubiKeyData {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$YubiKeyDataImpl &&
Expand Down Expand Up @@ -363,7 +363,7 @@ class _$UsbYubiKeyNodeImpl extends UsbYubiKeyNode {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UsbYubiKeyNodeImpl &&
Expand Down Expand Up @@ -523,7 +523,7 @@ class _$NfcReaderNodeImpl extends NfcReaderNode {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NfcReaderNodeImpl &&
Expand Down Expand Up @@ -844,7 +844,7 @@ class _$ActionItemImpl implements _ActionItem {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ActionItemImpl &&
Expand Down Expand Up @@ -1043,7 +1043,7 @@ class _$WindowStateImpl implements _WindowState {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$WindowStateImpl &&
Expand Down
2 changes: 1 addition & 1 deletion lib/core/models.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class _$VersionImpl extends _Version {
final int patch;

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$VersionImpl &&
Expand Down
4 changes: 2 additions & 2 deletions lib/management/models.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class _$DeviceConfigImpl implements _DeviceConfig {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DeviceConfigImpl &&
Expand Down Expand Up @@ -475,7 +475,7 @@ class _$DeviceInfoImpl implements _DeviceInfo {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DeviceInfoImpl &&
Expand Down
24 changes: 14 additions & 10 deletions lib/oath/models.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Yubico.
* Copyright (C) 2022-2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -65,20 +65,24 @@ class OathCredential with _$OathCredential {
factory OathCredential(
String deviceId,
String id,
String? issuer,
@_IssuerConverter() String? issuer,
String name,
OathType oathType,
int period,
bool touchRequired) = _OathCredential;

factory OathCredential.fromJson(Map<String, dynamic> json) {
final value = _$OathCredentialFromJson(json);
// Replace empty issuer string with null
return switch (value.issuer) {
(String issuer) when issuer.isEmpty => value.copyWith(issuer: null),
_ => value,
};
}
factory OathCredential.fromJson(Map<String, dynamic> json) =>
_$OathCredentialFromJson(json);
}

class _IssuerConverter implements JsonConverter<String?, String?> {
const _IssuerConverter();

@override
String? fromJson(String? json) => json != null && json.isEmpty ? null : json;

@override
String? toJson(String? object) => object;
}

@freezed
Expand Down
23 changes: 13 additions & 10 deletions lib/oath/models.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OathCredential _$OathCredentialFromJson(Map<String, dynamic> json) {
mixin _$OathCredential {
String get deviceId => throw _privateConstructorUsedError;
String get id => throw _privateConstructorUsedError;
@_IssuerConverter()
String? get issuer => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
OathType get oathType => throw _privateConstructorUsedError;
Expand All @@ -43,7 +44,7 @@ abstract class $OathCredentialCopyWith<$Res> {
$Res call(
{String deviceId,
String id,
String? issuer,
@_IssuerConverter() String? issuer,
String name,
OathType oathType,
int period,
Expand Down Expand Up @@ -115,7 +116,7 @@ abstract class _$$OathCredentialImplCopyWith<$Res>
$Res call(
{String deviceId,
String id,
String? issuer,
@_IssuerConverter() String? issuer,
String name,
OathType oathType,
int period,
Expand Down Expand Up @@ -177,8 +178,8 @@ class __$$OathCredentialImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$OathCredentialImpl implements _OathCredential {
_$OathCredentialImpl(this.deviceId, this.id, this.issuer, this.name,
this.oathType, this.period, this.touchRequired);
_$OathCredentialImpl(this.deviceId, this.id, @_IssuerConverter() this.issuer,
this.name, this.oathType, this.period, this.touchRequired);

factory _$OathCredentialImpl.fromJson(Map<String, dynamic> json) =>
_$$OathCredentialImplFromJson(json);
Expand All @@ -188,6 +189,7 @@ class _$OathCredentialImpl implements _OathCredential {
@override
final String id;
@override
@_IssuerConverter()
final String? issuer;
@override
final String name;
Expand All @@ -204,7 +206,7 @@ class _$OathCredentialImpl implements _OathCredential {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OathCredentialImpl &&
Expand Down Expand Up @@ -244,7 +246,7 @@ abstract class _OathCredential implements OathCredential {
factory _OathCredential(
final String deviceId,
final String id,
final String? issuer,
@_IssuerConverter() final String? issuer,
final String name,
final OathType oathType,
final int period,
Expand All @@ -258,6 +260,7 @@ abstract class _OathCredential implements OathCredential {
@override
String get id;
@override
@_IssuerConverter()
String? get issuer;
@override
String get name;
Expand Down Expand Up @@ -395,7 +398,7 @@ class _$OathCodeImpl implements _OathCode {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OathCodeImpl &&
Expand Down Expand Up @@ -580,7 +583,7 @@ class _$OathPairImpl implements _OathPair {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OathPairImpl &&
Expand Down Expand Up @@ -814,7 +817,7 @@ class _$OathStateImpl implements _OathState {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OathStateImpl &&
Expand Down Expand Up @@ -1094,7 +1097,7 @@ class _$CredentialDataImpl extends _CredentialData {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CredentialDataImpl &&
Expand Down
4 changes: 2 additions & 2 deletions lib/oath/models.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions lib/piv/models.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _$PinMetadataImpl implements _PinMetadata {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PinMetadataImpl &&
Expand Down Expand Up @@ -276,7 +276,7 @@ class _$PinSuccessImpl implements _PinSuccess {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PinSuccessImpl);
}
Expand Down Expand Up @@ -396,7 +396,7 @@ class _$PinFailureImpl implements _PinFailure {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PinFailureImpl &&
Expand Down Expand Up @@ -615,7 +615,7 @@ class _$ManagementKeyMetadataImpl implements _ManagementKeyMetadata {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ManagementKeyMetadataImpl &&
Expand Down Expand Up @@ -827,7 +827,7 @@ class _$SlotMetadataImpl implements _SlotMetadata {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SlotMetadataImpl &&
Expand Down Expand Up @@ -1057,7 +1057,7 @@ class _$PivStateMetadataImpl implements _PivStateMetadata {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PivStateMetadataImpl &&
Expand Down Expand Up @@ -1350,7 +1350,7 @@ class _$PivStateImpl extends _PivState {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PivStateImpl &&
Expand Down Expand Up @@ -1604,7 +1604,7 @@ class _$CertInfoImpl implements _CertInfo {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CertInfoImpl &&
Expand Down Expand Up @@ -1805,7 +1805,7 @@ class _$PivSlotImpl implements _PivSlot {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PivSlotImpl &&
Expand Down Expand Up @@ -2015,7 +2015,7 @@ class _$ExamineResultImpl implements _ExamineResult {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ExamineResultImpl &&
Expand Down Expand Up @@ -2161,7 +2161,7 @@ class _$InvalidPasswordImpl implements _InvalidPassword {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$InvalidPasswordImpl);
}
Expand Down Expand Up @@ -2398,7 +2398,7 @@ class _$GenerateCertificateImpl implements _GenerateCertificate {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$GenerateCertificateImpl &&
Expand Down Expand Up @@ -2548,7 +2548,7 @@ class _$GenerateCsrImpl implements _GenerateCsr {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$GenerateCsrImpl &&
Expand Down Expand Up @@ -2768,7 +2768,7 @@ class _$PivGenerateResultImpl implements _PivGenerateResult {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PivGenerateResultImpl &&
Expand Down Expand Up @@ -2962,7 +2962,7 @@ class _$PivImportResultImpl implements _PivImportResult {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PivImportResultImpl &&
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies:
shared_preferences: ^2.2.2
flutter_riverpod: ^2.4.9
json_annotation: ^4.8.1
freezed_annotation: ^2.2.0
freezed_annotation: ^2.4.1
window_manager: ^0.3.7
qrscanner_zxing:
path: android/flutter_plugins/qrscanner_zxing
Expand Down Expand Up @@ -83,9 +83,9 @@ dev_dependencies:
# rules and activating additional ones.
flutter_lints: ^3.0.1

build_runner: ^2.4.7
freezed: ^2.4.5
json_serializable: ^6.7.0
build_runner: ^2.4.8
freezed: ^2.4.6
json_serializable: ^6.7.1
analyzer:
analyzer_plugin:
custom_lint_builder:
Expand Down

0 comments on commit 2843066

Please sign in to comment.