feat: add card PIN management and card renewal to child wallet
- Add set PIN / change PIN multi-step flow (4-digit card PIN + 6-digit SCA PIN) with Treezor PCI DSS SCA proof generation - Add unblock PIN for blocked cards after failed attempts - Add renew card with SCA proof (same as wallet creation) - Show menu options conditionally based on hasCardPin and isPinBlocked flags - Make ScaPinView configurable with pinLength parameter (default 6) - Add hasCardPin to ChildProfileEntity and isPinBlocked to WalletCardEntity - Add EN/ES localizations for all new screens and messages
This commit is contained in:
@@ -402,6 +402,18 @@ void configureAppRouter() {
|
||||
pageBuilder:
|
||||
const EditChildProfileBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'set-pin',
|
||||
name: 'home_set_card_pin',
|
||||
pageBuilder:
|
||||
const SetCardPinBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'change-pin',
|
||||
name: 'home_change_card_pin',
|
||||
pageBuilder:
|
||||
const ChangeCardPinBuilder().buildPage,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -15,6 +15,7 @@ class ScaPinView extends StatelessWidget {
|
||||
final VoidCallback onSubmit;
|
||||
final String clearPinText;
|
||||
final String? errorMessage;
|
||||
final int pinLength;
|
||||
|
||||
const ScaPinView({
|
||||
super.key,
|
||||
@@ -30,6 +31,7 @@ class ScaPinView extends StatelessWidget {
|
||||
required this.onSubmit,
|
||||
required this.clearPinText,
|
||||
this.errorMessage,
|
||||
this.pinLength = 6,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -49,7 +51,7 @@ class ScaPinView extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 44),
|
||||
_PinDots(length: pin.length, max: 6),
|
||||
_PinDots(length: pin.length, max: pinLength),
|
||||
const SizedBox(width: 12),
|
||||
SizedBox(
|
||||
width: 44,
|
||||
|
||||
@@ -8,3 +8,5 @@ export 'src/features/limits/limits_builder.dart';
|
||||
export 'src/features/goals/goals_builder.dart';
|
||||
export 'src/features/extract/extract_builder.dart';
|
||||
export 'src/features/edit_child_profile/edit_child_profile_builder.dart';
|
||||
export 'src/features/card_pin/card_pin_builder.dart';
|
||||
export 'src/features/card_pin/card_pin_view_state.dart';
|
||||
|
||||
41
modules/home/lib/src/features/card_pin/card_pin_builder.dart
Normal file
41
modules/home/lib/src/features/card_pin/card_pin_builder.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
|
||||
import 'card_pin_screen.dart';
|
||||
import 'card_pin_view_state.dart';
|
||||
|
||||
class SetCardPinBuilder {
|
||||
const SetCardPinBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final childWalletId = state.pathParameters['childWalletId'] ?? '';
|
||||
final navigationContract = GetIt.I<NavigationContract>();
|
||||
return MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: CardPinScreen(
|
||||
childId: childWalletId,
|
||||
navigation: navigationContract,
|
||||
mode: CardPinMode.set,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ChangeCardPinBuilder {
|
||||
const ChangeCardPinBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final childWalletId = state.pathParameters['childWalletId'] ?? '';
|
||||
final navigationContract = GetIt.I<NavigationContract>();
|
||||
return MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: CardPinScreen(
|
||||
childId: childWalletId,
|
||||
navigation: navigationContract,
|
||||
mode: CardPinMode.change,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
136
modules/home/lib/src/features/card_pin/card_pin_screen.dart
Normal file
136
modules/home/lib/src/features/card_pin/card_pin_screen.dart
Normal file
@@ -0,0 +1,136 @@
|
||||
import 'package:auth/auth.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
import 'card_pin_view_model.dart';
|
||||
import 'card_pin_view_state.dart';
|
||||
|
||||
class CardPinScreen extends ConsumerWidget {
|
||||
final String childId;
|
||||
final NavigationContract navigation;
|
||||
final CardPinMode mode;
|
||||
|
||||
const CardPinScreen({
|
||||
super.key,
|
||||
required this.childId,
|
||||
required this.navigation,
|
||||
required this.mode,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final arg = (childId, mode);
|
||||
final viewState = ref.watch(cardPinViewModelProvider(arg));
|
||||
final viewModel = ref.read(cardPinViewModelProvider(arg).notifier);
|
||||
|
||||
ref.listen(cardPinViewModelProvider(arg), (prev, next) {
|
||||
if (next.success && !(prev?.success ?? false)) {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: context.translate(I18n.cardPinSuccess),
|
||||
type: MessageType.success,
|
||||
);
|
||||
navigation.goBack();
|
||||
return;
|
||||
}
|
||||
if (next.errorMessage.isNotEmpty &&
|
||||
next.errorMessage != (prev?.errorMessage ?? '')) {
|
||||
if (next.errorMessage == 'cardPinMismatch') {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: context.translate(I18n.cardPinMismatch),
|
||||
type: MessageType.error,
|
||||
);
|
||||
} else {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: context.translate(I18n.cardPinError),
|
||||
type: MessageType.error,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (viewState.isLoading) {
|
||||
return const Scaffold(body: Center(child: AppLoadingIndicator()));
|
||||
}
|
||||
|
||||
if (viewState.errorMessage.isNotEmpty && viewState.childProfile == null) {
|
||||
return Scaffold(
|
||||
body: Center(child: Text('Error: ${viewState.errorMessage}')),
|
||||
);
|
||||
}
|
||||
|
||||
final pinLength = viewState.step == CardPinStep.scaPin ? 6 : 4;
|
||||
final stepTitle = _stepTitle(context, viewState.step);
|
||||
final currentPin = switch (viewState.step) {
|
||||
CardPinStep.currentPin => viewState.currentPin,
|
||||
CardPinStep.newPin => viewState.newPin,
|
||||
CardPinStep.confirmPin => viewState.confirmPin,
|
||||
CardPinStep.scaPin => viewState.scaPin,
|
||||
};
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
appBar: AppBar(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
onPressed: () {
|
||||
if (viewModel.isFirstStep) {
|
||||
navigation.goBack();
|
||||
} else {
|
||||
viewModel.goBack();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: ScaPinView(
|
||||
title: stepTitle,
|
||||
pin: currentPin,
|
||||
pinLength: pinLength,
|
||||
isProcessing: viewState.isSigning || viewState.isSubmitting,
|
||||
processingText: context.translate(I18n.scaSigning),
|
||||
canSubmit: viewModel.canSubmitStep,
|
||||
submitText: viewState.step == CardPinStep.scaPin
|
||||
? context.translate(I18n.scaConnect)
|
||||
: context.translate(I18n.cardPinNext),
|
||||
clearPinText: context.translate(I18n.scaClearPin),
|
||||
onDigitPressed: viewModel.onDigitPressed,
|
||||
onBackspacePressed: viewModel.onBackspacePressed,
|
||||
onClearPin: viewModel.onClearPin,
|
||||
onSubmit: viewModel.onStepSubmit,
|
||||
),
|
||||
),
|
||||
),
|
||||
SafeArea(
|
||||
child: TextButton(
|
||||
onPressed: () => navigation.goBack(),
|
||||
child: Text(context.translate(I18n.cancel)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _stepTitle(BuildContext context, CardPinStep step) {
|
||||
return switch (step) {
|
||||
CardPinStep.currentPin => context.translate(I18n.cardPinCurrentStep),
|
||||
CardPinStep.newPin => context.translate(I18n.cardPinNewStep),
|
||||
CardPinStep.confirmPin => context.translate(I18n.cardPinConfirmStep),
|
||||
CardPinStep.scaPin => context.translate(I18n.cardPinScaStep),
|
||||
};
|
||||
}
|
||||
}
|
||||
257
modules/home/lib/src/features/card_pin/card_pin_view_model.dart
Normal file
257
modules/home/lib/src/features/card_pin/card_pin_view_model.dart
Normal file
@@ -0,0 +1,257 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:sca_treezor/sca_treezor.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
import '../child_wallet/child_data_provider.dart';
|
||||
import 'card_pin_view_state.dart';
|
||||
|
||||
final cardPinViewModelProvider = NotifierProvider.autoDispose
|
||||
.family<CardPinViewModel, CardPinViewState, (String, CardPinMode)>(
|
||||
CardPinViewModel.new,
|
||||
);
|
||||
|
||||
class CardPinViewModel extends Notifier<CardPinViewState> {
|
||||
final (String, CardPinMode) arg;
|
||||
CardPinViewModel(this.arg);
|
||||
|
||||
String get childId => arg.$1;
|
||||
CardPinMode get mode => arg.$2;
|
||||
|
||||
late final TreezorWalletConnectionService _connectionService;
|
||||
late final TreezorWalletSignatureService _signatureService;
|
||||
|
||||
@override
|
||||
CardPinViewState build() {
|
||||
debugPrint('[CardPIN] build() mode=$mode childId=$childId');
|
||||
_connectionService = GetIt.I<TreezorWalletConnectionService>();
|
||||
_signatureService = GetIt.I<TreezorWalletSignatureService>();
|
||||
|
||||
ref.listen(childDataProvider(childId), (prev, next) {
|
||||
state = state.copyWith(
|
||||
isLoading: next.isLoading,
|
||||
childProfile: next.childProfile,
|
||||
childWallet: next.childWallet,
|
||||
device: next.device,
|
||||
errorMessage: next.errorMessage,
|
||||
);
|
||||
if (next.childProfile != null &&
|
||||
prev?.childProfile == null &&
|
||||
state.cardId.isEmpty) {
|
||||
_loadCard(next.childProfile!.walletId);
|
||||
}
|
||||
});
|
||||
|
||||
final data = ref.read(childDataProvider(childId));
|
||||
final initialStep =
|
||||
mode == CardPinMode.change ? CardPinStep.currentPin : CardPinStep.newPin;
|
||||
|
||||
final initialState = CardPinViewState(
|
||||
isLoading: data.isLoading,
|
||||
childProfile: data.childProfile,
|
||||
childWallet: data.childWallet,
|
||||
device: data.device,
|
||||
errorMessage: data.errorMessage,
|
||||
step: initialStep,
|
||||
);
|
||||
|
||||
if (data.childProfile != null) {
|
||||
Future.microtask(() => _loadCard(data.childProfile!.walletId));
|
||||
}
|
||||
|
||||
return initialState;
|
||||
}
|
||||
|
||||
Future<void> _loadCard(String walletId) async {
|
||||
debugPrint('[CardPIN] _loadCard walletId=$walletId');
|
||||
try {
|
||||
final card =
|
||||
await ref.read(treezorRepositoryProvider).getCard(walletId: walletId);
|
||||
if (!ref.mounted) return;
|
||||
debugPrint('[CardPIN] _loadCard cardId=${card.cardId} status=${card.status}');
|
||||
state = state.copyWith(cardId: card.cardId.toString());
|
||||
} catch (e) {
|
||||
debugPrint('[CardPIN] _loadCard error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
String _currentStepPin() => switch (state.step) {
|
||||
CardPinStep.currentPin => state.currentPin,
|
||||
CardPinStep.newPin => state.newPin,
|
||||
CardPinStep.confirmPin => state.confirmPin,
|
||||
CardPinStep.scaPin => state.scaPin,
|
||||
};
|
||||
|
||||
int get _currentStepMaxLength =>
|
||||
state.step == CardPinStep.scaPin ? 6 : 4;
|
||||
|
||||
void onDigitPressed(String digit) {
|
||||
final current = _currentStepPin();
|
||||
if (current.length >= _currentStepMaxLength) return;
|
||||
final updated = current + digit;
|
||||
state = _updateStepPin(updated).copyWith(errorMessage: '');
|
||||
}
|
||||
|
||||
void onBackspacePressed() {
|
||||
final current = _currentStepPin();
|
||||
if (current.isEmpty) return;
|
||||
state = _updateStepPin(current.substring(0, current.length - 1));
|
||||
}
|
||||
|
||||
void onClearPin() {
|
||||
state = _updateStepPin('');
|
||||
}
|
||||
|
||||
CardPinViewState _updateStepPin(String value) => switch (state.step) {
|
||||
CardPinStep.currentPin => state.copyWith(currentPin: value),
|
||||
CardPinStep.newPin => state.copyWith(newPin: value),
|
||||
CardPinStep.confirmPin => state.copyWith(confirmPin: value),
|
||||
CardPinStep.scaPin => state.copyWith(scaPin: value),
|
||||
};
|
||||
|
||||
bool get canSubmitStep => _currentStepPin().length == _currentStepMaxLength;
|
||||
|
||||
void onStepSubmit() {
|
||||
debugPrint('[CardPIN] onStepSubmit step=${state.step}');
|
||||
switch (state.step) {
|
||||
case CardPinStep.currentPin:
|
||||
debugPrint('[CardPIN] currentPin entered, advancing to newPin');
|
||||
state = state.copyWith(step: CardPinStep.newPin, errorMessage: '');
|
||||
case CardPinStep.newPin:
|
||||
debugPrint('[CardPIN] newPin entered, advancing to confirmPin');
|
||||
state = state.copyWith(step: CardPinStep.confirmPin, errorMessage: '');
|
||||
case CardPinStep.confirmPin:
|
||||
if (state.confirmPin != state.newPin) {
|
||||
debugPrint('[CardPIN] confirmPin MISMATCH');
|
||||
state = state.copyWith(
|
||||
confirmPin: '',
|
||||
errorMessage: 'cardPinMismatch',
|
||||
);
|
||||
return;
|
||||
}
|
||||
debugPrint('[CardPIN] confirmPin matches, advancing to scaPin');
|
||||
state = state.copyWith(step: CardPinStep.scaPin, errorMessage: '');
|
||||
case CardPinStep.scaPin:
|
||||
debugPrint('[CardPIN] scaPin entered, submitting...');
|
||||
_submit();
|
||||
}
|
||||
}
|
||||
|
||||
void goBack() {
|
||||
switch (state.step) {
|
||||
case CardPinStep.currentPin:
|
||||
break;
|
||||
case CardPinStep.newPin:
|
||||
if (mode == CardPinMode.change) {
|
||||
state = state.copyWith(step: CardPinStep.currentPin, newPin: '');
|
||||
}
|
||||
case CardPinStep.confirmPin:
|
||||
state = state.copyWith(step: CardPinStep.newPin, confirmPin: '');
|
||||
case CardPinStep.scaPin:
|
||||
state = state.copyWith(step: CardPinStep.confirmPin, scaPin: '');
|
||||
}
|
||||
}
|
||||
|
||||
bool get isFirstStep =>
|
||||
(mode == CardPinMode.set && state.step == CardPinStep.newPin) ||
|
||||
(mode == CardPinMode.change && state.step == CardPinStep.currentPin);
|
||||
|
||||
Future<void> _submit() async {
|
||||
final cardId = state.cardId;
|
||||
final walletId = state.childProfile?.walletId;
|
||||
final userId = state.childProfile?.treezorUserId;
|
||||
debugPrint('[CardPIN] _submit mode=$mode cardId=$cardId walletId=$walletId userId=$userId');
|
||||
if (cardId.isEmpty || walletId == null) {
|
||||
debugPrint('[CardPIN] _submit aborted: cardId or walletId missing');
|
||||
return;
|
||||
}
|
||||
|
||||
state = state.copyWith(isSigning: true, errorMessage: '');
|
||||
|
||||
try {
|
||||
debugPrint('[CardPIN] connecting with SCA PIN...');
|
||||
await _connectionService.connectWithPin(loginPin: state.scaPin);
|
||||
if (!ref.mounted) return;
|
||||
debugPrint('[CardPIN] SCA connection successful');
|
||||
|
||||
final String scaProof;
|
||||
if (mode == CardPinMode.set) {
|
||||
final url =
|
||||
'https://savefamily.preprod.secure.treezor.co/cards/$cardId/setPIN';
|
||||
final scaInput = jsonEncode({
|
||||
'url': url,
|
||||
'body': {
|
||||
'newPIN': state.newPin,
|
||||
'confirmPIN': state.confirmPin,
|
||||
'userId': userId,
|
||||
},
|
||||
});
|
||||
debugPrint('[CardPIN] setPIN scaInput: $scaInput');
|
||||
scaProof = await _signatureService.generateJwsWithPin(
|
||||
message: '',
|
||||
input: scaInput,
|
||||
pin: state.scaPin,
|
||||
);
|
||||
debugPrint('[CardPIN] setPIN scaProof: $scaProof');
|
||||
} else {
|
||||
final url =
|
||||
'https://savefamily.preprod.secure.treezor.co/cards/$cardId/ChangePIN';
|
||||
final scaInput = jsonEncode({
|
||||
'url': url,
|
||||
'body': {
|
||||
'currentPIN': state.currentPin,
|
||||
'newPIN': state.newPin,
|
||||
'confirmPIN': state.confirmPin,
|
||||
'userId': userId,
|
||||
},
|
||||
});
|
||||
debugPrint('[CardPIN] changePIN scaInput: $scaInput');
|
||||
scaProof = await _signatureService.generateJwsWithPin(
|
||||
message: '',
|
||||
input: scaInput,
|
||||
pin: state.scaPin,
|
||||
);
|
||||
debugPrint('[CardPIN] changePIN scaProof: $scaProof');
|
||||
}
|
||||
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isSigning: false, isSubmitting: true, scaPin: '');
|
||||
|
||||
if (mode == CardPinMode.set) {
|
||||
debugPrint('[CardPIN] calling backend setCardPin walletId=$walletId');
|
||||
await ref.read(treezorRepositoryProvider).setCardPin(
|
||||
walletId: walletId,
|
||||
newPin: state.newPin,
|
||||
confirmPin: state.confirmPin,
|
||||
scaProof: scaProof,
|
||||
);
|
||||
debugPrint('[CardPIN] setCardPin SUCCESS');
|
||||
} else {
|
||||
debugPrint('[CardPIN] calling backend changeCardPin walletId=$walletId');
|
||||
await ref.read(treezorRepositoryProvider).changeCardPin(
|
||||
walletId: walletId,
|
||||
currentPin: state.currentPin,
|
||||
newPin: state.newPin,
|
||||
confirmPin: state.confirmPin,
|
||||
scaProof: scaProof,
|
||||
);
|
||||
debugPrint('[CardPIN] changeCardPin SUCCESS');
|
||||
}
|
||||
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isSubmitting: false, success: true);
|
||||
} catch (e) {
|
||||
debugPrint('[CardPIN] _submit ERROR: $e');
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isSigning: false,
|
||||
isSubmitting: false,
|
||||
scaPin: '',
|
||||
errorMessage: e.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
part 'card_pin_view_state.freezed.dart';
|
||||
|
||||
enum CardPinMode { set, change }
|
||||
|
||||
enum CardPinStep { currentPin, newPin, confirmPin, scaPin }
|
||||
|
||||
@freezed
|
||||
abstract class CardPinViewState with _$CardPinViewState {
|
||||
const factory CardPinViewState({
|
||||
@Default(true) bool isLoading,
|
||||
ChildProfileEntity? childProfile,
|
||||
ChildWalletEntity? childWallet,
|
||||
DeviceEntity? device,
|
||||
@Default('') String cardId,
|
||||
@Default('') String currentPin,
|
||||
@Default('') String newPin,
|
||||
@Default('') String confirmPin,
|
||||
@Default('') String scaPin,
|
||||
@Default(CardPinStep.newPin) CardPinStep step,
|
||||
@Default(false) bool isSigning,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool success,
|
||||
@Default('') String errorMessage,
|
||||
}) = _CardPinViewState;
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'card_pin_view_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$CardPinViewState {
|
||||
|
||||
bool get isLoading; ChildProfileEntity? get childProfile; ChildWalletEntity? get childWallet; DeviceEntity? get device; String get cardId; String get currentPin; String get newPin; String get confirmPin; String get scaPin; CardPinStep get step; bool get isSigning; bool get isSubmitting; bool get success; String get errorMessage;
|
||||
/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$CardPinViewStateCopyWith<CardPinViewState> get copyWith => _$CardPinViewStateCopyWithImpl<CardPinViewState>(this as CardPinViewState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is CardPinViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.currentPin, currentPin) || other.currentPin == currentPin)&&(identical(other.newPin, newPin) || other.newPin == newPin)&&(identical(other.confirmPin, confirmPin) || other.confirmPin == confirmPin)&&(identical(other.scaPin, scaPin) || other.scaPin == scaPin)&&(identical(other.step, step) || other.step == step)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isSubmitting, isSubmitting) || other.isSubmitting == isSubmitting)&&(identical(other.success, success) || other.success == success)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,childProfile,childWallet,device,cardId,currentPin,newPin,confirmPin,scaPin,step,isSigning,isSubmitting,success,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CardPinViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, currentPin: $currentPin, newPin: $newPin, confirmPin: $confirmPin, scaPin: $scaPin, step: $step, isSigning: $isSigning, isSubmitting: $isSubmitting, success: $success, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $CardPinViewStateCopyWith<$Res> {
|
||||
factory $CardPinViewStateCopyWith(CardPinViewState value, $Res Function(CardPinViewState) _then) = _$CardPinViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String currentPin, String newPin, String confirmPin, String scaPin, CardPinStep step, bool isSigning, bool isSubmitting, bool success, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
$ChildProfileEntityCopyWith<$Res>? get childProfile;$ChildWalletEntityCopyWith<$Res>? get childWallet;$DeviceEntityCopyWith<$Res>? get device;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$CardPinViewStateCopyWithImpl<$Res>
|
||||
implements $CardPinViewStateCopyWith<$Res> {
|
||||
_$CardPinViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final CardPinViewState _self;
|
||||
final $Res Function(CardPinViewState) _then;
|
||||
|
||||
/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? currentPin = null,Object? newPin = null,Object? confirmPin = null,Object? scaPin = null,Object? step = null,Object? isSigning = null,Object? isSubmitting = null,Object? success = null,Object? errorMessage = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
|
||||
as ChildProfileEntity?,childWallet: freezed == childWallet ? _self.childWallet : childWallet // ignore: cast_nullable_to_non_nullable
|
||||
as ChildWalletEntity?,device: freezed == device ? _self.device : device // ignore: cast_nullable_to_non_nullable
|
||||
as DeviceEntity?,cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as String,currentPin: null == currentPin ? _self.currentPin : currentPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,newPin: null == newPin ? _self.newPin : newPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,confirmPin: null == confirmPin ? _self.confirmPin : confirmPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,scaPin: null == scaPin ? _self.scaPin : scaPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,step: null == step ? _self.step : step // ignore: cast_nullable_to_non_nullable
|
||||
as CardPinStep,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isSubmitting: null == isSubmitting ? _self.isSubmitting : isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ChildProfileEntityCopyWith<$Res>? get childProfile {
|
||||
if (_self.childProfile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ChildProfileEntityCopyWith<$Res>(_self.childProfile!, (value) {
|
||||
return _then(_self.copyWith(childProfile: value));
|
||||
});
|
||||
}/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ChildWalletEntityCopyWith<$Res>? get childWallet {
|
||||
if (_self.childWallet == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ChildWalletEntityCopyWith<$Res>(_self.childWallet!, (value) {
|
||||
return _then(_self.copyWith(childWallet: value));
|
||||
});
|
||||
}/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$DeviceEntityCopyWith<$Res>? get device {
|
||||
if (_self.device == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $DeviceEntityCopyWith<$Res>(_self.device!, (value) {
|
||||
return _then(_self.copyWith(device: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [CardPinViewState].
|
||||
extension CardPinViewStatePatterns on CardPinViewState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _CardPinViewState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CardPinViewState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _CardPinViewState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CardPinViewState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _CardPinViewState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CardPinViewState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String currentPin, String newPin, String confirmPin, String scaPin, CardPinStep step, bool isSigning, bool isSubmitting, bool success, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CardPinViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.currentPin,_that.newPin,_that.confirmPin,_that.scaPin,_that.step,_that.isSigning,_that.isSubmitting,_that.success,_that.errorMessage);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String currentPin, String newPin, String confirmPin, String scaPin, CardPinStep step, bool isSigning, bool isSubmitting, bool success, String errorMessage) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CardPinViewState():
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.currentPin,_that.newPin,_that.confirmPin,_that.scaPin,_that.step,_that.isSigning,_that.isSubmitting,_that.success,_that.errorMessage);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String currentPin, String newPin, String confirmPin, String scaPin, CardPinStep step, bool isSigning, bool isSubmitting, bool success, String errorMessage)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CardPinViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.currentPin,_that.newPin,_that.confirmPin,_that.scaPin,_that.step,_that.isSigning,_that.isSubmitting,_that.success,_that.errorMessage);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _CardPinViewState implements CardPinViewState {
|
||||
const _CardPinViewState({this.isLoading = true, this.childProfile, this.childWallet, this.device, this.cardId = '', this.currentPin = '', this.newPin = '', this.confirmPin = '', this.scaPin = '', this.step = CardPinStep.newPin, this.isSigning = false, this.isSubmitting = false, this.success = false, this.errorMessage = ''});
|
||||
|
||||
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@override final ChildProfileEntity? childProfile;
|
||||
@override final ChildWalletEntity? childWallet;
|
||||
@override final DeviceEntity? device;
|
||||
@override@JsonKey() final String cardId;
|
||||
@override@JsonKey() final String currentPin;
|
||||
@override@JsonKey() final String newPin;
|
||||
@override@JsonKey() final String confirmPin;
|
||||
@override@JsonKey() final String scaPin;
|
||||
@override@JsonKey() final CardPinStep step;
|
||||
@override@JsonKey() final bool isSigning;
|
||||
@override@JsonKey() final bool isSubmitting;
|
||||
@override@JsonKey() final bool success;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
|
||||
/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$CardPinViewStateCopyWith<_CardPinViewState> get copyWith => __$CardPinViewStateCopyWithImpl<_CardPinViewState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CardPinViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.currentPin, currentPin) || other.currentPin == currentPin)&&(identical(other.newPin, newPin) || other.newPin == newPin)&&(identical(other.confirmPin, confirmPin) || other.confirmPin == confirmPin)&&(identical(other.scaPin, scaPin) || other.scaPin == scaPin)&&(identical(other.step, step) || other.step == step)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isSubmitting, isSubmitting) || other.isSubmitting == isSubmitting)&&(identical(other.success, success) || other.success == success)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,childProfile,childWallet,device,cardId,currentPin,newPin,confirmPin,scaPin,step,isSigning,isSubmitting,success,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CardPinViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, currentPin: $currentPin, newPin: $newPin, confirmPin: $confirmPin, scaPin: $scaPin, step: $step, isSigning: $isSigning, isSubmitting: $isSubmitting, success: $success, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$CardPinViewStateCopyWith<$Res> implements $CardPinViewStateCopyWith<$Res> {
|
||||
factory _$CardPinViewStateCopyWith(_CardPinViewState value, $Res Function(_CardPinViewState) _then) = __$CardPinViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String currentPin, String newPin, String confirmPin, String scaPin, CardPinStep step, bool isSigning, bool isSubmitting, bool success, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
@override $ChildProfileEntityCopyWith<$Res>? get childProfile;@override $ChildWalletEntityCopyWith<$Res>? get childWallet;@override $DeviceEntityCopyWith<$Res>? get device;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$CardPinViewStateCopyWithImpl<$Res>
|
||||
implements _$CardPinViewStateCopyWith<$Res> {
|
||||
__$CardPinViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _CardPinViewState _self;
|
||||
final $Res Function(_CardPinViewState) _then;
|
||||
|
||||
/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? currentPin = null,Object? newPin = null,Object? confirmPin = null,Object? scaPin = null,Object? step = null,Object? isSigning = null,Object? isSubmitting = null,Object? success = null,Object? errorMessage = null,}) {
|
||||
return _then(_CardPinViewState(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
|
||||
as ChildProfileEntity?,childWallet: freezed == childWallet ? _self.childWallet : childWallet // ignore: cast_nullable_to_non_nullable
|
||||
as ChildWalletEntity?,device: freezed == device ? _self.device : device // ignore: cast_nullable_to_non_nullable
|
||||
as DeviceEntity?,cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as String,currentPin: null == currentPin ? _self.currentPin : currentPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,newPin: null == newPin ? _self.newPin : newPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,confirmPin: null == confirmPin ? _self.confirmPin : confirmPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,scaPin: null == scaPin ? _self.scaPin : scaPin // ignore: cast_nullable_to_non_nullable
|
||||
as String,step: null == step ? _self.step : step // ignore: cast_nullable_to_non_nullable
|
||||
as CardPinStep,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isSubmitting: null == isSubmitting ? _self.isSubmitting : isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ChildProfileEntityCopyWith<$Res>? get childProfile {
|
||||
if (_self.childProfile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ChildProfileEntityCopyWith<$Res>(_self.childProfile!, (value) {
|
||||
return _then(_self.copyWith(childProfile: value));
|
||||
});
|
||||
}/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ChildWalletEntityCopyWith<$Res>? get childWallet {
|
||||
if (_self.childWallet == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ChildWalletEntityCopyWith<$Res>(_self.childWallet!, (value) {
|
||||
return _then(_self.copyWith(childWallet: value));
|
||||
});
|
||||
}/// Create a copy of CardPinViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$DeviceEntityCopyWith<$Res>? get device {
|
||||
if (_self.device == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $DeviceEntityCopyWith<$Res>(_self.device!, (value) {
|
||||
return _then(_self.copyWith(device: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -53,6 +53,13 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
type: MessageType.error,
|
||||
);
|
||||
}
|
||||
if (next.renewCardSuccess && !(prev?.renewCardSuccess ?? false)) {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: context.translate(I18n.renewCardSuccess),
|
||||
type: MessageType.success,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if (viewState.showPin) {
|
||||
@@ -102,6 +109,53 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
if (viewState.showRenewPin) {
|
||||
final viewModel = ref.read(
|
||||
childWalletViewModelProvider(widget.childId).notifier,
|
||||
);
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
appBar: AppBar(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
onPressed: viewModel.cancelRenewPin,
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: ScaPinView(
|
||||
title: context.translate(I18n.renewCardPinTitle),
|
||||
pin: viewState.pin,
|
||||
isProcessing:
|
||||
viewState.isSigning || viewState.isRenewingCard,
|
||||
processingText: context.translate(I18n.scaSigning),
|
||||
canSubmit: viewModel.canSubmitPin,
|
||||
submitText: context.translate(I18n.scaConnect),
|
||||
clearPinText: context.translate(I18n.scaClearPin),
|
||||
onDigitPressed: viewModel.onDigitPressed,
|
||||
onBackspacePressed: viewModel.onBackspacePressed,
|
||||
onClearPin: viewModel.onClearPin,
|
||||
onSubmit: () => viewModel.onRenewPinSubmit(),
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: viewModel.cancelRenewPin,
|
||||
child: Text(context.translate(I18n.cancel)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (viewState.isLoading) {
|
||||
return const Scaffold(body: Center(child: AppLoadingIndicator()));
|
||||
}
|
||||
@@ -175,6 +229,14 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => _showRenewCardConfirmation(),
|
||||
icon: Icon(
|
||||
Icons.credit_card_outlined,
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
icon: Icon(
|
||||
Icons.more_vert,
|
||||
@@ -187,6 +249,16 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
);
|
||||
} else if (value == 'delete') {
|
||||
_showDeleteConfirmation();
|
||||
} else if (value == 'set_pin') {
|
||||
widget.navigation.pushTo(
|
||||
AppRoutes.setCardPin(widget.childId),
|
||||
);
|
||||
} else if (value == 'change_pin') {
|
||||
widget.navigation.pushTo(
|
||||
AppRoutes.changeCardPin(widget.childId),
|
||||
);
|
||||
} else if (value == 'unblock_pin') {
|
||||
_showUnblockPinConfirmation();
|
||||
}
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
@@ -202,6 +274,45 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (!viewState.isPinBlocked && !(viewState.childProfile?.hasCardPin ?? false))
|
||||
PopupMenuItem(
|
||||
value: 'set_pin',
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Icon(Icons.pin_outlined),
|
||||
Text(
|
||||
context.translate(I18n.cardPinSet),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (!viewState.isPinBlocked && (viewState.childProfile?.hasCardPin ?? false))
|
||||
PopupMenuItem(
|
||||
value: 'change_pin',
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Icon(Icons.lock_reset_outlined),
|
||||
Text(
|
||||
context.translate(I18n.cardPinChange),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (viewState.isPinBlocked)
|
||||
PopupMenuItem(
|
||||
value: 'unblock_pin',
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Icon(Icons.lock_open_outlined),
|
||||
Text(
|
||||
context.translate(I18n.cardPinUnblock),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'delete',
|
||||
child: Row(
|
||||
@@ -504,6 +615,89 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
showTopSnackbar(context, message: e.toString(), type: MessageType.error);
|
||||
}
|
||||
}
|
||||
|
||||
void _showRenewCardConfirmation() {
|
||||
final theme = ref.read(themePortProvider);
|
||||
final confirmTitle = context.translate(I18n.renewCardTitle);
|
||||
final confirmMessage = context.translate(I18n.renewCardConfirm);
|
||||
final cancelText = context.translate(I18n.cancel);
|
||||
final confirmText = context.translate(I18n.accept);
|
||||
final bgColor = theme.getColorFor(ThemeCode.backgroundPrimary);
|
||||
final shape = RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: bgColor,
|
||||
shape: shape,
|
||||
title: Text(confirmTitle),
|
||||
content: Text(confirmMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: Text(cancelText),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
ref
|
||||
.read(childWalletViewModelProvider(widget.childId).notifier)
|
||||
.startRenewCard();
|
||||
},
|
||||
child: Text(confirmText),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showUnblockPinConfirmation() async {
|
||||
final theme = ref.read(themePortProvider);
|
||||
final confirmTitle = context.translate(I18n.cardPinUnblock);
|
||||
final confirmMessage = context.translate(I18n.cardPinUnblockConfirm);
|
||||
final cancelText = context.translate(I18n.cancel);
|
||||
final confirmText = context.translate(I18n.accept);
|
||||
final successText = context.translate(I18n.cardPinUnblockSuccess);
|
||||
final bgColor = theme.getColorFor(ThemeCode.backgroundPrimary);
|
||||
final shape = RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: bgColor,
|
||||
shape: shape,
|
||||
title: Text(confirmTitle),
|
||||
content: Text(confirmMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: Text(cancelText),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(ctx).pop();
|
||||
final viewModel = ref.read(
|
||||
childWalletViewModelProvider(widget.childId).notifier,
|
||||
);
|
||||
final success = await viewModel.unblockCardPin();
|
||||
if (success && mounted) {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: successText,
|
||||
type: MessageType.success,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(confirmText),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CardStatusSheet extends ConsumerStatefulWidget {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:sca_treezor/sca_treezor.dart';
|
||||
@@ -124,6 +125,7 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
|
||||
cardId: card.cardId.toString(),
|
||||
cardStatus: card.status,
|
||||
locked: CardStatus.fromString(card.status).isLocked,
|
||||
isPinBlocked: card.isPinBlocked,
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
@@ -244,6 +246,113 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> unblockCardPin() async {
|
||||
final walletId = state.childProfile?.walletId;
|
||||
if (walletId == null) return false;
|
||||
|
||||
state = state.copyWith(isUpdatingCard: true, cardStatusError: '');
|
||||
|
||||
try {
|
||||
await ref.read(treezorRepositoryProvider).unblockCardPin(
|
||||
walletId: walletId,
|
||||
);
|
||||
if (!ref.mounted) return false;
|
||||
state = state.copyWith(isUpdatingCard: false);
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return false;
|
||||
state = state.copyWith(
|
||||
isUpdatingCard: false,
|
||||
cardStatusError: e.toString(),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void startRenewCard() {
|
||||
state = state.copyWith(
|
||||
showRenewPin: true,
|
||||
showPin: false,
|
||||
pin: '',
|
||||
cardStatusError: '',
|
||||
renewCardSuccess: false,
|
||||
);
|
||||
}
|
||||
|
||||
void cancelRenewPin() {
|
||||
state = state.copyWith(showRenewPin: false, pin: '');
|
||||
}
|
||||
|
||||
Future<void> onRenewPinSubmit() async {
|
||||
final childProfile = state.childProfile;
|
||||
if (childProfile == null) return;
|
||||
|
||||
state = state.copyWith(isSigning: true, cardStatusError: '');
|
||||
|
||||
try {
|
||||
debugPrint('[RenewCard] connecting with SCA PIN...');
|
||||
await _connectionService.connectWithPin(loginPin: state.pin);
|
||||
if (!ref.mounted) return;
|
||||
debugPrint('[RenewCard] SCA connection successful');
|
||||
|
||||
final user = await ref.read(userInfoProvider.future);
|
||||
if (!ref.mounted) return;
|
||||
final paymentProfile = await ref
|
||||
.read(getPaymentProfileUseCaseProvider)
|
||||
.getPaymentProfile(userId: user.id);
|
||||
if (!ref.mounted) return;
|
||||
|
||||
final walletBody = <String, dynamic>{
|
||||
'currency': 'EUR',
|
||||
'eventName': '${user.firstName} ${user.lastName}',
|
||||
'tariffId': 0,
|
||||
'userId': int.tryParse(paymentProfile.paymentProfileId) ?? 0,
|
||||
'walletTypeId': 9,
|
||||
'bic': 'TRZOESM2XXX',
|
||||
};
|
||||
|
||||
final scaInput = jsonEncode({
|
||||
'url': 'https://savefamily.preprod.secure.treezor.co/wallets',
|
||||
'body': walletBody,
|
||||
});
|
||||
debugPrint('[RenewCard] scaInput: $scaInput');
|
||||
|
||||
final scaProof = await _signatureService.generateJwsWithPin(
|
||||
message: '',
|
||||
input: scaInput,
|
||||
pin: state.pin,
|
||||
);
|
||||
debugPrint('[RenewCard] scaProof: $scaProof');
|
||||
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isSigning: false, isRenewingCard: true, pin: '');
|
||||
|
||||
debugPrint('[RenewCard] calling backend renewCard childProfileId=${childProfile.id} publicToken=${paymentProfile.paymentProfileId}');
|
||||
await ref.read(treezorRepositoryProvider).renewCard(
|
||||
childProfileId: childProfile.id,
|
||||
publicToken: paymentProfile.paymentProfileId,
|
||||
scaProof: scaProof,
|
||||
);
|
||||
debugPrint('[RenewCard] renewCard SUCCESS');
|
||||
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isRenewingCard: false,
|
||||
renewCardSuccess: true,
|
||||
showRenewPin: false,
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('[RenewCard] ERROR: $e');
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isSigning: false,
|
||||
isRenewingCard: false,
|
||||
pin: '',
|
||||
cardStatusError: e.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static int _cardStatusToInt(String status) {
|
||||
return CardStatus.fromString(status).apiCode;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ abstract class ChildWalletViewState with _$ChildWalletViewState {
|
||||
@Default('') String cardId,
|
||||
@Default('') String cardStatus,
|
||||
@Default(false) bool locked,
|
||||
@Default(false) bool isPinBlocked,
|
||||
@Default('') String errorMessage,
|
||||
@Default(false) bool isUpdatingCard,
|
||||
@Default('') String cardStatusError,
|
||||
@@ -21,6 +22,9 @@ abstract class ChildWalletViewState with _$ChildWalletViewState {
|
||||
@Default('') String selectedStatus,
|
||||
@Default('') String pin,
|
||||
@Default(false) bool isSigning,
|
||||
@Default(false) bool isRenewingCard,
|
||||
@Default(false) bool renewCardSuccess,
|
||||
@Default(false) bool showRenewPin,
|
||||
@Default(false) bool isLoadingTransactions,
|
||||
@Default([]) List<List<WalletTransactionEntity>> transactionPages,
|
||||
String? nextCursor,
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ChildWalletViewState {
|
||||
|
||||
bool get isLoading; ChildProfileEntity? get childProfile; ChildWalletEntity? get childWallet; DeviceEntity? get device; String get cardId; String get cardStatus; bool get locked; String get errorMessage; bool get isUpdatingCard; String get cardStatusError; bool get cardStatusSuccess; bool get showPin; String get selectedStatus; String get pin; bool get isSigning; bool get isLoadingTransactions; List<List<WalletTransactionEntity>> get transactionPages; String? get nextCursor; bool get isLoadingMore; int get currentPage;
|
||||
bool get isLoading; ChildProfileEntity? get childProfile; ChildWalletEntity? get childWallet; DeviceEntity? get device; String get cardId; String get cardStatus; bool get locked; bool get isPinBlocked; String get errorMessage; bool get isUpdatingCard; String get cardStatusError; bool get cardStatusSuccess; bool get showPin; String get selectedStatus; String get pin; bool get isSigning; bool get isLoadingTransactions; List<List<WalletTransactionEntity>> get transactionPages; String? get nextCursor; bool get isLoadingMore; int get currentPage;
|
||||
/// Create a copy of ChildWalletViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $ChildWalletViewStateCopyWith<ChildWalletViewState> get copyWith => _$ChildWalle
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.transactionPages, transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.transactionPages, transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(transactionPages),nextCursor,isLoadingMore,currentPage]);
|
||||
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,isPinBlocked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(transactionPages),nextCursor,isLoadingMore,currentPage]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, isPinBlocked: $isPinBlocked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $ChildWalletViewStateCopyWith<$Res> {
|
||||
factory $ChildWalletViewStateCopyWith(ChildWalletViewState value, $Res Function(ChildWalletViewState) _then) = _$ChildWalletViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, bool isPinBlocked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class _$ChildWalletViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildWalletViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? isPinBlocked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
|
||||
@@ -71,6 +71,7 @@ as ChildWalletEntity?,device: freezed == device ? _self.device : device // ignor
|
||||
as DeviceEntity?,cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as String,cardStatus: null == cardStatus ? _self.cardStatus : cardStatus // ignore: cast_nullable_to_non_nullable
|
||||
as String,locked: null == locked ? _self.locked : locked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,isUpdatingCard: null == isUpdatingCard ? _self.isUpdatingCard : isUpdatingCard // ignore: cast_nullable_to_non_nullable
|
||||
as bool,cardStatusError: null == cardStatusError ? _self.cardStatusError : cardStatusError // ignore: cast_nullable_to_non_nullable
|
||||
@@ -205,10 +206,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, bool isPinBlocked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildWalletViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.isPinBlocked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -226,10 +227,10 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, bool isPinBlocked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildWalletViewState():
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.isPinBlocked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -246,10 +247,10 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, bool isPinBlocked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildWalletViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.isPinBlocked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -261,7 +262,7 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
|
||||
|
||||
|
||||
class _ChildWalletViewState implements ChildWalletViewState {
|
||||
const _ChildWalletViewState({this.isLoading = true, this.childProfile, this.childWallet, this.device, this.cardId = '', this.cardStatus = '', this.locked = false, this.errorMessage = '', this.isUpdatingCard = false, this.cardStatusError = '', this.cardStatusSuccess = false, this.showPin = false, this.selectedStatus = '', this.pin = '', this.isSigning = false, this.isLoadingTransactions = false, final List<List<WalletTransactionEntity>> transactionPages = const [], this.nextCursor, this.isLoadingMore = false, this.currentPage = 0}): _transactionPages = transactionPages;
|
||||
const _ChildWalletViewState({this.isLoading = true, this.childProfile, this.childWallet, this.device, this.cardId = '', this.cardStatus = '', this.locked = false, this.isPinBlocked = false, this.errorMessage = '', this.isUpdatingCard = false, this.cardStatusError = '', this.cardStatusSuccess = false, this.showPin = false, this.selectedStatus = '', this.pin = '', this.isSigning = false, this.isLoadingTransactions = false, final List<List<WalletTransactionEntity>> transactionPages = const [], this.nextCursor, this.isLoadingMore = false, this.currentPage = 0}): _transactionPages = transactionPages;
|
||||
|
||||
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@@ -271,6 +272,7 @@ class _ChildWalletViewState implements ChildWalletViewState {
|
||||
@override@JsonKey() final String cardId;
|
||||
@override@JsonKey() final String cardStatus;
|
||||
@override@JsonKey() final bool locked;
|
||||
@override@JsonKey() final bool isPinBlocked;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
@override@JsonKey() final bool isUpdatingCard;
|
||||
@override@JsonKey() final String cardStatusError;
|
||||
@@ -301,16 +303,16 @@ _$ChildWalletViewStateCopyWith<_ChildWalletViewState> get copyWith => __$ChildWa
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._transactionPages, _transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._transactionPages, _transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(_transactionPages),nextCursor,isLoadingMore,currentPage]);
|
||||
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,isPinBlocked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(_transactionPages),nextCursor,isLoadingMore,currentPage]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, isPinBlocked: $isPinBlocked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +323,7 @@ abstract mixin class _$ChildWalletViewStateCopyWith<$Res> implements $ChildWalle
|
||||
factory _$ChildWalletViewStateCopyWith(_ChildWalletViewState value, $Res Function(_ChildWalletViewState) _then) = __$ChildWalletViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, bool isPinBlocked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
|
||||
});
|
||||
|
||||
|
||||
@@ -338,7 +340,7 @@ class __$ChildWalletViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildWalletViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? isPinBlocked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
|
||||
return _then(_ChildWalletViewState(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
|
||||
@@ -347,6 +349,7 @@ as ChildWalletEntity?,device: freezed == device ? _self.device : device // ignor
|
||||
as DeviceEntity?,cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as String,cardStatus: null == cardStatus ? _self.cardStatus : cardStatus // ignore: cast_nullable_to_non_nullable
|
||||
as String,locked: null == locked ? _self.locked : locked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,isUpdatingCard: null == isUpdatingCard ? _self.isUpdatingCard : isUpdatingCard // ignore: cast_nullable_to_non_nullable
|
||||
as bool,cardStatusError: null == cardStatusError ? _self.cardStatusError : cardStatusError // ignore: cast_nullable_to_non_nullable
|
||||
|
||||
@@ -23,13 +23,13 @@ class CheckSessionUseCaseImpl implements CheckSessionUseCase {
|
||||
debugPrint('[CheckSession] → onboarding');
|
||||
return InitialRoute.onboarding;
|
||||
}
|
||||
return InitialRoute.login;
|
||||
// try {
|
||||
// await _userRepository.getUserInfo();
|
||||
// return InitialRoute.home;
|
||||
// } catch (e) {
|
||||
// debugPrint('[CheckSessionUseCase] error: $e');
|
||||
// return InitialRoute.login;
|
||||
// }
|
||||
// return InitialRoute.login;
|
||||
try {
|
||||
await _userRepository.getUserInfo();
|
||||
return InitialRoute.home;
|
||||
} catch (e) {
|
||||
debugPrint('[CheckSessionUseCase] error: $e');
|
||||
return InitialRoute.login;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
enum InitialRoute { login, onboarding }
|
||||
enum InitialRoute { login, home, onboarding }
|
||||
|
||||
@@ -55,7 +55,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
final destination = switch (_route!) {
|
||||
InitialRoute.onboarding => AppRoutes.onboarding,
|
||||
InitialRoute.login => AppRoutes.login,
|
||||
// InitialRoute.home => AppRoutes.dashboardHome,
|
||||
InitialRoute.home => AppRoutes.dashboardHome,
|
||||
};
|
||||
widget.navigationContract.goTo(destination);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
<versions>
|
||||
<version>2.6.4</version>
|
||||
</versions>
|
||||
<lastUpdated>20260322000000</lastUpdated>
|
||||
<lastUpdated>20260324000000</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
|
||||
@@ -1 +1 @@
|
||||
ec3c2e29f6fe8ca84eadd369212dff2b
|
||||
60e0101847630ce6dcc19b1e46fb081c
|
||||
@@ -1 +1 @@
|
||||
df5c1d0c2331a0f608264e4d5f14b9492f5eb2aa
|
||||
09ac1da2fb43d606168060ea769ec889804c3ed7
|
||||
@@ -31,6 +31,10 @@ class AppRoutes {
|
||||
'${childWallet(childWalletId)}/extract';
|
||||
static String editChildProfile(String childWalletId) =>
|
||||
'${childWallet(childWalletId)}/edit';
|
||||
static String setCardPin(String childWalletId) =>
|
||||
'${childWallet(childWalletId)}/set-pin';
|
||||
static String changeCardPin(String childWalletId) =>
|
||||
'${childWallet(childWalletId)}/change-pin';
|
||||
static const dashboardActivity = '$dashboard/activity';
|
||||
static const dashboardNotifications = '$dashboard/notifications';
|
||||
static const dashboardProfile = '$dashboard/profile';
|
||||
|
||||
@@ -763,5 +763,26 @@
|
||||
"callHistoryEmpty": "No calls recorded",
|
||||
"callIncoming": "Incoming",
|
||||
"callOutgoing": "Outgoing",
|
||||
"callMissed": "Missed"
|
||||
"callMissed": "Missed",
|
||||
"cardPinSet": "Set PIN",
|
||||
"cardPinChange": "Change PIN",
|
||||
"cardPinUnblock": "Unblock PIN",
|
||||
"cardPinSetTitle": "Set card PIN",
|
||||
"cardPinChangeTitle": "Change card PIN",
|
||||
"cardPinCurrentStep": "Enter current PIN",
|
||||
"cardPinNewStep": "Enter new PIN",
|
||||
"cardPinConfirmStep": "Confirm new PIN",
|
||||
"cardPinScaStep": "Enter your security PIN",
|
||||
"cardPinNext": "Next",
|
||||
"cardPinMismatch": "PINs do not match, please try again",
|
||||
"cardPinSuccess": "Card PIN updated successfully",
|
||||
"cardPinError": "Error updating card PIN",
|
||||
"cardPinUnblockConfirm": "Are you sure you want to unblock the card PIN?",
|
||||
"cardPinUnblockSuccess": "Card PIN unblocked successfully",
|
||||
"cardPinUnblockError": "Error unblocking card PIN",
|
||||
"renewCardTitle": "Renew card",
|
||||
"renewCardConfirm": "Are you sure you want to renew the card? A new card will be issued.",
|
||||
"renewCardPinTitle": "Enter your security PIN to renew the card",
|
||||
"renewCardSuccess": "Card renewed successfully",
|
||||
"renewCardError": "Error renewing card"
|
||||
}
|
||||
|
||||
@@ -761,5 +761,26 @@
|
||||
"callHistoryEmpty": "No hay llamadas registradas",
|
||||
"callIncoming": "Entrantes",
|
||||
"callOutgoing": "Salientes",
|
||||
"callMissed": "Perdidas"
|
||||
"callMissed": "Perdidas",
|
||||
"cardPinSet": "Establecer PIN",
|
||||
"cardPinChange": "Cambiar PIN",
|
||||
"cardPinUnblock": "Desbloquear PIN",
|
||||
"cardPinSetTitle": "Establecer PIN de tarjeta",
|
||||
"cardPinChangeTitle": "Cambiar PIN de tarjeta",
|
||||
"cardPinCurrentStep": "Introduce el PIN actual",
|
||||
"cardPinNewStep": "Introduce el nuevo PIN",
|
||||
"cardPinConfirmStep": "Confirma el nuevo PIN",
|
||||
"cardPinScaStep": "Introduce tu PIN de seguridad",
|
||||
"cardPinNext": "Siguiente",
|
||||
"cardPinMismatch": "Los PIN no coinciden, inténtalo de nuevo",
|
||||
"cardPinSuccess": "PIN de tarjeta actualizado correctamente",
|
||||
"cardPinError": "Error al actualizar el PIN de tarjeta",
|
||||
"cardPinUnblockConfirm": "¿Estás seguro de que quieres desbloquear el PIN de la tarjeta?",
|
||||
"cardPinUnblockSuccess": "PIN de tarjeta desbloqueado correctamente",
|
||||
"cardPinUnblockError": "Error al desbloquear el PIN de tarjeta",
|
||||
"renewCardTitle": "Renovar tarjeta",
|
||||
"renewCardConfirm": "¿Estás seguro de que quieres renovar la tarjeta? Se emitirá una nueva tarjeta.",
|
||||
"renewCardPinTitle": "Introduce tu PIN de seguridad para renovar la tarjeta",
|
||||
"renewCardSuccess": "Tarjeta renovada correctamente",
|
||||
"renewCardError": "Error al renovar la tarjeta"
|
||||
}
|
||||
|
||||
@@ -768,4 +768,25 @@ class I18n {
|
||||
static const String noPhotosAvailable = 'noPhotosAvailable';
|
||||
static const String yesterday = 'yesterday';
|
||||
static const String measure = 'measure';
|
||||
static const String cardPinSet = 'cardPinSet';
|
||||
static const String cardPinChange = 'cardPinChange';
|
||||
static const String cardPinUnblock = 'cardPinUnblock';
|
||||
static const String cardPinSetTitle = 'cardPinSetTitle';
|
||||
static const String cardPinChangeTitle = 'cardPinChangeTitle';
|
||||
static const String cardPinCurrentStep = 'cardPinCurrentStep';
|
||||
static const String cardPinNewStep = 'cardPinNewStep';
|
||||
static const String cardPinConfirmStep = 'cardPinConfirmStep';
|
||||
static const String cardPinScaStep = 'cardPinScaStep';
|
||||
static const String cardPinNext = 'cardPinNext';
|
||||
static const String cardPinMismatch = 'cardPinMismatch';
|
||||
static const String cardPinSuccess = 'cardPinSuccess';
|
||||
static const String cardPinError = 'cardPinError';
|
||||
static const String cardPinUnblockConfirm = 'cardPinUnblockConfirm';
|
||||
static const String cardPinUnblockSuccess = 'cardPinUnblockSuccess';
|
||||
static const String cardPinUnblockError = 'cardPinUnblockError';
|
||||
static const String renewCardTitle = 'renewCardTitle';
|
||||
static const String renewCardConfirm = 'renewCardConfirm';
|
||||
static const String renewCardPinTitle = 'renewCardPinTitle';
|
||||
static const String renewCardSuccess = 'renewCardSuccess';
|
||||
static const String renewCardError = 'renewCardError';
|
||||
}
|
||||
|
||||
@@ -94,4 +94,27 @@ abstract class TreezorRemoteDatasource {
|
||||
required String walletId,
|
||||
required WalletLimitsModel limits,
|
||||
});
|
||||
|
||||
Future<void> setCardPin({
|
||||
required String walletId,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
});
|
||||
|
||||
Future<void> changeCardPin({
|
||||
required String walletId,
|
||||
required String currentPin,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
});
|
||||
|
||||
Future<void> unblockCardPin({required String walletId});
|
||||
|
||||
Future<void> renewCard({
|
||||
required String childProfileId,
|
||||
required String publicToken,
|
||||
required String scaProof,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -549,6 +549,91 @@ class TreezorRemoteDatasourceImpl implements TreezorRemoteDatasource {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setCardPin({
|
||||
required String walletId,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
}) async {
|
||||
try {
|
||||
await _repository.put<void>(
|
||||
'/wallets/$walletId/card/set-pin',
|
||||
body: <String, dynamic>{
|
||||
'newPin': newPin,
|
||||
'confirmPin': confirmPin,
|
||||
'scaProof': scaProof,
|
||||
},
|
||||
);
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(
|
||||
error,
|
||||
defaultMessage: 'Error in /wallets/$walletId/card/set-pin',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> changeCardPin({
|
||||
required String walletId,
|
||||
required String currentPin,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
}) async {
|
||||
try {
|
||||
await _repository.put<void>(
|
||||
'/wallets/$walletId/card/change-pin',
|
||||
body: <String, dynamic>{
|
||||
'currentPin': currentPin,
|
||||
'newPin': newPin,
|
||||
'confirmPin': confirmPin,
|
||||
'scaProof': scaProof,
|
||||
},
|
||||
);
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(
|
||||
error,
|
||||
defaultMessage: 'Error in /wallets/$walletId/card/change-pin',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> unblockCardPin({required String walletId}) async {
|
||||
try {
|
||||
await _repository.put<void>('/wallets/$walletId/card/unblock-pin');
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(
|
||||
error,
|
||||
defaultMessage: 'Error in /wallets/$walletId/card/unblock-pin',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> renewCard({
|
||||
required String childProfileId,
|
||||
required String publicToken,
|
||||
required String scaProof,
|
||||
}) async {
|
||||
try {
|
||||
await _repository.put<void>(
|
||||
'/child-profiles/$childProfileId/renew-card',
|
||||
body: <String, dynamic>{
|
||||
'publicToken': publicToken,
|
||||
'scaProof': scaProof,
|
||||
},
|
||||
);
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(
|
||||
error,
|
||||
defaultMessage:
|
||||
'Error in /child-profiles/$childProfileId/renew-card',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Exception _mapDioError(DioException error, {required String defaultMessage}) {
|
||||
|
||||
@@ -30,6 +30,7 @@ abstract class ChildProfileModel with _$ChildProfileModel {
|
||||
required String treezorUserId,
|
||||
required String address,
|
||||
required int createdAt,
|
||||
@Default(false) bool hasCardPin,
|
||||
}) = _ChildProfileModel;
|
||||
|
||||
factory ChildProfileModel.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -49,6 +50,7 @@ extension ChildProfileModelMapper on ChildProfileModel {
|
||||
treezorUserId: treezorUserId,
|
||||
address: address,
|
||||
createdAt: createdAt,
|
||||
hasCardPin: hasCardPin,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ as int,
|
||||
/// @nodoc
|
||||
mixin _$ChildProfileModel {
|
||||
|
||||
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt;
|
||||
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt; bool get hasCardPin;
|
||||
/// Create a copy of ChildProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -306,16 +306,16 @@ $ChildProfileModelCopyWith<ChildProfileModel> get copyWith => _$ChildProfileMode
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
|
||||
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ abstract mixin class $ChildProfileModelCopyWith<$Res> {
|
||||
factory $ChildProfileModelCopyWith(ChildProfileModel value, $Res Function(ChildProfileModel) _then) = _$ChildProfileModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
|
||||
});
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ class _$ChildProfileModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||
@@ -355,7 +355,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
|
||||
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -440,10 +441,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildProfileModel() when $default != null:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -461,10 +462,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildProfileModel():
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -481,10 +482,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildProfileModel() when $default != null:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -496,7 +497,7 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
|
||||
@JsonSerializable()
|
||||
|
||||
class _ChildProfileModel implements ChildProfileModel {
|
||||
const _ChildProfileModel({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt});
|
||||
const _ChildProfileModel({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt, this.hasCardPin = false});
|
||||
factory _ChildProfileModel.fromJson(Map<String, dynamic> json) => _$ChildProfileModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@@ -509,6 +510,7 @@ class _ChildProfileModel implements ChildProfileModel {
|
||||
@override final String treezorUserId;
|
||||
@override final String address;
|
||||
@override final int createdAt;
|
||||
@override@JsonKey() final bool hasCardPin;
|
||||
|
||||
/// Create a copy of ChildProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -523,16 +525,16 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
|
||||
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
|
||||
}
|
||||
|
||||
|
||||
@@ -543,7 +545,7 @@ abstract mixin class _$ChildProfileModelCopyWith<$Res> implements $ChildProfileM
|
||||
factory _$ChildProfileModelCopyWith(_ChildProfileModel value, $Res Function(_ChildProfileModel) _then) = __$ChildProfileModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
|
||||
});
|
||||
|
||||
|
||||
@@ -560,7 +562,7 @@ class __$ChildProfileModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
|
||||
return _then(_ChildProfileModel(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||
@@ -572,7 +574,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
|
||||
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ _ChildProfileModel _$ChildProfileModelFromJson(Map<String, dynamic> json) =>
|
||||
treezorUserId: json['treezorUserId'] as String,
|
||||
address: json['address'] as String,
|
||||
createdAt: (json['createdAt'] as num).toInt(),
|
||||
hasCardPin: json['hasCardPin'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ChildProfileModelToJson(_ChildProfileModel instance) =>
|
||||
@@ -52,4 +53,5 @@ Map<String, dynamic> _$ChildProfileModelToJson(_ChildProfileModel instance) =>
|
||||
'treezorUserId': instance.treezorUserId,
|
||||
'address': instance.address,
|
||||
'createdAt': instance.createdAt,
|
||||
'hasCardPin': instance.hasCardPin,
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ abstract class WalletCardModel with _$WalletCardModel {
|
||||
required int walletId,
|
||||
required int userId,
|
||||
required String status,
|
||||
@Default(false) bool isPinBlocked,
|
||||
}) = _WalletCardModel;
|
||||
|
||||
factory WalletCardModel.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -24,6 +25,7 @@ extension WalletCardModelMapper on WalletCardModel {
|
||||
walletId: walletId,
|
||||
userId: userId,
|
||||
status: status,
|
||||
isPinBlocked: isPinBlocked,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$WalletCardModel {
|
||||
|
||||
int get cardId; int get walletId; int get userId; String get status;
|
||||
int get cardId; int get walletId; int get userId; String get status; bool get isPinBlocked;
|
||||
/// Create a copy of WalletCardModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -28,16 +28,16 @@ $WalletCardModelCopyWith<WalletCardModel> get copyWith => _$WalletCardModelCopyW
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletCardModel&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletCardModel&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
|
||||
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract mixin class $WalletCardModelCopyWith<$Res> {
|
||||
factory $WalletCardModelCopyWith(WalletCardModel value, $Res Function(WalletCardModel) _then) = _$WalletCardModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int cardId, int walletId, int userId, String status
|
||||
int cardId, int walletId, int userId, String status, bool isPinBlocked
|
||||
});
|
||||
|
||||
|
||||
@@ -65,13 +65,14 @@ class _$WalletCardModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of WalletCardModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
|
||||
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -156,10 +157,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletCardModel() when $default != null:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -177,10 +178,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletCardModel():
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -197,10 +198,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletCardModel() when $default != null:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -212,13 +213,14 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
@JsonSerializable()
|
||||
|
||||
class _WalletCardModel implements WalletCardModel {
|
||||
const _WalletCardModel({required this.cardId, required this.walletId, required this.userId, required this.status});
|
||||
const _WalletCardModel({required this.cardId, required this.walletId, required this.userId, required this.status, this.isPinBlocked = false});
|
||||
factory _WalletCardModel.fromJson(Map<String, dynamic> json) => _$WalletCardModelFromJson(json);
|
||||
|
||||
@override final int cardId;
|
||||
@override final int walletId;
|
||||
@override final int userId;
|
||||
@override final String status;
|
||||
@override@JsonKey() final bool isPinBlocked;
|
||||
|
||||
/// Create a copy of WalletCardModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -233,16 +235,16 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletCardModel&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletCardModel&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
|
||||
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +255,7 @@ abstract mixin class _$WalletCardModelCopyWith<$Res> implements $WalletCardModel
|
||||
factory _$WalletCardModelCopyWith(_WalletCardModel value, $Res Function(_WalletCardModel) _then) = __$WalletCardModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int cardId, int walletId, int userId, String status
|
||||
int cardId, int walletId, int userId, String status, bool isPinBlocked
|
||||
});
|
||||
|
||||
|
||||
@@ -270,13 +272,14 @@ class __$WalletCardModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of WalletCardModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = null,}) {
|
||||
return _then(_WalletCardModel(
|
||||
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
|
||||
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ _WalletCardModel _$WalletCardModelFromJson(Map<String, dynamic> json) =>
|
||||
walletId: (json['walletId'] as num).toInt(),
|
||||
userId: (json['userId'] as num).toInt(),
|
||||
status: json['status'] as String,
|
||||
isPinBlocked: json['isPinBlocked'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$WalletCardModelToJson(_WalletCardModel instance) =>
|
||||
@@ -20,4 +21,5 @@ Map<String, dynamic> _$WalletCardModelToJson(_WalletCardModel instance) =>
|
||||
'walletId': instance.walletId,
|
||||
'userId': instance.userId,
|
||||
'status': instance.status,
|
||||
'isPinBlocked': instance.isPinBlocked,
|
||||
};
|
||||
|
||||
@@ -325,4 +325,54 @@ class TreezorRepositoryImpl implements TreezorRepository {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setCardPin({
|
||||
required String walletId,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
}) async {
|
||||
await _remote.setCardPin(
|
||||
walletId: walletId,
|
||||
newPin: newPin,
|
||||
confirmPin: confirmPin,
|
||||
scaProof: scaProof,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> changeCardPin({
|
||||
required String walletId,
|
||||
required String currentPin,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
}) async {
|
||||
await _remote.changeCardPin(
|
||||
walletId: walletId,
|
||||
currentPin: currentPin,
|
||||
newPin: newPin,
|
||||
confirmPin: confirmPin,
|
||||
scaProof: scaProof,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> unblockCardPin({required String walletId}) async {
|
||||
await _remote.unblockCardPin(walletId: walletId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> renewCard({
|
||||
required String childProfileId,
|
||||
required String publicToken,
|
||||
required String scaProof,
|
||||
}) async {
|
||||
await _remote.renewCard(
|
||||
childProfileId: childProfileId,
|
||||
publicToken: publicToken,
|
||||
scaProof: scaProof,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,6 @@ abstract class ChildProfileEntity with _$ChildProfileEntity {
|
||||
required String treezorUserId,
|
||||
required String address,
|
||||
required int createdAt,
|
||||
@Default(false) bool hasCardPin,
|
||||
}) = _ChildProfileEntity;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ChildProfileEntity {
|
||||
|
||||
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt;
|
||||
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt; bool get hasCardPin;
|
||||
/// Create a copy of ChildProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $ChildProfileEntityCopyWith<ChildProfileEntity> get copyWith => _$ChildProfileEn
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
|
||||
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $ChildProfileEntityCopyWith<$Res> {
|
||||
factory $ChildProfileEntityCopyWith(ChildProfileEntity value, $Res Function(ChildProfileEntity) _then) = _$ChildProfileEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class _$ChildProfileEntityCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||
@@ -74,7 +74,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
|
||||
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -159,10 +160,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildProfileEntity() when $default != null:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -180,10 +181,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildProfileEntity():
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -200,10 +201,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildProfileEntity() when $default != null:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
|
||||
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -215,7 +216,7 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
|
||||
|
||||
|
||||
class _ChildProfileEntity implements ChildProfileEntity {
|
||||
const _ChildProfileEntity({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt});
|
||||
const _ChildProfileEntity({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt, this.hasCardPin = false});
|
||||
|
||||
|
||||
@override final String id;
|
||||
@@ -228,6 +229,7 @@ class _ChildProfileEntity implements ChildProfileEntity {
|
||||
@override final String treezorUserId;
|
||||
@override final String address;
|
||||
@override final int createdAt;
|
||||
@override@JsonKey() final bool hasCardPin;
|
||||
|
||||
/// Create a copy of ChildProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -239,16 +241,16 @@ _$ChildProfileEntityCopyWith<_ChildProfileEntity> get copyWith => __$ChildProfil
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
|
||||
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
|
||||
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +261,7 @@ abstract mixin class _$ChildProfileEntityCopyWith<$Res> implements $ChildProfile
|
||||
factory _$ChildProfileEntityCopyWith(_ChildProfileEntity value, $Res Function(_ChildProfileEntity) _then) = __$ChildProfileEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
|
||||
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
|
||||
});
|
||||
|
||||
|
||||
@@ -276,7 +278,7 @@ class __$ChildProfileEntityCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
|
||||
return _then(_ChildProfileEntity(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||
@@ -288,7 +290,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
|
||||
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,6 @@ abstract class WalletCardEntity with _$WalletCardEntity {
|
||||
required int walletId,
|
||||
required int userId,
|
||||
required String status,
|
||||
@Default(false) bool isPinBlocked,
|
||||
}) = _WalletCardEntity;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$WalletCardEntity {
|
||||
|
||||
int get cardId; int get walletId; int get userId; String get status;
|
||||
int get cardId; int get walletId; int get userId; String get status; bool get isPinBlocked;
|
||||
/// Create a copy of WalletCardEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $WalletCardEntityCopyWith<WalletCardEntity> get copyWith => _$WalletCardEntityCo
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletCardEntity&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletCardEntity&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
|
||||
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $WalletCardEntityCopyWith<$Res> {
|
||||
factory $WalletCardEntityCopyWith(WalletCardEntity value, $Res Function(WalletCardEntity) _then) = _$WalletCardEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int cardId, int walletId, int userId, String status
|
||||
int cardId, int walletId, int userId, String status, bool isPinBlocked
|
||||
});
|
||||
|
||||
|
||||
@@ -62,13 +62,14 @@ class _$WalletCardEntityCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of WalletCardEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
|
||||
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -153,10 +154,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletCardEntity() when $default != null:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -174,10 +175,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletCardEntity():
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -194,10 +195,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletCardEntity() when $default != null:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -209,13 +210,14 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
|
||||
|
||||
|
||||
class _WalletCardEntity implements WalletCardEntity {
|
||||
const _WalletCardEntity({required this.cardId, required this.walletId, required this.userId, required this.status});
|
||||
const _WalletCardEntity({required this.cardId, required this.walletId, required this.userId, required this.status, this.isPinBlocked = false});
|
||||
|
||||
|
||||
@override final int cardId;
|
||||
@override final int walletId;
|
||||
@override final int userId;
|
||||
@override final String status;
|
||||
@override@JsonKey() final bool isPinBlocked;
|
||||
|
||||
/// Create a copy of WalletCardEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -227,16 +229,16 @@ _$WalletCardEntityCopyWith<_WalletCardEntity> get copyWith => __$WalletCardEntit
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletCardEntity&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletCardEntity&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
|
||||
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
|
||||
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +249,7 @@ abstract mixin class _$WalletCardEntityCopyWith<$Res> implements $WalletCardEnti
|
||||
factory _$WalletCardEntityCopyWith(_WalletCardEntity value, $Res Function(_WalletCardEntity) _then) = __$WalletCardEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int cardId, int walletId, int userId, String status
|
||||
int cardId, int walletId, int userId, String status, bool isPinBlocked
|
||||
});
|
||||
|
||||
|
||||
@@ -264,13 +266,14 @@ class __$WalletCardEntityCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of WalletCardEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = null,}) {
|
||||
return _then(_WalletCardEntity(
|
||||
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
|
||||
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
|
||||
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -100,4 +100,27 @@ abstract class TreezorRepository {
|
||||
required String walletId,
|
||||
required WalletLimitsEntity limits,
|
||||
});
|
||||
|
||||
Future<void> setCardPin({
|
||||
required String walletId,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
});
|
||||
|
||||
Future<void> changeCardPin({
|
||||
required String walletId,
|
||||
required String currentPin,
|
||||
required String newPin,
|
||||
required String confirmPin,
|
||||
required String scaProof,
|
||||
});
|
||||
|
||||
Future<void> unblockCardPin({required String walletId});
|
||||
|
||||
Future<void> renewCard({
|
||||
required String childProfileId,
|
||||
required String publicToken,
|
||||
required String scaProof,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user