Skip to content

Commit

Permalink
changes for customizer
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmer committed Oct 28, 2024
1 parent 034b7e3 commit 2344f96
Show file tree
Hide file tree
Showing 20 changed files with 201 additions and 90 deletions.
4 changes: 2 additions & 2 deletions lib/api/impl/privacy_idea_container_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ import '../../utils/logger.dart';
import '../../widgets/dialog_widgets/enter_passphrase_dialog.dart';
import '../interfaces/container_api.dart';

class PrivacyIdeaContainerApi implements ContainerApi {
class PiContainerApi implements TokenContainerApi {
final PrivacyideaIOClient _ioClient;
const PrivacyIdeaContainerApi({required PrivacyideaIOClient ioClient}) : _ioClient = ioClient;
const PiContainerApi({required PrivacyideaIOClient ioClient}) : _ioClient = ioClient;

// Returns a tuple of updated/new tokens and serials of deleted tokens
@override
Expand Down
2 changes: 1 addition & 1 deletion lib/api/interfaces/container_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import '../../model/token_container.dart';
import '../../model/tokens/token.dart';
import '../../utils/ecc_utils.dart';

abstract class ContainerApi {
abstract class TokenContainerApi {
Future<Response> finalizeContainer(TokenContainerUnfinalized container, EccUtils eccUtils);
Future<String> getTransferQrData(TokenContainerFinalized container);
Future<(List<Token>, List<String>)?> sync(TokenContainerFinalized container, TokenState tokenState);
Expand Down
27 changes: 0 additions & 27 deletions lib/interfaces/api_endpoint.dart

This file was deleted.

62 changes: 43 additions & 19 deletions lib/model/riverpod_states/progress_state.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,22 @@ mixin _$ProgressState {
/// Create a copy of ProgressState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProgressStateCopyWith<ProgressState> get copyWith => throw _privateConstructorUsedError;
$ProgressStateCopyWith<ProgressState> get copyWith =>
throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ProgressStateCopyWith<$Res> {
factory $ProgressStateCopyWith(ProgressState value, $Res Function(ProgressState) then) = _$ProgressStateCopyWithImpl<$Res, ProgressState>;
factory $ProgressStateCopyWith(
ProgressState value, $Res Function(ProgressState) then) =
_$ProgressStateCopyWithImpl<$Res, ProgressState>;
@useResult
$Res call({int max, int value});
}

/// @nodoc
class _$ProgressStateCopyWithImpl<$Res, $Val extends ProgressState> implements $ProgressStateCopyWith<$Res> {
class _$ProgressStateCopyWithImpl<$Res, $Val extends ProgressState>
implements $ProgressStateCopyWith<$Res> {
_$ProgressStateCopyWithImpl(this._value, this._then);

// ignore: unused_field
Expand Down Expand Up @@ -101,18 +105,24 @@ class _$ProgressStateCopyWithImpl<$Res, $Val extends ProgressState> implements $
}

/// @nodoc
abstract class _$$ProgressStateUninitializedImplCopyWith<$Res> implements $ProgressStateCopyWith<$Res> {
factory _$$ProgressStateUninitializedImplCopyWith(_$ProgressStateUninitializedImpl value, $Res Function(_$ProgressStateUninitializedImpl) then) =
abstract class _$$ProgressStateUninitializedImplCopyWith<$Res>
implements $ProgressStateCopyWith<$Res> {
factory _$$ProgressStateUninitializedImplCopyWith(
_$ProgressStateUninitializedImpl value,
$Res Function(_$ProgressStateUninitializedImpl) then) =
__$$ProgressStateUninitializedImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int max, int value});
}

/// @nodoc
class __$$ProgressStateUninitializedImplCopyWithImpl<$Res> extends _$ProgressStateCopyWithImpl<$Res, _$ProgressStateUninitializedImpl>
class __$$ProgressStateUninitializedImplCopyWithImpl<$Res>
extends _$ProgressStateCopyWithImpl<$Res, _$ProgressStateUninitializedImpl>
implements _$$ProgressStateUninitializedImplCopyWith<$Res> {
__$$ProgressStateUninitializedImplCopyWithImpl(_$ProgressStateUninitializedImpl _value, $Res Function(_$ProgressStateUninitializedImpl) _then)
__$$ProgressStateUninitializedImplCopyWithImpl(
_$ProgressStateUninitializedImpl _value,
$Res Function(_$ProgressStateUninitializedImpl) _then)
: super(_value, _then);

/// Create a copy of ProgressState
Expand All @@ -139,7 +149,8 @@ class __$$ProgressStateUninitializedImplCopyWithImpl<$Res> extends _$ProgressSta
/// @nodoc
class _$ProgressStateUninitializedImpl extends ProgressStateUninitialized {
const _$ProgressStateUninitializedImpl({this.max = 0, this.value = 0}) : super._();
const _$ProgressStateUninitializedImpl({this.max = 0, this.value = 0})
: super._();

@override
@JsonKey()
Expand Down Expand Up @@ -170,8 +181,9 @@ class _$ProgressStateUninitializedImpl extends ProgressStateUninitialized {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProgressStateUninitializedImplCopyWith<_$ProgressStateUninitializedImpl> get copyWith =>
__$$ProgressStateUninitializedImplCopyWithImpl<_$ProgressStateUninitializedImpl>(this, _$identity);
_$$ProgressStateUninitializedImplCopyWith<_$ProgressStateUninitializedImpl>
get copyWith => __$$ProgressStateUninitializedImplCopyWithImpl<
_$ProgressStateUninitializedImpl>(this, _$identity);

@override
@optionalTypeArgs
Expand Down Expand Up @@ -237,7 +249,8 @@ class _$ProgressStateUninitializedImpl extends ProgressStateUninitialized {
}

abstract class ProgressStateUninitialized extends ProgressState {
const factory ProgressStateUninitialized({final int max, final int value}) = _$ProgressStateUninitializedImpl;
const factory ProgressStateUninitialized({final int max, final int value}) =
_$ProgressStateUninitializedImpl;
const ProgressStateUninitialized._() : super._();

@override
Expand All @@ -249,20 +262,28 @@ abstract class ProgressStateUninitialized extends ProgressState {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProgressStateUninitializedImplCopyWith<_$ProgressStateUninitializedImpl> get copyWith => throw _privateConstructorUsedError;
_$$ProgressStateUninitializedImplCopyWith<_$ProgressStateUninitializedImpl>
get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ProgressStateImplCopyWith<$Res> implements $ProgressStateCopyWith<$Res> {
factory _$$ProgressStateImplCopyWith(_$ProgressStateImpl value, $Res Function(_$ProgressStateImpl) then) = __$$ProgressStateImplCopyWithImpl<$Res>;
abstract class _$$ProgressStateImplCopyWith<$Res>
implements $ProgressStateCopyWith<$Res> {
factory _$$ProgressStateImplCopyWith(
_$ProgressStateImpl value, $Res Function(_$ProgressStateImpl) then) =
__$$ProgressStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int max, int value});
}

/// @nodoc
class __$$ProgressStateImplCopyWithImpl<$Res> extends _$ProgressStateCopyWithImpl<$Res, _$ProgressStateImpl> implements _$$ProgressStateImplCopyWith<$Res> {
__$$ProgressStateImplCopyWithImpl(_$ProgressStateImpl _value, $Res Function(_$ProgressStateImpl) _then) : super(_value, _then);
class __$$ProgressStateImplCopyWithImpl<$Res>
extends _$ProgressStateCopyWithImpl<$Res, _$ProgressStateImpl>
implements _$$ProgressStateImplCopyWith<$Res> {
__$$ProgressStateImplCopyWithImpl(
_$ProgressStateImpl _value, $Res Function(_$ProgressStateImpl) _then)
: super(_value, _then);

/// Create a copy of ProgressState
/// with the given fields replaced by the non-null parameter values.
Expand Down Expand Up @@ -320,7 +341,8 @@ class _$ProgressStateImpl extends _ProgressState {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProgressStateImplCopyWith<_$ProgressStateImpl> get copyWith => __$$ProgressStateImplCopyWithImpl<_$ProgressStateImpl>(this, _$identity);
_$$ProgressStateImplCopyWith<_$ProgressStateImpl> get copyWith =>
__$$ProgressStateImplCopyWithImpl<_$ProgressStateImpl>(this, _$identity);

@override
@optionalTypeArgs
Expand Down Expand Up @@ -386,7 +408,8 @@ class _$ProgressStateImpl extends _ProgressState {
}

abstract class _ProgressState extends ProgressState {
const factory _ProgressState({required final int max, required final int value}) = _$ProgressStateImpl;
const factory _ProgressState(
{required final int max, required final int value}) = _$ProgressStateImpl;
const _ProgressState._() : super._();

@override
Expand All @@ -398,5 +421,6 @@ abstract class _ProgressState extends ProgressState {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProgressStateImplCopyWith<_$ProgressStateImpl> get copyWith => throw _privateConstructorUsedError;
_$$ProgressStateImplCopyWith<_$ProgressStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}

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

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

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

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import 'package:basic_utils/basic_utils.dart';
import 'package:collection/collection.dart';
import 'package:http/http.dart';
import 'package:mutex/mutex.dart';
import 'package:privacyidea_authenticator/model/extensions/enums/rollout_state_extension.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

import '../../../../../../../model/exception_errors/pi_server_result_error.dart';
import '../../../../../../../model/extensions/enums/rollout_state_extension.dart';
import '../../../../../../../model/processor_result.dart';
import '../../../../../../../model/tokens/token.dart';
import '../../../../../../../utils/globals.dart';
Expand Down Expand Up @@ -57,7 +57,7 @@ part 'token_container_notifier.g.dart';

final tokenContainerProvider = tokenContainerNotifierProviderOf(
repo: SecureTokenContainerRepository(),
containerApi: const PrivacyIdeaContainerApi(ioClient: PrivacyideaIOClient()),
containerApi: const PiContainerApi(ioClient: PrivacyideaIOClient()),
eccUtils: const EccUtils(),
);

Expand All @@ -68,7 +68,7 @@ class TokenContainerNotifier extends _$TokenContainerNotifier with ResultHandler

TokenContainerNotifier({
TokenContainerRepository? repoOverride,
ContainerApi? containerApiOverride,
TokenContainerApi? containerApiOverride,
EccUtils? eccUtilsOverride,
}) : _repoOverride = repoOverride,
_containerApiOverride = containerApiOverride,
Expand All @@ -80,9 +80,9 @@ class TokenContainerNotifier extends _$TokenContainerNotifier with ResultHandler
final TokenContainerRepository? _repoOverride;

@override
PrivacyIdeaContainerApi get containerApi => _containerApi;
late PrivacyIdeaContainerApi _containerApi;
final PrivacyIdeaContainerApi? _containerApiOverride;
TokenContainerApi get containerApi => _containerApi;
late TokenContainerApi _containerApi;
final TokenContainerApi? _containerApiOverride;

@override
EccUtils get eccUtils => _eccUtils;
Expand All @@ -92,7 +92,7 @@ class TokenContainerNotifier extends _$TokenContainerNotifier with ResultHandler
@override
Future<TokenContainerState> build({
required TokenContainerRepository repo,
required PrivacyIdeaContainerApi containerApi,
required TokenContainerApi containerApi,
required EccUtils eccUtils,
}) async {
await _stateMutex.acquire();
Expand Down
Loading

0 comments on commit 2344f96

Please sign in to comment.