activation key in legacy device setup
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import 'package:legacy_auth/src/core/data/models/device_response_model.dart';
|
import 'package:legacy_auth/src/core/data/models/device_response_model.dart';
|
||||||
|
|
||||||
abstract class LegacyDeviceSetupRemoteDatasource {
|
abstract class LegacyDeviceSetupRemoteDatasource {
|
||||||
|
Future<void> generateActivationKey({required String identificator});
|
||||||
|
|
||||||
Future<LegacyDeviceResponseModel> createDevice({
|
Future<LegacyDeviceResponseModel> createDevice({
|
||||||
required String name,
|
required String name,
|
||||||
required String genrer,
|
required String genrer,
|
||||||
|
|||||||
@@ -9,6 +9,16 @@ class LegacyDeviceSetupRemoteDatasourceImpl
|
|||||||
|
|
||||||
final QuestiaRepository _repository;
|
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
|
@override
|
||||||
Future<LegacyDeviceResponseModel> createDevice({
|
Future<LegacyDeviceResponseModel> createDevice({
|
||||||
required String name,
|
required String name,
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ class LegacyDeviceSetupRepositoryImpl implements LegacyDeviceSetupRepository {
|
|||||||
|
|
||||||
final LegacyDeviceSetupRemoteDatasource _remote;
|
final LegacyDeviceSetupRemoteDatasource _remote;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> generateActivationKey({required String identificator}) {
|
||||||
|
return _remote.generateActivationKey(identificator: identificator);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> createDevice({
|
Future<void> createDevice({
|
||||||
required String name,
|
required String name,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
abstract class LegacyDeviceSetupRepository {
|
abstract class LegacyDeviceSetupRepository {
|
||||||
|
Future<void> generateActivationKey({required String identificator});
|
||||||
|
|
||||||
Future<void> createDevice({
|
Future<void> createDevice({
|
||||||
required String name,
|
required String name,
|
||||||
required String genrer,
|
required String genrer,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:legacy_auth/src/features/device_setup/presentation/widgets/flow_
|
|||||||
import 'package:design_system/design_system.dart';
|
import 'package:design_system/design_system.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:navigation/app_routes.dart';
|
|
||||||
import 'package:navigation/navigation_contract.dart';
|
import 'package:navigation/navigation_contract.dart';
|
||||||
import 'package:sf_localizations/sf_localizations.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
|
|
||||||
@@ -81,7 +80,10 @@ class LegacyDeviceSetupScreen extends ConsumerWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: AnimatedSwitcher(
|
child: AnimatedSwitcher(
|
||||||
duration: const Duration(milliseconds: 250),
|
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 (!context.mounted) return;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(builder: (_) => LegacySuccessScreen()),
|
MaterialPageRoute(
|
||||||
|
builder: (_) => LegacySuccessScreen(
|
||||||
|
navigationContract: navigationContract,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vm.next();
|
await vm.next();
|
||||||
},
|
},
|
||||||
theme: theme,
|
theme: theme,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
late final TextEditingController weightController;
|
late final TextEditingController weightController;
|
||||||
late final TextEditingController heightController;
|
late final TextEditingController heightController;
|
||||||
late final TextEditingController watchCodeController;
|
late final TextEditingController watchCodeController;
|
||||||
|
late final TextEditingController activationKeyController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LegacyDeviceSetupViewState build() {
|
LegacyDeviceSetupViewState build() {
|
||||||
@@ -45,6 +46,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
weightController = TextEditingController(text: s.weight);
|
weightController = TextEditingController(text: s.weight);
|
||||||
heightController = TextEditingController(text: s.height);
|
heightController = TextEditingController(text: s.height);
|
||||||
watchCodeController = TextEditingController(text: s.watchCode);
|
watchCodeController = TextEditingController(text: s.watchCode);
|
||||||
|
activationKeyController = TextEditingController(text: s.activationKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addListeners() {
|
void _addListeners() {
|
||||||
@@ -54,9 +56,10 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
weightController.addListener(_onWeightChanged);
|
weightController.addListener(_onWeightChanged);
|
||||||
heightController.addListener(_onHeightChanged);
|
heightController.addListener(_onHeightChanged);
|
||||||
watchCodeController.addListener(_onWatchCodeChanged);
|
watchCodeController.addListener(_onWatchCodeChanged);
|
||||||
|
activationKeyController.addListener(_onActivationKeyChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next() {
|
Future<void> next() async {
|
||||||
switch (state.step) {
|
switch (state.step) {
|
||||||
case LegacyAddKidStep.intro:
|
case LegacyAddKidStep.intro:
|
||||||
state = state.copyWith(step: LegacyAddKidStep.linkInfo);
|
state = state.copyWith(step: LegacyAddKidStep.linkInfo);
|
||||||
@@ -65,19 +68,37 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
state = state.copyWith(step: LegacyAddKidStep.scanWatch);
|
state = state.copyWith(step: LegacyAddKidStep.scanWatch);
|
||||||
return;
|
return;
|
||||||
case LegacyAddKidStep.scanWatch:
|
case LegacyAddKidStep.scanWatch:
|
||||||
final hasWatch = state.watchQr.isNotEmpty || state.watchCode.isNotEmpty;
|
final identificator = state.watchCode.isNotEmpty ? state.watchCode : state.watchQr;
|
||||||
if (!hasWatch) {
|
if (identificator.isEmpty) {
|
||||||
state = state.copyWith(errorMessage: '');
|
state = state.copyWith(errorMessage: '');
|
||||||
state = state.copyWith(errorMessage: I18n.errorScanWatchRequired);
|
state = state.copyWith(errorMessage: I18n.errorScanWatchRequired);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state = state.copyWith(step: LegacyAddKidStep.profile, errorMessage: '');
|
await _generateActivationKey(identificator);
|
||||||
return;
|
return;
|
||||||
case LegacyAddKidStep.profile:
|
case LegacyAddKidStep.profile:
|
||||||
return;
|
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() {
|
void back() {
|
||||||
switch (state.step) {
|
switch (state.step) {
|
||||||
case LegacyAddKidStep.intro:
|
case LegacyAddKidStep.intro:
|
||||||
@@ -114,8 +135,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
final stepLength = (heightCm * 0.40).round();
|
final stepLength = (heightCm * 0.40).round();
|
||||||
final genrer = state.genrer.trim();
|
final genrer = state.genrer.trim();
|
||||||
final relationType = state.relationType.trim();
|
final relationType = state.relationType.trim();
|
||||||
final activationKey =
|
final activationKey = state.activationKey.trim();
|
||||||
state.watchCode.isNotEmpty ? state.watchCode : state.watchQr;
|
|
||||||
|
|
||||||
state = state.copyWith(isLoading: true);
|
state = state.copyWith(isLoading: true);
|
||||||
|
|
||||||
@@ -155,7 +175,8 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
state.weight.trim().isEmpty ||
|
state.weight.trim().isEmpty ||
|
||||||
int.tryParse(state.weight.trim()) == null ||
|
int.tryParse(state.weight.trim()) == null ||
|
||||||
state.height.trim().isEmpty ||
|
state.height.trim().isEmpty ||
|
||||||
double.tryParse(state.height.trim()) == null;
|
double.tryParse(state.height.trim()) == null ||
|
||||||
|
state.activationKey.trim().isEmpty;
|
||||||
|
|
||||||
if (isInvalid) {
|
if (isInvalid) {
|
||||||
state = state.copyWith(errorMessage: '');
|
state = state.copyWith(errorMessage: '');
|
||||||
@@ -213,6 +234,13 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
state = state.copyWith(watchCode: text, errorMessage: '');
|
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) {
|
void setError(String message) {
|
||||||
state = state.copyWith(errorMessage: message);
|
state = state.copyWith(errorMessage: message);
|
||||||
}
|
}
|
||||||
@@ -236,6 +264,7 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
weightController.clear();
|
weightController.clear();
|
||||||
heightController.clear();
|
heightController.clear();
|
||||||
watchCodeController.clear();
|
watchCodeController.clear();
|
||||||
|
activationKeyController.clear();
|
||||||
|
|
||||||
state = const LegacyDeviceSetupViewState();
|
state = const LegacyDeviceSetupViewState();
|
||||||
}
|
}
|
||||||
@@ -247,5 +276,6 @@ class LegacyDeviceSetupViewModel extends Notifier<LegacyDeviceSetupViewState> {
|
|||||||
weightController.dispose();
|
weightController.dispose();
|
||||||
heightController.dispose();
|
heightController.dispose();
|
||||||
watchCodeController.dispose();
|
watchCodeController.dispose();
|
||||||
|
activationKeyController.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ abstract class LegacyDeviceSetupViewState with _$LegacyDeviceSetupViewState {
|
|||||||
|
|
||||||
@Default('') String watchQr,
|
@Default('') String watchQr,
|
||||||
@Default('') String watchCode,
|
@Default('') String watchCode,
|
||||||
|
@Default('') String activationKey,
|
||||||
|
|
||||||
@Default(false) bool isLoading,
|
@Default(false) bool isLoading,
|
||||||
@Default('') String errorMessage,
|
@Default('') String errorMessage,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$LegacyDeviceSetupViewState {
|
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
|
/// Create a copy of LegacyDeviceSetupViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -25,16 +25,16 @@ $LegacyDeviceSetupViewStateCopyWith<LegacyDeviceSetupViewState> get copyWith =>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
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
|
@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
|
@override
|
||||||
String toString() {
|
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;
|
factory $LegacyDeviceSetupViewStateCopyWith(LegacyDeviceSetupViewState value, $Res Function(LegacyDeviceSetupViewState) _then) = _$LegacyDeviceSetupViewStateCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$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
|
/// Create a copy of LegacyDeviceSetupViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// 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(
|
return _then(_self.copyWith(
|
||||||
step: null == step ? _self.step : step // ignore: cast_nullable_to_non_nullable
|
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
|
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,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,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,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 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 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
|
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) {
|
switch (_that) {
|
||||||
case _AddKidFlowState() when $default != null:
|
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();
|
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) {
|
switch (_that) {
|
||||||
case _AddKidFlowState():
|
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');
|
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) {
|
switch (_that) {
|
||||||
case _AddKidFlowState() when $default != null:
|
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;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -218,7 +219,7 @@ return $default(_that.step,_that.firstName,_that.lastName,_that.bornAt,_that.gen
|
|||||||
|
|
||||||
|
|
||||||
class _AddKidFlowState implements LegacyDeviceSetupViewState {
|
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;
|
@override@JsonKey() final LegacyAddKidStep step;
|
||||||
@@ -231,6 +232,7 @@ class _AddKidFlowState implements LegacyDeviceSetupViewState {
|
|||||||
@override@JsonKey() final String height;
|
@override@JsonKey() final String height;
|
||||||
@override@JsonKey() final String watchQr;
|
@override@JsonKey() final String watchQr;
|
||||||
@override@JsonKey() final String watchCode;
|
@override@JsonKey() final String watchCode;
|
||||||
|
@override@JsonKey() final String activationKey;
|
||||||
@override@JsonKey() final bool isLoading;
|
@override@JsonKey() final bool isLoading;
|
||||||
@override@JsonKey() final String errorMessage;
|
@override@JsonKey() final String errorMessage;
|
||||||
@override@JsonKey() final bool isSuccess;
|
@override@JsonKey() final bool isSuccess;
|
||||||
@@ -245,16 +247,16 @@ _$AddKidFlowStateCopyWith<_AddKidFlowState> get copyWith => __$AddKidFlowStateCo
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
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
|
@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
|
@override
|
||||||
String toString() {
|
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;
|
factory _$AddKidFlowStateCopyWith(_AddKidFlowState value, $Res Function(_AddKidFlowState) _then) = __$AddKidFlowStateCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$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
|
/// Create a copy of LegacyDeviceSetupViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// 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(
|
return _then(_AddKidFlowState(
|
||||||
step: null == step ? _self.step : step // ignore: cast_nullable_to_non_nullable
|
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
|
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,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,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,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 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 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
|
as String,isSuccess: null == isSuccess ? _self.isSuccess : isSuccess // ignore: cast_nullable_to_non_nullable
|
||||||
|
|||||||
@@ -144,6 +144,14 @@ class LegacyProfileStepScreen extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|
||||||
|
CustomTextField(
|
||||||
|
label: context.translate(I18n.activationKeyLabel),
|
||||||
|
hint: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
|
||||||
|
controller: vm.activationKeyController,
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 8),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ import 'package:legacy_auth/src/features/device_setup/presentation/widgets/flow_
|
|||||||
import 'package:design_system/design_system.dart';
|
import 'package:design_system/design_system.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:navigation/navigation.dart';
|
||||||
import 'package:sf_localizations/sf_localizations.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
|
|
||||||
class LegacySuccessScreen extends ConsumerWidget {
|
class LegacySuccessScreen extends ConsumerWidget {
|
||||||
const LegacySuccessScreen({super.key});
|
final NavigationContract navigationContract;
|
||||||
|
|
||||||
|
const LegacySuccessScreen({super.key, required this.navigationContract});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
@@ -58,7 +61,7 @@ class LegacySuccessScreen extends ConsumerWidget {
|
|||||||
LegacyFlowFooter(
|
LegacyFlowFooter(
|
||||||
primaryText: context.translate(I18n.continueKey),
|
primaryText: context.translate(I18n.continueKey),
|
||||||
onPrimary: () {
|
onPrimary: () {
|
||||||
Navigator.of(context).pop();
|
navigationContract.goTo(AppRoutes.controlPanel);
|
||||||
},
|
},
|
||||||
secondaryText: context.translate(I18n.deviceSetup_addAnotherKid),
|
secondaryText: context.translate(I18n.deviceSetup_addAnotherKid),
|
||||||
onSecondary: () {
|
onSecondary: () {
|
||||||
|
|||||||
@@ -487,5 +487,6 @@
|
|||||||
"deviceSetup_weightLabel": "Gewicht (kg)",
|
"deviceSetup_weightLabel": "Gewicht (kg)",
|
||||||
"deviceSetup_weightHint": "30",
|
"deviceSetup_weightHint": "30",
|
||||||
"deviceSetup_heightLabel": "Größe (cm)",
|
"deviceSetup_heightLabel": "Größe (cm)",
|
||||||
"deviceSetup_heightHint": "120"
|
"deviceSetup_heightHint": "120",
|
||||||
|
"activationKeyLabel": "Aktivierungsschlüssel"
|
||||||
}
|
}
|
||||||
@@ -543,5 +543,6 @@
|
|||||||
"deviceSetup_weightLabel": "Weight (kg)",
|
"deviceSetup_weightLabel": "Weight (kg)",
|
||||||
"deviceSetup_weightHint": "30",
|
"deviceSetup_weightHint": "30",
|
||||||
"deviceSetup_heightLabel": "Height (cm)",
|
"deviceSetup_heightLabel": "Height (cm)",
|
||||||
"deviceSetup_heightHint": "120"
|
"deviceSetup_heightHint": "120",
|
||||||
|
"activationKeyLabel": "Activation key"
|
||||||
}
|
}
|
||||||
@@ -539,5 +539,6 @@
|
|||||||
"deviceSetup_weightLabel": "Peso (kg)",
|
"deviceSetup_weightLabel": "Peso (kg)",
|
||||||
"deviceSetup_weightHint": "30",
|
"deviceSetup_weightHint": "30",
|
||||||
"deviceSetup_heightLabel": "Altura (cm)",
|
"deviceSetup_heightLabel": "Altura (cm)",
|
||||||
"deviceSetup_heightHint": "120"
|
"deviceSetup_heightHint": "120",
|
||||||
|
"activationKeyLabel": "Clave de activación"
|
||||||
}
|
}
|
||||||
@@ -487,5 +487,6 @@
|
|||||||
"deviceSetup_weightLabel": "Poids (kg)",
|
"deviceSetup_weightLabel": "Poids (kg)",
|
||||||
"deviceSetup_weightHint": "30",
|
"deviceSetup_weightHint": "30",
|
||||||
"deviceSetup_heightLabel": "Taille (cm)",
|
"deviceSetup_heightLabel": "Taille (cm)",
|
||||||
"deviceSetup_heightHint": "120"
|
"deviceSetup_heightHint": "120",
|
||||||
|
"activationKeyLabel": "Clé d'activation"
|
||||||
}
|
}
|
||||||
@@ -487,5 +487,6 @@
|
|||||||
"deviceSetup_weightLabel": "Peso (kg)",
|
"deviceSetup_weightLabel": "Peso (kg)",
|
||||||
"deviceSetup_weightHint": "30",
|
"deviceSetup_weightHint": "30",
|
||||||
"deviceSetup_heightLabel": "Altezza (cm)",
|
"deviceSetup_heightLabel": "Altezza (cm)",
|
||||||
"deviceSetup_heightHint": "120"
|
"deviceSetup_heightHint": "120",
|
||||||
|
"activationKeyLabel": "Chiave di attivazione"
|
||||||
}
|
}
|
||||||
@@ -487,5 +487,6 @@
|
|||||||
"deviceSetup_weightLabel": "Peso (kg)",
|
"deviceSetup_weightLabel": "Peso (kg)",
|
||||||
"deviceSetup_weightHint": "30",
|
"deviceSetup_weightHint": "30",
|
||||||
"deviceSetup_heightLabel": "Altura (cm)",
|
"deviceSetup_heightLabel": "Altura (cm)",
|
||||||
"deviceSetup_heightHint": "120"
|
"deviceSetup_heightHint": "120",
|
||||||
|
"activationKeyLabel": "Chave de ativação"
|
||||||
}
|
}
|
||||||
@@ -660,4 +660,5 @@ class I18n {
|
|||||||
static const String deviceSetup_weightHint = 'deviceSetup_weightHint';
|
static const String deviceSetup_weightHint = 'deviceSetup_weightHint';
|
||||||
static const String deviceSetup_heightLabel = 'deviceSetup_heightLabel';
|
static const String deviceSetup_heightLabel = 'deviceSetup_heightLabel';
|
||||||
static const String deviceSetup_heightHint = 'deviceSetup_heightHint';
|
static const String deviceSetup_heightHint = 'deviceSetup_heightHint';
|
||||||
|
static const String activationKeyLabel = 'activationKeyLabel';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user