activation key in legacy device setup

This commit is contained in:
2026-03-09 15:32:53 +01:00
parent fd8574e631
commit e4000d57fc
17 changed files with 114 additions and 37 deletions

View File

@@ -1,6 +1,8 @@
import 'package:legacy_auth/src/core/data/models/device_response_model.dart';
abstract class LegacyDeviceSetupRemoteDatasource {
Future<void> generateActivationKey({required String identificator});
Future<LegacyDeviceResponseModel> createDevice({
required String name,
required String genrer,

View File

@@ -9,6 +9,16 @@ class LegacyDeviceSetupRemoteDatasourceImpl
final QuestiaRepository _repository;
@override
Future<void> generateActivationKey({required String identificator}) async {
await safeCall(
() => _repository.post<dynamic>(
'/recorded-devices/$identificator/activation-key',
),
'Error generating activation key',
);
}
@override
Future<LegacyDeviceResponseModel> createDevice({
required String name,

View File

@@ -6,6 +6,11 @@ class LegacyDeviceSetupRepositoryImpl implements LegacyDeviceSetupRepository {
final LegacyDeviceSetupRemoteDatasource _remote;
@override
Future<void> generateActivationKey({required String identificator}) {
return _remote.generateActivationKey(identificator: identificator);
}
@override
Future<void> createDevice({
required String name,

View File

@@ -1,4 +1,6 @@
abstract class LegacyDeviceSetupRepository {
Future<void> generateActivationKey({required String identificator});
Future<void> createDevice({
required String name,
required String genrer,

View File

@@ -6,7 +6,6 @@ import 'package:legacy_auth/src/features/device_setup/presentation/widgets/flow_
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/app_routes.dart';
import 'package:navigation/navigation_contract.dart';
import 'package:sf_localizations/sf_localizations.dart';
@@ -81,7 +80,10 @@ class LegacyDeviceSetupScreen extends ConsumerWidget {
Expanded(
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
child: LegacyStepBody(key: ValueKey(state.step), state: state),
child: LegacyStepBody(
key: ValueKey(state.step),
state: state,
),
),
),
@@ -94,12 +96,16 @@ class LegacyDeviceSetupScreen extends ConsumerWidget {
if (!context.mounted) return;
if (ok) {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => LegacySuccessScreen()),
MaterialPageRoute(
builder: (_) => LegacySuccessScreen(
navigationContract: navigationContract,
),
),
);
}
return;
}
vm.next();
await vm.next();
},
theme: theme,
),

View File

@@ -22,6 +22,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
late final TextEditingController weightController;
late final TextEditingController heightController;
late final TextEditingController watchCodeController;
late final TextEditingController activationKeyController;
@override
LegacyDeviceSetupViewState build() {
@@ -45,6 +46,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
weightController = TextEditingController(text: s.weight);
heightController = TextEditingController(text: s.height);
watchCodeController = TextEditingController(text: s.watchCode);
activationKeyController = TextEditingController(text: s.activationKey);
}
void _addListeners() {
@@ -54,9 +56,10 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
weightController.addListener(_onWeightChanged);
heightController.addListener(_onHeightChanged);
watchCodeController.addListener(_onWatchCodeChanged);
activationKeyController.addListener(_onActivationKeyChanged);
}
void next() {
Future<void> next() async {
switch (state.step) {
case LegacyAddKidStep.intro:
state = state.copyWith(step: LegacyAddKidStep.linkInfo);
@@ -65,19 +68,37 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
state = state.copyWith(step: LegacyAddKidStep.scanWatch);
return;
case LegacyAddKidStep.scanWatch:
final hasWatch = state.watchQr.isNotEmpty || state.watchCode.isNotEmpty;
if (!hasWatch) {
final identificator = state.watchCode.isNotEmpty ? state.watchCode : state.watchQr;
if (identificator.isEmpty) {
state = state.copyWith(errorMessage: '');
state = state.copyWith(errorMessage: I18n.errorScanWatchRequired);
return;
}
state = state.copyWith(step: LegacyAddKidStep.profile, errorMessage: '');
await _generateActivationKey(identificator);
return;
case LegacyAddKidStep.profile:
return;
}
}
Future<void> _generateActivationKey(String identificator) async {
state = state.copyWith(isLoading: true, errorMessage: '');
try {
await _deviceSetupRepository.generateActivationKey(identificator: identificator);
if (!ref.mounted) return;
state = state.copyWith(
isLoading: false,
step: LegacyAddKidStep.profile,
);
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(
isLoading: false,
errorMessage: e.toString(),
);
}
}
void back() {
switch (state.step) {
case LegacyAddKidStep.intro:
@@ -114,8 +135,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
final stepLength = (heightCm * 0.40).round();
final genrer = state.genrer.trim();
final relationType = state.relationType.trim();
final activationKey =
state.watchCode.isNotEmpty ? state.watchCode : state.watchQr;
final activationKey = state.activationKey.trim();
state = state.copyWith(isLoading: true);
@@ -155,7 +175,8 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
state.weight.trim().isEmpty ||
int.tryParse(state.weight.trim()) == null ||
state.height.trim().isEmpty ||
double.tryParse(state.height.trim()) == null;
double.tryParse(state.height.trim()) == null ||
state.activationKey.trim().isEmpty;
if (isInvalid) {
state = state.copyWith(errorMessage: '');
@@ -213,6 +234,13 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
state = state.copyWith(watchCode: text, errorMessage: '');
}
void _onActivationKeyChanged() {
toUpperCaseController(activationKeyController);
final text = activationKeyController.text;
if (text == state.activationKey) return;
state = state.copyWith(activationKey: text, errorMessage: '');
}
void setError(String message) {
state = state.copyWith(errorMessage: message);
}
@@ -236,6 +264,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
weightController.clear();
heightController.clear();
watchCodeController.clear();
activationKeyController.clear();
state = const LegacyDeviceSetupViewState();
}
@@ -247,5 +276,6 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
weightController.dispose();
heightController.dispose();
watchCodeController.dispose();
activationKeyController.dispose();
}
}

View File

@@ -17,6 +17,7 @@ abstract class LegacyDeviceSetupViewState with _$LegacyDeviceSetupViewState {
@Default('') String watchQr,
@Default('') String watchCode,
@Default('') String activationKey,
@Default(false) bool isLoading,
@Default('') String errorMessage,

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$LegacyDeviceSetupViewState {
LegacyAddKidStep get step; String get firstName; String get lastName; DateTime? get bornAt; String get genrer; String get relationType; String get weight; String get height; String get watchQr; String get watchCode; bool get isLoading; String get errorMessage; bool get isSuccess;
LegacyAddKidStep get step; String get firstName; String get lastName; DateTime? get bornAt; String get genrer; String get relationType; String get weight; String get height; String get watchQr; String get watchCode; String get activationKey; bool get isLoading; String get errorMessage; bool get isSuccess;
/// Create a copy of LegacyDeviceSetupViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $LegacyDeviceSetupViewStateCopyWith<LegacyDeviceSetupViewState> get copyWith =>
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyDeviceSetupViewState&&(identical(other.step, step) || other.step == step)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.genrer, genrer) || other.genrer == genrer)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.height, height) || other.height == height)&&(identical(other.watchQr, watchQr) || other.watchQr == watchQr)&&(identical(other.watchCode, watchCode) || other.watchCode == watchCode)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isSuccess, isSuccess) || other.isSuccess == isSuccess));
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyDeviceSetupViewState&&(identical(other.step, step) || other.step == step)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.genrer, genrer) || other.genrer == genrer)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.height, height) || other.height == height)&&(identical(other.watchQr, watchQr) || other.watchQr == watchQr)&&(identical(other.watchCode, watchCode) || other.watchCode == watchCode)&&(identical(other.activationKey, activationKey) || other.activationKey == activationKey)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isSuccess, isSuccess) || other.isSuccess == isSuccess));
}
@override
int get hashCode => Object.hash(runtimeType,step,firstName,lastName,bornAt,genrer,relationType,weight,height,watchQr,watchCode,isLoading,errorMessage,isSuccess);
int get hashCode => Object.hash(runtimeType,step,firstName,lastName,bornAt,genrer,relationType,weight,height,watchQr,watchCode,activationKey,isLoading,errorMessage,isSuccess);
@override
String toString() {
return 'LegacyDeviceSetupViewState(step: $step, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, genrer: $genrer, relationType: $relationType, weight: $weight, height: $height, watchQr: $watchQr, watchCode: $watchCode, isLoading: $isLoading, errorMessage: $errorMessage, isSuccess: $isSuccess)';
return 'LegacyDeviceSetupViewState(step: $step, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, genrer: $genrer, relationType: $relationType, weight: $weight, height: $height, watchQr: $watchQr, watchCode: $watchCode, activationKey: $activationKey, isLoading: $isLoading, errorMessage: $errorMessage, isSuccess: $isSuccess)';
}
@@ -45,7 +45,7 @@ abstract mixin class $LegacyDeviceSetupViewStateCopyWith<$Res> {
factory $LegacyDeviceSetupViewStateCopyWith(LegacyDeviceSetupViewState value, $Res Function(LegacyDeviceSetupViewState) _then) = _$LegacyDeviceSetupViewStateCopyWithImpl;
@useResult
$Res call({
LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, bool isLoading, String errorMessage, bool isSuccess
LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, String activationKey, bool isLoading, String errorMessage, bool isSuccess
});
@@ -62,7 +62,7 @@ class _$LegacyDeviceSetupViewStateCopyWithImpl<$Res>
/// Create a copy of LegacyDeviceSetupViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? step = null,Object? firstName = null,Object? lastName = null,Object? bornAt = freezed,Object? genrer = null,Object? relationType = null,Object? weight = null,Object? height = null,Object? watchQr = null,Object? watchCode = null,Object? isLoading = null,Object? errorMessage = null,Object? isSuccess = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? step = null,Object? firstName = null,Object? lastName = null,Object? bornAt = freezed,Object? genrer = null,Object? relationType = null,Object? weight = null,Object? height = null,Object? watchQr = null,Object? watchCode = null,Object? activationKey = null,Object? isLoading = null,Object? errorMessage = null,Object? isSuccess = null,}) {
return _then(_self.copyWith(
step: null == step ? _self.step : step // ignore: cast_nullable_to_non_nullable
as LegacyAddKidStep,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
@@ -74,6 +74,7 @@ as String,weight: null == weight ? _self.weight : weight // ignore: cast_nullabl
as String,height: null == height ? _self.height : height // ignore: cast_nullable_to_non_nullable
as String,watchQr: null == watchQr ? _self.watchQr : watchQr // ignore: cast_nullable_to_non_nullable
as String,watchCode: null == watchCode ? _self.watchCode : watchCode // ignore: cast_nullable_to_non_nullable
as String,activationKey: null == activationKey ? _self.activationKey : activationKey // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isSuccess: null == isSuccess ? _self.isSuccess : isSuccess // ignore: cast_nullable_to_non_nullable
@@ -162,10 +163,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, bool isLoading, String errorMessage, bool isSuccess)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, String activationKey, bool isLoading, String errorMessage, bool isSuccess)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AddKidFlowState() when $default != null:
return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.genrer,_that.relationType,_that.weight,_that.height,_that.watchQr,_that.watchCode,_that.isLoading,_that.errorMessage,_that.isSuccess);case _:
return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.genrer,_that.relationType,_that.weight,_that.height,_that.watchQr,_that.watchCode,_that.activationKey,_that.isLoading,_that.errorMessage,_that.isSuccess);case _:
return orElse();
}
@@ -183,10 +184,10 @@ return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.gen
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, bool isLoading, String errorMessage, bool isSuccess) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, String activationKey, bool isLoading, String errorMessage, bool isSuccess) $default,) {final _that = this;
switch (_that) {
case _AddKidFlowState():
return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.genrer,_that.relationType,_that.weight,_that.height,_that.watchQr,_that.watchCode,_that.isLoading,_that.errorMessage,_that.isSuccess);case _:
return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.genrer,_that.relationType,_that.weight,_that.height,_that.watchQr,_that.watchCode,_that.activationKey,_that.isLoading,_that.errorMessage,_that.isSuccess);case _:
throw StateError('Unexpected subclass');
}
@@ -203,10 +204,10 @@ return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.gen
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, bool isLoading, String errorMessage, bool isSuccess)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, String activationKey, bool isLoading, String errorMessage, bool isSuccess)? $default,) {final _that = this;
switch (_that) {
case _AddKidFlowState() when $default != null:
return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.genrer,_that.relationType,_that.weight,_that.height,_that.watchQr,_that.watchCode,_that.isLoading,_that.errorMessage,_that.isSuccess);case _:
return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.genrer,_that.relationType,_that.weight,_that.height,_that.watchQr,_that.watchCode,_that.activationKey,_that.isLoading,_that.errorMessage,_that.isSuccess);case _:
return null;
}
@@ -218,7 +219,7 @@ return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.gen
class _AddKidFlowState implements LegacyDeviceSetupViewState {
const _AddKidFlowState({this.step = LegacyAddKidStep.intro, this.firstName = '', this.lastName = '', this.bornAt, this.genrer = '', this.relationType = '', this.weight = '', this.height = '', this.watchQr = '', this.watchCode = '', this.isLoading = false, this.errorMessage = '', this.isSuccess = false});
const _AddKidFlowState({this.step = LegacyAddKidStep.intro, this.firstName = '', this.lastName = '', this.bornAt, this.genrer = '', this.relationType = '', this.weight = '', this.height = '', this.watchQr = '', this.watchCode = '', this.activationKey = '', this.isLoading = false, this.errorMessage = '', this.isSuccess = false});
@override@JsonKey() final LegacyAddKidStep step;
@@ -231,6 +232,7 @@ class _AddKidFlowState implements LegacyDeviceSetupViewState {
@override@JsonKey() final String height;
@override@JsonKey() final String watchQr;
@override@JsonKey() final String watchCode;
@override@JsonKey() final String activationKey;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final String errorMessage;
@override@JsonKey() final bool isSuccess;
@@ -245,16 +247,16 @@ _$AddKidFlowStateCopyWith<_AddKidFlowState> get copyWith => __$AddKidFlowStateCo
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AddKidFlowState&&(identical(other.step, step) || other.step == step)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.genrer, genrer) || other.genrer == genrer)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.height, height) || other.height == height)&&(identical(other.watchQr, watchQr) || other.watchQr == watchQr)&&(identical(other.watchCode, watchCode) || other.watchCode == watchCode)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isSuccess, isSuccess) || other.isSuccess == isSuccess));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AddKidFlowState&&(identical(other.step, step) || other.step == step)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.genrer, genrer) || other.genrer == genrer)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.height, height) || other.height == height)&&(identical(other.watchQr, watchQr) || other.watchQr == watchQr)&&(identical(other.watchCode, watchCode) || other.watchCode == watchCode)&&(identical(other.activationKey, activationKey) || other.activationKey == activationKey)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isSuccess, isSuccess) || other.isSuccess == isSuccess));
}
@override
int get hashCode => Object.hash(runtimeType,step,firstName,lastName,bornAt,genrer,relationType,weight,height,watchQr,watchCode,isLoading,errorMessage,isSuccess);
int get hashCode => Object.hash(runtimeType,step,firstName,lastName,bornAt,genrer,relationType,weight,height,watchQr,watchCode,activationKey,isLoading,errorMessage,isSuccess);
@override
String toString() {
return 'LegacyDeviceSetupViewState(step: $step, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, genrer: $genrer, relationType: $relationType, weight: $weight, height: $height, watchQr: $watchQr, watchCode: $watchCode, isLoading: $isLoading, errorMessage: $errorMessage, isSuccess: $isSuccess)';
return 'LegacyDeviceSetupViewState(step: $step, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, genrer: $genrer, relationType: $relationType, weight: $weight, height: $height, watchQr: $watchQr, watchCode: $watchCode, activationKey: $activationKey, isLoading: $isLoading, errorMessage: $errorMessage, isSuccess: $isSuccess)';
}
@@ -265,7 +267,7 @@ abstract mixin class _$AddKidFlowStateCopyWith<$Res> implements $LegacyDeviceSet
factory _$AddKidFlowStateCopyWith(_AddKidFlowState value, $Res Function(_AddKidFlowState) _then) = __$AddKidFlowStateCopyWithImpl;
@override @useResult
$Res call({
LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, bool isLoading, String errorMessage, bool isSuccess
LegacyAddKidStep step, String firstName, String lastName, DateTime? bornAt, String genrer, String relationType, String weight, String height, String watchQr, String watchCode, String activationKey, bool isLoading, String errorMessage, bool isSuccess
});
@@ -282,7 +284,7 @@ class __$AddKidFlowStateCopyWithImpl<$Res>
/// Create a copy of LegacyDeviceSetupViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? step = null,Object? firstName = null,Object? lastName = null,Object? bornAt = freezed,Object? genrer = null,Object? relationType = null,Object? weight = null,Object? height = null,Object? watchQr = null,Object? watchCode = null,Object? isLoading = null,Object? errorMessage = null,Object? isSuccess = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? step = null,Object? firstName = null,Object? lastName = null,Object? bornAt = freezed,Object? genrer = null,Object? relationType = null,Object? weight = null,Object? height = null,Object? watchQr = null,Object? watchCode = null,Object? activationKey = null,Object? isLoading = null,Object? errorMessage = null,Object? isSuccess = null,}) {
return _then(_AddKidFlowState(
step: null == step ? _self.step : step // ignore: cast_nullable_to_non_nullable
as LegacyAddKidStep,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
@@ -294,6 +296,7 @@ as String,weight: null == weight ? _self.weight : weight // ignore: cast_nullabl
as String,height: null == height ? _self.height : height // ignore: cast_nullable_to_non_nullable
as String,watchQr: null == watchQr ? _self.watchQr : watchQr // ignore: cast_nullable_to_non_nullable
as String,watchCode: null == watchCode ? _self.watchCode : watchCode // ignore: cast_nullable_to_non_nullable
as String,activationKey: null == activationKey ? _self.activationKey : activationKey // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isSuccess: null == isSuccess ? _self.isSuccess : isSuccess // ignore: cast_nullable_to_non_nullable

View File

@@ -144,6 +144,14 @@ class LegacyProfileStepScreen extends ConsumerWidget {
),
const SizedBox(height: 8),
CustomTextField(
label: context.translate(I18n.activationKeyLabel),
hint: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
controller: vm.activationKeyController,
),
const SizedBox(height: 8),
],
),
),

View File

@@ -3,10 +3,13 @@ import 'package:legacy_auth/src/features/device_setup/presentation/widgets/flow_
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';
class LegacySuccessScreen extends ConsumerWidget {
const LegacySuccessScreen({super.key});
final NavigationContract navigationContract;
const LegacySuccessScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -58,7 +61,7 @@ class LegacySuccessScreen extends ConsumerWidget {
LegacyFlowFooter(
primaryText: context.translate(I18n.continueKey),
onPrimary: () {
Navigator.of(context).pop();
navigationContract.goTo(AppRoutes.controlPanel);
},
secondaryText: context.translate(I18n.deviceSetup_addAnotherKid),
onSecondary: () {

View File

@@ -487,5 +487,6 @@
"deviceSetup_weightLabel": "Gewicht (kg)",
"deviceSetup_weightHint": "30",
"deviceSetup_heightLabel": "Größe (cm)",
"deviceSetup_heightHint": "120"
"deviceSetup_heightHint": "120",
"activationKeyLabel": "Aktivierungsschlüssel"
}

View File

@@ -543,5 +543,6 @@
"deviceSetup_weightLabel": "Weight (kg)",
"deviceSetup_weightHint": "30",
"deviceSetup_heightLabel": "Height (cm)",
"deviceSetup_heightHint": "120"
"deviceSetup_heightHint": "120",
"activationKeyLabel": "Activation key"
}

View File

@@ -539,5 +539,6 @@
"deviceSetup_weightLabel": "Peso (kg)",
"deviceSetup_weightHint": "30",
"deviceSetup_heightLabel": "Altura (cm)",
"deviceSetup_heightHint": "120"
"deviceSetup_heightHint": "120",
"activationKeyLabel": "Clave de activación"
}

View File

@@ -487,5 +487,6 @@
"deviceSetup_weightLabel": "Poids (kg)",
"deviceSetup_weightHint": "30",
"deviceSetup_heightLabel": "Taille (cm)",
"deviceSetup_heightHint": "120"
"deviceSetup_heightHint": "120",
"activationKeyLabel": "Clé d'activation"
}

View File

@@ -487,5 +487,6 @@
"deviceSetup_weightLabel": "Peso (kg)",
"deviceSetup_weightHint": "30",
"deviceSetup_heightLabel": "Altezza (cm)",
"deviceSetup_heightHint": "120"
"deviceSetup_heightHint": "120",
"activationKeyLabel": "Chiave di attivazione"
}

View File

@@ -487,5 +487,6 @@
"deviceSetup_weightLabel": "Peso (kg)",
"deviceSetup_weightHint": "30",
"deviceSetup_heightLabel": "Altura (cm)",
"deviceSetup_heightHint": "120"
"deviceSetup_heightHint": "120",
"activationKeyLabel": "Chave de ativação"
}

View File

@@ -660,4 +660,5 @@ class I18n {
static const String deviceSetup_weightHint = 'deviceSetup_weightHint';
static const String deviceSetup_heightLabel = 'deviceSetup_heightLabel';
static const String deviceSetup_heightHint = 'deviceSetup_heightHint';
static const String activationKeyLabel = 'activationKeyLabel';
}