Compare commits
2 Commits
feature/so
...
feature/re
| Author | SHA1 | Date | |
|---|---|---|---|
| 48cb23379c | |||
| 48d2430c9c |
@@ -1,7 +0,0 @@
|
|||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
|
||||||
|
|
||||||
abstract class FunctionsRemoteDatasource {
|
|
||||||
Future<List<PictureEntity>> getPictures({required String userId});
|
|
||||||
|
|
||||||
Future<PictureEntity> takePicture({required String userId});
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||||
|
|
||||||
|
abstract class PicturesRemoteDatasource {
|
||||||
|
Future<List<PictureEntity>> getPictures({required String deviceId});
|
||||||
|
|
||||||
|
Future<PictureEntity> takePicture({required String deviceId});
|
||||||
|
}
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
import 'package:device_management/src/core/data/datasources/functions_remote_datasource.dart';
|
import 'package:device_management/src/core/data/datasources/pictures_remote_datasource.dart';
|
||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource {
|
class PicturesRemoteDatasourceImpl implements PicturesRemoteDatasource {
|
||||||
FunctionsRemoteDatasourceImpl(this._repository);
|
PicturesRemoteDatasourceImpl(this._repository);
|
||||||
|
|
||||||
final QuestiaRepository _repository;
|
final QuestiaRepository _repository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<PictureEntity>> getPictures({required String userId}) async {
|
Future<List<PictureEntity>> getPictures({required String deviceId}) async {
|
||||||
/*try {
|
/*try {
|
||||||
final response = await _repository.get<Map<String, dynamic>>(
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
'',
|
'/devices/identificator/$deviceId/photos',
|
||||||
);
|
);
|
||||||
|
|
||||||
final data = response.data;
|
final data = response.data;
|
||||||
@@ -28,7 +30,7 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<PictureEntity> takePicture({required String userId}) async {
|
Future<PictureEntity> takePicture({required String deviceId}) async {
|
||||||
/*try {
|
/*try {
|
||||||
final response = await _repository.get<Map<String, dynamic>>(
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
'',
|
'',
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import 'package:device_management/src/core/data/datasources/functions_remote_datasource.dart';
|
|
||||||
import 'package:device_management/src/core/domain/repositories/functions_repository.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
|
||||||
|
|
||||||
class FunctionsRepositoryImpl implements FunctionsRepository {
|
|
||||||
const FunctionsRepositoryImpl(this._remote);
|
|
||||||
|
|
||||||
final FunctionsRemoteDatasource _remote;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<PictureEntity>> getPictures({required String userId}) async {
|
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 2000));
|
|
||||||
return _remote.getPictures(userId: userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<PictureEntity> takePicture({required String userId}) async {
|
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 2000));
|
|
||||||
return _remote.takePicture(userId: userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||||
|
|
||||||
|
import '../../domain/repositories/pictures_repository.dart';
|
||||||
|
import '../datasources/pictures_remote_datasource.dart';
|
||||||
|
|
||||||
|
class PicturesRepositoryImpl implements PicturesRepository {
|
||||||
|
const PicturesRepositoryImpl(this._remote);
|
||||||
|
|
||||||
|
final PicturesRemoteDatasource _remote;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<PictureEntity>> getPictures({required String deviceId}) async {
|
||||||
|
await Future<void>.delayed(const Duration(milliseconds: 2000));
|
||||||
|
return _remote.getPictures(deviceId: deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<PictureEntity> takePicture({required String deviceId}) async {
|
||||||
|
await Future<void>.delayed(const Duration(milliseconds: 2000));
|
||||||
|
return _remote.takePicture(deviceId: deviceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
|
||||||
|
|
||||||
abstract class FunctionsRepository {
|
|
||||||
Future<List<PictureEntity>> getPictures({required String userId});
|
|
||||||
|
|
||||||
Future<PictureEntity> takePicture({required String userId});
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||||
|
|
||||||
|
abstract class PicturesRepository {
|
||||||
|
Future<List<PictureEntity>> getPictures({required String deviceId});
|
||||||
|
|
||||||
|
Future<PictureEntity> takePicture({required String deviceId});
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
import 'package:device_management/src/core/data/datasources/functions_remote_datasource.dart';
|
|
||||||
import 'package:device_management/src/core/data/datasources/functions_remote_datasource_impl.dart';
|
|
||||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
|
||||||
|
|
||||||
final functionsRemoteDatasourceProvider = Provider<FunctionsRemoteDatasource>((ref) {
|
|
||||||
final questiaRepository = getIt<QuestiaRepository>();
|
|
||||||
return FunctionsRemoteDatasourceImpl(questiaRepository);
|
|
||||||
});
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
import 'package:device_management/src/core/providers/functions_remote_datasource_provider.dart';
|
|
||||||
import 'package:device_management/src/core/data/repositories/functions_repository_impl.dart';
|
|
||||||
import 'package:device_management/src/core/domain/repositories/functions_repository.dart';
|
|
||||||
|
|
||||||
final functionsRepositoryProvider = Provider<FunctionsRepository>((ref) {
|
|
||||||
final remote = ref.read(functionsRemoteDatasourceProvider);
|
|
||||||
return FunctionsRepositoryImpl(remote);
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
import '../data/datasources/pictures_remote_datasource.dart';
|
||||||
|
import '../data/datasources/pictures_remote_datasource_impl.dart';
|
||||||
|
|
||||||
|
final picturesRemoteDatasourceProvider = Provider<PicturesRemoteDatasource>((ref) {
|
||||||
|
final questiaRepository = getIt<QuestiaRepository>();
|
||||||
|
return PicturesRemoteDatasourceImpl(questiaRepository);
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import '../data/repositories/pictures_repository_impl.dart';
|
||||||
|
import '../domain/repositories/pictures_repository.dart';
|
||||||
|
import 'pictures_remote_datasource_provider.dart';
|
||||||
|
|
||||||
|
final picturesRepositoryProvider = Provider<PicturesRepository>((ref) {
|
||||||
|
final remote = ref.read(picturesRemoteDatasourceProvider);
|
||||||
|
return PicturesRepositoryImpl(remote);
|
||||||
|
});
|
||||||
@@ -27,14 +27,14 @@ class DeviceManagementScreen extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// AppMenuButton(
|
AppMenuButton(
|
||||||
// color: theme.getColorFor(ThemeCode.legacyPrimary),
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
// onPressed: () =>
|
onPressed: () =>
|
||||||
// navigationContract.pushTo(AppRoutes.remoteConnection),
|
navigationContract.pushTo(AppRoutes.remoteConnection),
|
||||||
// icon: SFIcons.connection,
|
icon: SFIcons.connection,
|
||||||
// text: context.translate(I18n.remoteConnection),
|
text: context.translate(I18n.remoteConnection),
|
||||||
// ),
|
),
|
||||||
// SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||||
AppMenuButton(
|
AppMenuButton(
|
||||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
|
||||||
|
|
||||||
abstract class GetPicturesUseCase {
|
|
||||||
Future<List<PictureEntity>> getPictures({required String userId});
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import 'package:device_management/src/core/domain/repositories/functions_repository.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/get_pictures_use_case.dart';
|
|
||||||
|
|
||||||
class GetPicturesUseCaseImpl implements GetPicturesUseCase {
|
|
||||||
GetPicturesUseCaseImpl(this._repository);
|
|
||||||
|
|
||||||
final FunctionsRepository _repository;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<PictureEntity>> getPictures({required String userId}) async {
|
|
||||||
// return _repository.getPictures(userId: userId);
|
|
||||||
return [
|
|
||||||
PictureEntity(
|
|
||||||
id: '1',
|
|
||||||
deviceId: '1111',
|
|
||||||
createdAt: DateTime.now(),
|
|
||||||
asset: 'assets/shared/images/iso_sf.png',
|
|
||||||
takenAt: DateTime.now(),
|
|
||||||
),
|
|
||||||
PictureEntity(
|
|
||||||
id: '2',
|
|
||||||
deviceId: '1111',
|
|
||||||
createdAt: DateTime.now(),
|
|
||||||
asset: 'assets/shared/images/iso_sf.png',
|
|
||||||
takenAt: DateTime.now(),
|
|
||||||
),
|
|
||||||
PictureEntity(
|
|
||||||
id: '3',
|
|
||||||
deviceId: '1111',
|
|
||||||
createdAt: DateTime.now(),
|
|
||||||
asset: 'assets/shared/images/iso_sf.png',
|
|
||||||
takenAt: DateTime.now(),
|
|
||||||
),
|
|
||||||
PictureEntity(
|
|
||||||
id: '4',
|
|
||||||
deviceId: '1111',
|
|
||||||
createdAt: DateTime.now(),
|
|
||||||
asset: 'assets/shared/images/iso_sf.png',
|
|
||||||
takenAt: DateTime.now(),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
|
||||||
|
|
||||||
abstract class TakePictureUseCase {
|
|
||||||
Future<PictureEntity> takePicture({required String userId});
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import 'package:device_management/src/core/domain/repositories/functions_repository.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/take_picture_use_case.dart';
|
|
||||||
|
|
||||||
class TakePictureUseCaseImpl implements TakePictureUseCase {
|
|
||||||
TakePictureUseCaseImpl(this._repository);
|
|
||||||
|
|
||||||
final FunctionsRepository _repository;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<PictureEntity> takePicture({required String userId}) {
|
|
||||||
return _repository.takePicture(userId: userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
import 'package:device_management/src/core/providers/functions_repository_provider.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/get_pictures_use_case.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/get_pictures_use_case_impl.dart';
|
|
||||||
|
|
||||||
final getPicturesUseCaseProvider = Provider.autoDispose<GetPicturesUseCase>((ref) {
|
|
||||||
final functionsRepository = ref.read(functionsRepositoryProvider);
|
|
||||||
return GetPicturesUseCaseImpl(functionsRepository);
|
|
||||||
});
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
import 'package:device_management/src/core/providers/functions_repository_provider.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/take_picture_use_case.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/take_picture_use_case_impl.dart';
|
|
||||||
|
|
||||||
final takePictureUseCaseProvider = Provider.autoDispose<TakePictureUseCase>((ref) {
|
|
||||||
final functionsRepository = ref.read(functionsRepositoryProvider);
|
|
||||||
return TakePictureUseCaseImpl(functionsRepository);
|
|
||||||
});
|
|
||||||
@@ -15,16 +15,30 @@ class RemoteCameraScreen extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
|
||||||
|
ref.listen(
|
||||||
|
remoteConnectionViewModelProvider.select((s) => s.successMessage),
|
||||||
|
(_, successMessage) {
|
||||||
|
if (successMessage.isNotEmpty) {
|
||||||
|
showTopSnackbar(context, message: context.translate(successMessage), type: MessageType.success);
|
||||||
|
ref.read(remoteConnectionViewModelProvider.notifier).clearSuccess();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
final theme = ref.watch(themePortProvider);
|
final theme = ref.watch(themePortProvider);
|
||||||
|
|
||||||
final isLoadingPictures = ref.watch(
|
final isLoadingPictures = ref.watch(
|
||||||
remoteConnectionViewModelProvider.select((s)=>s.isLoadingPictures)
|
remoteConnectionViewModelProvider.select((s)=>s.isLoadingPictures)
|
||||||
);
|
);
|
||||||
|
final isTakingPicture = ref.watch(
|
||||||
|
remoteConnectionViewModelProvider.select((s)=>s.isTakingPicture)
|
||||||
|
);
|
||||||
|
|
||||||
return LegacyPageLayout(
|
return LegacyPageLayout(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
title: context.translate(I18n.remoteCamera),
|
title: context.translate(I18n.remoteCamera),
|
||||||
body: Expanded(child: isLoadingPictures
|
body: Expanded(child: isLoadingPictures || isTakingPicture
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
: const _GallerySection()
|
: const _GallerySection()
|
||||||
),
|
),
|
||||||
@@ -103,24 +117,7 @@ class _TakePictureSection extends ConsumerWidget {
|
|||||||
big: EdgeInsets.symmetric(vertical: 10, horizontal: 25)
|
big: EdgeInsets.symmetric(vertical: 10, horizontal: 25)
|
||||||
),
|
),
|
||||||
child: PrimaryButton(
|
child: PrimaryButton(
|
||||||
onPressed: () async {
|
onPressed: vm.takePicture,
|
||||||
showDialog(context: context, builder: (context)=>Dialog(
|
|
||||||
child: Container(
|
|
||||||
padding: SizeUtils.getByScreen(
|
|
||||||
small: EdgeInsets.symmetric(horizontal: 32, vertical: 30),
|
|
||||||
big: EdgeInsets.symmetric(horizontal: 30, vertical: 28)
|
|
||||||
),
|
|
||||||
width: SizeUtils.getByScreen(small: 360, big: 350),
|
|
||||||
height: SizeUtils.getByScreen(small: 195, big: 185),
|
|
||||||
child: Center(child: Text(context.translate(I18n.loadingPhoto),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 26, big: 25)),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
await vm.takePicture();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
text: context.translate(I18n.takePicture),
|
text: context.translate(I18n.takePicture),
|
||||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
height: SizeUtils.getByScreen(small: 36, big: 35),
|
height: SizeUtils.getByScreen(small: 36, big: 35),
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
|
import 'package:device_management/src/core/providers/pictures_repository_provider.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:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
import 'package:device_management/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||||
import 'package:device_management/src/features/remote_connection/domain/get_pictures_use_case.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/domain/take_picture_use_case.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart';
|
|
||||||
import 'package:device_management/src/features/remote_connection/presentation/state/remote_connection_view_state.dart';
|
import 'package:device_management/src/features/remote_connection/presentation/state/remote_connection_view_state.dart';
|
||||||
import 'package:legacy_shared/legacy_shared.dart';
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
import 'package:sf_shared/sf_shared.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
|
|
||||||
|
import '../../../../core/domain/repositories/pictures_repository.dart';
|
||||||
|
|
||||||
final remoteConnectionViewModelProvider =
|
final remoteConnectionViewModelProvider =
|
||||||
NotifierProvider.autoDispose<RemoteConnectionViewModel, RemoteConnectionViewState>(
|
NotifierProvider.autoDispose<RemoteConnectionViewModel, RemoteConnectionViewState>(
|
||||||
@@ -15,17 +14,17 @@ NotifierProvider.autoDispose<RemoteConnectionViewModel, RemoteConnectionViewStat
|
|||||||
);
|
);
|
||||||
|
|
||||||
class RemoteConnectionViewModel extends Notifier<RemoteConnectionViewState> {
|
class RemoteConnectionViewModel extends Notifier<RemoteConnectionViewState> {
|
||||||
late final GetPicturesUseCase _getPicturesUseCase;
|
|
||||||
late final TakePictureUseCase _takePictureUseCase;
|
|
||||||
|
|
||||||
late final TextEditingController phoneController;
|
late final TextEditingController phoneController;
|
||||||
|
late final CommandsRepository _commandsRepository;
|
||||||
|
late final PicturesRepository _picturesRepository;
|
||||||
|
|
||||||
static final RegExp _phoneRegex = RegExp(r'^\+?\d{6,15}$');
|
static final RegExp _phoneRegex = RegExp(r'^\+?\d{6,15}$');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RemoteConnectionViewState build() {
|
RemoteConnectionViewState build() {
|
||||||
_getPicturesUseCase = ref.read(getPicturesUseCaseProvider);
|
_commandsRepository = ref.read(commandsRepositoryProvider);
|
||||||
_takePictureUseCase = ref.read(takePictureUseCaseProvider);
|
_picturesRepository = ref.read(picturesRepositoryProvider);
|
||||||
|
|
||||||
phoneController = TextEditingController();
|
phoneController = TextEditingController();
|
||||||
phoneController.addListener(_onPhoneChanged);
|
phoneController.addListener(_onPhoneChanged);
|
||||||
@@ -38,13 +37,11 @@ class RemoteConnectionViewModel extends Notifier<RemoteConnectionViewState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> load() async {
|
Future<void> load() async {
|
||||||
final user = await ref.read(userInfoProvider.future);
|
final device = ref.read(selectedDeviceProvider);
|
||||||
|
if (device == null) return;
|
||||||
|
|
||||||
final pictures = await _getPicturesUseCase.getPictures(userId: user.id);
|
final pictures = await _picturesRepository.getPictures(deviceId: device.identificator);
|
||||||
setImages(pictures);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setImages(List<PictureEntity> pictures) {
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
pictures: pictures,
|
pictures: pictures,
|
||||||
isLoadingPictures: false,
|
isLoadingPictures: false,
|
||||||
@@ -84,18 +81,30 @@ class RemoteConnectionViewModel extends Notifier<RemoteConnectionViewState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearSuccess() {
|
||||||
|
state = state.copyWith(
|
||||||
|
successMessage: '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> takePicture() async {
|
Future<void> takePicture() async {
|
||||||
try {
|
try {
|
||||||
state = state.copyWith(isTakingPicture: true);
|
|
||||||
|
|
||||||
await _takePictureUseCase.takePicture(userId: '')
|
|
||||||
.then((picture) {
|
|
||||||
List<PictureEntity> pictures = state.pictures;
|
|
||||||
pictures.add(picture);
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
isTakingPicture: true,
|
isTakingPicture: true,
|
||||||
|
successMessage: '',
|
||||||
|
);
|
||||||
|
|
||||||
|
final request = SendCommandRequestModel(
|
||||||
|
device: state.deviceId,
|
||||||
|
command: DeviceCommand.requestPhoto,
|
||||||
|
);
|
||||||
|
|
||||||
|
await _commandsRepository.send(request: request);
|
||||||
|
|
||||||
|
state = state.copyWith(
|
||||||
|
isTakingPicture: false,
|
||||||
|
successMessage: I18n.photoTaken
|
||||||
);
|
);
|
||||||
});
|
|
||||||
} catch (e){
|
} catch (e){
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
isTakingPicture: false,
|
isTakingPicture: false,
|
||||||
@@ -106,6 +115,7 @@ class RemoteConnectionViewModel extends Notifier<RemoteConnectionViewState> {
|
|||||||
|
|
||||||
Future<void> call() async {
|
Future<void> call() async {
|
||||||
final phone = phoneController.text;
|
final phone = phoneController.text;
|
||||||
|
final dialCode = state.dialCode;
|
||||||
if (phone.isEmpty){
|
if (phone.isEmpty){
|
||||||
state = state.copyWith(errorMessage: 'errorMessagePhoneIsEmpty');
|
state = state.copyWith(errorMessage: 'errorMessagePhoneIsEmpty');
|
||||||
return;
|
return;
|
||||||
@@ -114,6 +124,29 @@ class RemoteConnectionViewModel extends Notifier<RemoteConnectionViewState> {
|
|||||||
state = state.copyWith(errorMessage: 'errorMessagePhoneIsInvalid');
|
state = state.copyWith(errorMessage: 'errorMessagePhoneIsInvalid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
state = state.copyWith(
|
||||||
|
isCalling: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
final fullPhone = dialCode + phone;
|
||||||
|
final request = SendCommandRequestModel(
|
||||||
|
device: state.deviceId,
|
||||||
|
command: DeviceCommand.callCenter,
|
||||||
|
data: {
|
||||||
|
'phone_number': fullPhone,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
_commandsRepository.send(request: request);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
state = state.copyWith(
|
||||||
|
isCalling: false,
|
||||||
|
errorMessage: e.toString(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void disposeControllers() {
|
void disposeControllers() {
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ part 'remote_connection_view_state.freezed.dart';
|
|||||||
@freezed
|
@freezed
|
||||||
abstract class RemoteConnectionViewState with _$RemoteConnectionViewState {
|
abstract class RemoteConnectionViewState with _$RemoteConnectionViewState {
|
||||||
const factory RemoteConnectionViewState({
|
const factory RemoteConnectionViewState({
|
||||||
|
@Default('') String deviceId,
|
||||||
|
@Default('+34') String dialCode,
|
||||||
@Default('') String phone,
|
@Default('') String phone,
|
||||||
@Default([]) List<PictureEntity> pictures,
|
@Default([]) List<PictureEntity> pictures,
|
||||||
@Default(0) int pictureIndex,
|
@Default(0) int pictureIndex,
|
||||||
@Default(true) bool isLoadingPictures,
|
@Default(true) bool isLoadingPictures,
|
||||||
@Default(false) bool isTakingPicture,
|
@Default(false) bool isTakingPicture,
|
||||||
@Default(false) bool isCalling,
|
@Default(false) bool isCalling,
|
||||||
@Default('') String errorMessage
|
@Default('') String errorMessage,
|
||||||
|
@Default('') String successMessage
|
||||||
}) = _RemoteConnectionViewState;
|
}) = _RemoteConnectionViewState;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$RemoteConnectionViewState {
|
mixin _$RemoteConnectionViewState {
|
||||||
|
|
||||||
String get phone; List<PictureEntity> get pictures; int get pictureIndex; bool get isLoadingPictures; bool get isTakingPicture; bool get isCalling; String get errorMessage;
|
String get deviceId; String get dialCode; String get phone; List<PictureEntity> get pictures; int get pictureIndex; bool get isLoadingPictures; bool get isTakingPicture; bool get isCalling; String get errorMessage; String get successMessage;
|
||||||
/// Create a copy of RemoteConnectionViewState
|
/// Create a copy of RemoteConnectionViewState
|
||||||
/// 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 @@ $RemoteConnectionViewStateCopyWith<RemoteConnectionViewState> get copyWith => _$
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.pictures, pictures)&&(identical(other.pictureIndex, pictureIndex) || other.pictureIndex == pictureIndex)&&(identical(other.isLoadingPictures, isLoadingPictures) || other.isLoadingPictures == isLoadingPictures)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is RemoteConnectionViewState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.pictures, pictures)&&(identical(other.pictureIndex, pictureIndex) || other.pictureIndex == pictureIndex)&&(identical(other.isLoadingPictures, isLoadingPictures) || other.isLoadingPictures == isLoadingPictures)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.successMessage, successMessage) || other.successMessage == successMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(pictures),pictureIndex,isLoadingPictures,isTakingPicture,isCalling,errorMessage);
|
int get hashCode => Object.hash(runtimeType,deviceId,dialCode,phone,const DeepCollectionEquality().hash(pictures),pictureIndex,isLoadingPictures,isTakingPicture,isCalling,errorMessage,successMessage);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, pictureIndex: $pictureIndex, isLoadingPictures: $isLoadingPictures, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)';
|
return 'RemoteConnectionViewState(deviceId: $deviceId, dialCode: $dialCode, phone: $phone, pictures: $pictures, pictureIndex: $pictureIndex, isLoadingPictures: $isLoadingPictures, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage, successMessage: $successMessage)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ abstract mixin class $RemoteConnectionViewStateCopyWith<$Res> {
|
|||||||
factory $RemoteConnectionViewStateCopyWith(RemoteConnectionViewState value, $Res Function(RemoteConnectionViewState) _then) = _$RemoteConnectionViewStateCopyWithImpl;
|
factory $RemoteConnectionViewStateCopyWith(RemoteConnectionViewState value, $Res Function(RemoteConnectionViewState) _then) = _$RemoteConnectionViewStateCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage
|
String deviceId, String dialCode, String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage, String successMessage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -62,15 +62,18 @@ class _$RemoteConnectionViewStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of RemoteConnectionViewState
|
/// Create a copy of RemoteConnectionViewState
|
||||||
/// 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? phone = null,Object? pictures = null,Object? pictureIndex = null,Object? isLoadingPictures = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? deviceId = null,Object? dialCode = null,Object? phone = null,Object? pictures = null,Object? pictureIndex = null,Object? isLoadingPictures = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,Object? successMessage = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||||
as String,pictures: null == pictures ? _self.pictures : pictures // ignore: cast_nullable_to_non_nullable
|
as String,pictures: null == pictures ? _self.pictures : pictures // ignore: cast_nullable_to_non_nullable
|
||||||
as List<PictureEntity>,pictureIndex: null == pictureIndex ? _self.pictureIndex : pictureIndex // ignore: cast_nullable_to_non_nullable
|
as List<PictureEntity>,pictureIndex: null == pictureIndex ? _self.pictureIndex : pictureIndex // ignore: cast_nullable_to_non_nullable
|
||||||
as int,isLoadingPictures: null == isLoadingPictures ? _self.isLoadingPictures : isLoadingPictures // ignore: cast_nullable_to_non_nullable
|
as int,isLoadingPictures: null == isLoadingPictures ? _self.isLoadingPictures : isLoadingPictures // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable
|
as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable
|
as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // 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,successMessage: null == successMessage ? _self.successMessage : successMessage // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -156,10 +159,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String deviceId, String dialCode, String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage, String successMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _RemoteConnectionViewState() when $default != null:
|
case _RemoteConnectionViewState() when $default != null:
|
||||||
return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _:
|
return $default(_that.deviceId,_that.dialCode,_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage,_that.successMessage);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -177,10 +180,10 @@ return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPic
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String deviceId, String dialCode, String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage, String successMessage) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _RemoteConnectionViewState():
|
case _RemoteConnectionViewState():
|
||||||
return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _:
|
return $default(_that.deviceId,_that.dialCode,_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage,_that.successMessage);case _:
|
||||||
throw StateError('Unexpected subclass');
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -197,10 +200,10 @@ return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPic
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String deviceId, String dialCode, String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage, String successMessage)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _RemoteConnectionViewState() when $default != null:
|
case _RemoteConnectionViewState() when $default != null:
|
||||||
return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _:
|
return $default(_that.deviceId,_that.dialCode,_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage,_that.successMessage);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -212,9 +215,11 @@ return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPic
|
|||||||
|
|
||||||
|
|
||||||
class _RemoteConnectionViewState implements RemoteConnectionViewState {
|
class _RemoteConnectionViewState implements RemoteConnectionViewState {
|
||||||
const _RemoteConnectionViewState({this.phone = '', final List<PictureEntity> pictures = const [], this.pictureIndex = 0, this.isLoadingPictures = true, this.isTakingPicture = false, this.isCalling = false, this.errorMessage = ''}): _pictures = pictures;
|
const _RemoteConnectionViewState({this.deviceId = '', this.dialCode = '+34', this.phone = '', final List<PictureEntity> pictures = const [], this.pictureIndex = 0, this.isLoadingPictures = true, this.isTakingPicture = false, this.isCalling = false, this.errorMessage = '', this.successMessage = ''}): _pictures = pictures;
|
||||||
|
|
||||||
|
|
||||||
|
@override@JsonKey() final String deviceId;
|
||||||
|
@override@JsonKey() final String dialCode;
|
||||||
@override@JsonKey() final String phone;
|
@override@JsonKey() final String phone;
|
||||||
final List<PictureEntity> _pictures;
|
final List<PictureEntity> _pictures;
|
||||||
@override@JsonKey() List<PictureEntity> get pictures {
|
@override@JsonKey() List<PictureEntity> get pictures {
|
||||||
@@ -228,6 +233,7 @@ class _RemoteConnectionViewState implements RemoteConnectionViewState {
|
|||||||
@override@JsonKey() final bool isTakingPicture;
|
@override@JsonKey() final bool isTakingPicture;
|
||||||
@override@JsonKey() final bool isCalling;
|
@override@JsonKey() final bool isCalling;
|
||||||
@override@JsonKey() final String errorMessage;
|
@override@JsonKey() final String errorMessage;
|
||||||
|
@override@JsonKey() final String successMessage;
|
||||||
|
|
||||||
/// Create a copy of RemoteConnectionViewState
|
/// Create a copy of RemoteConnectionViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -239,16 +245,16 @@ _$RemoteConnectionViewStateCopyWith<_RemoteConnectionViewState> get copyWith =>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._pictures, _pictures)&&(identical(other.pictureIndex, pictureIndex) || other.pictureIndex == pictureIndex)&&(identical(other.isLoadingPictures, isLoadingPictures) || other.isLoadingPictures == isLoadingPictures)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemoteConnectionViewState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._pictures, _pictures)&&(identical(other.pictureIndex, pictureIndex) || other.pictureIndex == pictureIndex)&&(identical(other.isLoadingPictures, isLoadingPictures) || other.isLoadingPictures == isLoadingPictures)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.successMessage, successMessage) || other.successMessage == successMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(_pictures),pictureIndex,isLoadingPictures,isTakingPicture,isCalling,errorMessage);
|
int get hashCode => Object.hash(runtimeType,deviceId,dialCode,phone,const DeepCollectionEquality().hash(_pictures),pictureIndex,isLoadingPictures,isTakingPicture,isCalling,errorMessage,successMessage);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, pictureIndex: $pictureIndex, isLoadingPictures: $isLoadingPictures, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)';
|
return 'RemoteConnectionViewState(deviceId: $deviceId, dialCode: $dialCode, phone: $phone, pictures: $pictures, pictureIndex: $pictureIndex, isLoadingPictures: $isLoadingPictures, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage, successMessage: $successMessage)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -259,7 +265,7 @@ abstract mixin class _$RemoteConnectionViewStateCopyWith<$Res> implements $Remot
|
|||||||
factory _$RemoteConnectionViewStateCopyWith(_RemoteConnectionViewState value, $Res Function(_RemoteConnectionViewState) _then) = __$RemoteConnectionViewStateCopyWithImpl;
|
factory _$RemoteConnectionViewStateCopyWith(_RemoteConnectionViewState value, $Res Function(_RemoteConnectionViewState) _then) = __$RemoteConnectionViewStateCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage
|
String deviceId, String dialCode, String phone, List<PictureEntity> pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage, String successMessage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -276,15 +282,18 @@ class __$RemoteConnectionViewStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of RemoteConnectionViewState
|
/// Create a copy of RemoteConnectionViewState
|
||||||
/// 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? phone = null,Object? pictures = null,Object? pictureIndex = null,Object? isLoadingPictures = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? deviceId = null,Object? dialCode = null,Object? phone = null,Object? pictures = null,Object? pictureIndex = null,Object? isLoadingPictures = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,Object? successMessage = null,}) {
|
||||||
return _then(_RemoteConnectionViewState(
|
return _then(_RemoteConnectionViewState(
|
||||||
phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||||
as String,pictures: null == pictures ? _self._pictures : pictures // ignore: cast_nullable_to_non_nullable
|
as String,pictures: null == pictures ? _self._pictures : pictures // ignore: cast_nullable_to_non_nullable
|
||||||
as List<PictureEntity>,pictureIndex: null == pictureIndex ? _self.pictureIndex : pictureIndex // ignore: cast_nullable_to_non_nullable
|
as List<PictureEntity>,pictureIndex: null == pictureIndex ? _self.pictureIndex : pictureIndex // ignore: cast_nullable_to_non_nullable
|
||||||
as int,isLoadingPictures: null == isLoadingPictures ? _self.isLoadingPictures : isLoadingPictures // ignore: cast_nullable_to_non_nullable
|
as int,isLoadingPictures: null == isLoadingPictures ? _self.isLoadingPictures : isLoadingPictures // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable
|
as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable
|
as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // 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,successMessage: null == successMessage ? _self.successMessage : successMessage // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ part 'send_command_request_model.freezed.dart';
|
|||||||
part 'send_command_request_model.g.dart';
|
part 'send_command_request_model.g.dart';
|
||||||
|
|
||||||
enum DeviceCommand {
|
enum DeviceCommand {
|
||||||
|
@JsonValue('CALL_CENTER')
|
||||||
|
callCenter,
|
||||||
@JsonValue('FACTORY')
|
@JsonValue('FACTORY')
|
||||||
factory,
|
factory,
|
||||||
@JsonValue('FIND_DEVICE')
|
@JsonValue('FIND_DEVICE')
|
||||||
findDevice,
|
findDevice,
|
||||||
|
@JsonValue('REQUEST_PHOTO')
|
||||||
|
requestPhoto,
|
||||||
@JsonValue('RESTART')
|
@JsonValue('RESTART')
|
||||||
restart,
|
restart,
|
||||||
@JsonValue('REWARDS')
|
@JsonValue('REWARDS')
|
||||||
|
|||||||
@@ -23,8 +23,10 @@ Map<String, dynamic> _$SendCommandRequestModelToJson(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const _$DeviceCommandEnumMap = {
|
const _$DeviceCommandEnumMap = {
|
||||||
|
DeviceCommand.callCenter: 'CALL_CENTER',
|
||||||
DeviceCommand.factory: 'FACTORY',
|
DeviceCommand.factory: 'FACTORY',
|
||||||
DeviceCommand.findDevice: 'FIND_DEVICE',
|
DeviceCommand.findDevice: 'FIND_DEVICE',
|
||||||
|
DeviceCommand.requestPhoto: 'REQUEST_PHOTO',
|
||||||
DeviceCommand.restart: 'RESTART',
|
DeviceCommand.restart: 'RESTART',
|
||||||
DeviceCommand.rewards: 'REWARDS',
|
DeviceCommand.rewards: 'REWARDS',
|
||||||
DeviceCommand.shutdown: 'SHUTDOWN',
|
DeviceCommand.shutdown: 'SHUTDOWN',
|
||||||
|
|||||||
@@ -7,6 +7,6 @@
|
|||||||
<versions>
|
<versions>
|
||||||
<version>2.6.4</version>
|
<version>2.6.4</version>
|
||||||
</versions>
|
</versions>
|
||||||
<lastUpdated>20260318000000</lastUpdated>
|
<lastUpdated>20260320000000</lastUpdated>
|
||||||
</versioning>
|
</versioning>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
f9e85f64806f37132f0c0cc4ef8a67ec
|
20c099fa5d73eb3667d91872fabb23b6
|
||||||
@@ -1 +1 @@
|
|||||||
b7a72907f1f917f7b7d0cd57cb170901965b4113
|
67c2ba6eea196d22403b194e8407fcca966416f6
|
||||||
@@ -706,5 +706,6 @@
|
|||||||
"editChildProfile": "Edit profile",
|
"editChildProfile": "Edit profile",
|
||||||
"editChildProfileSaveSuccess": "Child profile updated successfully",
|
"editChildProfileSaveSuccess": "Child profile updated successfully",
|
||||||
"editChildProfileTitle": "Edit child profile",
|
"editChildProfileTitle": "Edit child profile",
|
||||||
"activationCodeMessage": "An activation key has been sent to your email"
|
"activationCodeMessage": "An activation key has been sent to your email",
|
||||||
|
"photoTaken": "Photo taken successfully"
|
||||||
}
|
}
|
||||||
@@ -704,5 +704,6 @@
|
|||||||
"editChildProfile": "Editar perfil",
|
"editChildProfile": "Editar perfil",
|
||||||
"editChildProfileTitle": "Editar perfil del niño",
|
"editChildProfileTitle": "Editar perfil del niño",
|
||||||
"editChildProfileSaveSuccess": "Perfil del niño actualizado correctamente",
|
"editChildProfileSaveSuccess": "Perfil del niño actualizado correctamente",
|
||||||
"activationCodeMessage": "Se ha enviado un código de activación a tu correo electrónico"
|
"activationCodeMessage": "Se ha enviado un código de activación a tu correo electrónico",
|
||||||
|
"photoTaken": "Foto tomada exitosamente"
|
||||||
}
|
}
|
||||||
@@ -830,4 +830,5 @@ class I18n {
|
|||||||
static const String editChildProfileTitle = 'editChildProfileTitle';
|
static const String editChildProfileTitle = 'editChildProfileTitle';
|
||||||
static const String editChildProfileSaveSuccess = 'editChildProfileSaveSuccess';
|
static const String editChildProfileSaveSuccess = 'editChildProfileSaveSuccess';
|
||||||
static const String activationCodeMessage = 'activationCodeMessage';
|
static const String activationCodeMessage = 'activationCodeMessage';
|
||||||
|
static const String photoTaken = 'photoTaken';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user