fix: update schedule endpoint

This commit is contained in:
2026-03-26 13:09:11 +01:00
parent fe41e812a0
commit 5cf2fd7f96
18 changed files with 774 additions and 65 deletions

View File

@@ -1,11 +1,13 @@
import 'package:device_management/src/core/data/models/get_schedule_response_model.dart'; import 'package:device_management/src/core/data/models/get_schedule_response_model.dart';
import 'package:device_management/src/core/data/models/upsert_schedule_request_model.dart'; import 'package:device_management/src/core/data/models/upsert_schedule_request_model.dart';
import '../models/create_scheduled_activity_request_model.dart'; import '../models/get_installed_apps_response_model.dart';
import '../models/get_scheduled_activities_response_model.dart';
import '../models/update_scheduled_activity_request_model.dart';
abstract class AppSurveillanceRemoteDatasource { abstract class AppSurveillanceRemoteDatasource {
Future<GetInstalledAppsResponseModel> getInstalledApps({
required String deviceId
});
Future<GetScheduleResponseModel> getSchedule({required String deviceId}); Future<GetScheduleResponseModel> getSchedule({required String deviceId});
Future<void> upsertSchedule({ Future<void> upsertSchedule({

View File

@@ -4,6 +4,7 @@ import 'package:dio/dio.dart';
import 'package:legacy_shared/legacy_shared.dart'; import 'package:legacy_shared/legacy_shared.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart';
import '../models/get_installed_apps_response_model.dart';
import 'apps_surveillance_remote_datasource.dart'; import 'apps_surveillance_remote_datasource.dart';
class AppSurveillanceRemoteDatasourceImpl class AppSurveillanceRemoteDatasourceImpl
@@ -12,6 +13,31 @@ class AppSurveillanceRemoteDatasourceImpl
final QuestiaRepository _repository; final QuestiaRepository _repository;
@override
Future<GetInstalledAppsResponseModel> getInstalledApps({
required String deviceId
}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/devices/identificator/$deviceId/installed-apps',
);
final data = response.data;
if (data == null || data.isEmpty) {
throw Exception(
'Empty response from /devices/$deviceId/installed-apps',
);
}
return GetInstalledAppsResponseModel.fromJson(data);
} on DioException catch (error) {
throw mapDioError(
error,
defaultMessage: 'Error getting installed apps',
);
}
}
@override @override
Future<GetScheduleResponseModel> getSchedule({ Future<GetScheduleResponseModel> getSchedule({
required String deviceId required String deviceId

View File

@@ -0,0 +1,46 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import '../../../features/apps_surveillance/data/installed_app_entity.dart';
part 'get_installed_apps_response_model.freezed.dart';
part 'get_installed_apps_response_model.g.dart';
@freezed
abstract class GetInstalledAppsResponseModel
with _$GetInstalledAppsResponseModel {
const factory GetInstalledAppsResponseModel({
required int total,
required List<InstalledAppItemResponseModel> items,
}) = _GetInstalledAppsResponseModel;
factory GetInstalledAppsResponseModel.fromJson(
Map<String, dynamic> json) =>
_$GetInstalledAppsResponseModelFromJson(json);
}
@freezed
abstract class InstalledAppItemResponseModel
with _$InstalledAppItemResponseModel {
const factory InstalledAppItemResponseModel({
required String appUid,
required String appName,
required bool isEnabled
}) = _InstalledAppItemResponseModel;
factory InstalledAppItemResponseModel.fromJson(
Map<String, dynamic> json) =>
_$InstalledAppItemResponseModelFromJson(json);
}
extension InstalledAppsResponseMapper
on GetInstalledAppsResponseModel {
List<InstalledAppEntity> toEntity() {
return items
.map((item) => InstalledAppEntity(
appUid: item.appUid,
appName: item.appName,
isEnabled: item.isEnabled
))
.toList();
}
}

View File

@@ -0,0 +1,555 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'get_installed_apps_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GetInstalledAppsResponseModel {
int get total; List<InstalledAppItemResponseModel> get items;
/// Create a copy of GetInstalledAppsResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetInstalledAppsResponseModelCopyWith<GetInstalledAppsResponseModel> get copyWith => _$GetInstalledAppsResponseModelCopyWithImpl<GetInstalledAppsResponseModel>(this as GetInstalledAppsResponseModel, _$identity);
/// Serializes this GetInstalledAppsResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetInstalledAppsResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.items, items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(items));
@override
String toString() {
return 'GetInstalledAppsResponseModel(total: $total, items: $items)';
}
}
/// @nodoc
abstract mixin class $GetInstalledAppsResponseModelCopyWith<$Res> {
factory $GetInstalledAppsResponseModelCopyWith(GetInstalledAppsResponseModel value, $Res Function(GetInstalledAppsResponseModel) _then) = _$GetInstalledAppsResponseModelCopyWithImpl;
@useResult
$Res call({
int total, List<InstalledAppItemResponseModel> items
});
}
/// @nodoc
class _$GetInstalledAppsResponseModelCopyWithImpl<$Res>
implements $GetInstalledAppsResponseModelCopyWith<$Res> {
_$GetInstalledAppsResponseModelCopyWithImpl(this._self, this._then);
final GetInstalledAppsResponseModel _self;
final $Res Function(GetInstalledAppsResponseModel) _then;
/// Create a copy of GetInstalledAppsResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? total = null,Object? items = null,}) {
return _then(_self.copyWith(
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
as int,items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
as List<InstalledAppItemResponseModel>,
));
}
}
/// Adds pattern-matching-related methods to [GetInstalledAppsResponseModel].
extension GetInstalledAppsResponseModelPatterns on GetInstalledAppsResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _GetInstalledAppsResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetInstalledAppsResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _GetInstalledAppsResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetInstalledAppsResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _GetInstalledAppsResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetInstalledAppsResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int total, List<InstalledAppItemResponseModel> items)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetInstalledAppsResponseModel() when $default != null:
return $default(_that.total,_that.items);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int total, List<InstalledAppItemResponseModel> items) $default,) {final _that = this;
switch (_that) {
case _GetInstalledAppsResponseModel():
return $default(_that.total,_that.items);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int total, List<InstalledAppItemResponseModel> items)? $default,) {final _that = this;
switch (_that) {
case _GetInstalledAppsResponseModel() when $default != null:
return $default(_that.total,_that.items);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetInstalledAppsResponseModel implements GetInstalledAppsResponseModel {
const _GetInstalledAppsResponseModel({required this.total, required final List<InstalledAppItemResponseModel> items}): _items = items;
factory _GetInstalledAppsResponseModel.fromJson(Map<String, dynamic> json) => _$GetInstalledAppsResponseModelFromJson(json);
@override final int total;
final List<InstalledAppItemResponseModel> _items;
@override List<InstalledAppItemResponseModel> get items {
if (_items is EqualUnmodifiableListView) return _items;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_items);
}
/// Create a copy of GetInstalledAppsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetInstalledAppsResponseModelCopyWith<_GetInstalledAppsResponseModel> get copyWith => __$GetInstalledAppsResponseModelCopyWithImpl<_GetInstalledAppsResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetInstalledAppsResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetInstalledAppsResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._items, _items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(_items));
@override
String toString() {
return 'GetInstalledAppsResponseModel(total: $total, items: $items)';
}
}
/// @nodoc
abstract mixin class _$GetInstalledAppsResponseModelCopyWith<$Res> implements $GetInstalledAppsResponseModelCopyWith<$Res> {
factory _$GetInstalledAppsResponseModelCopyWith(_GetInstalledAppsResponseModel value, $Res Function(_GetInstalledAppsResponseModel) _then) = __$GetInstalledAppsResponseModelCopyWithImpl;
@override @useResult
$Res call({
int total, List<InstalledAppItemResponseModel> items
});
}
/// @nodoc
class __$GetInstalledAppsResponseModelCopyWithImpl<$Res>
implements _$GetInstalledAppsResponseModelCopyWith<$Res> {
__$GetInstalledAppsResponseModelCopyWithImpl(this._self, this._then);
final _GetInstalledAppsResponseModel _self;
final $Res Function(_GetInstalledAppsResponseModel) _then;
/// Create a copy of GetInstalledAppsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? total = null,Object? items = null,}) {
return _then(_GetInstalledAppsResponseModel(
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
as int,items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
as List<InstalledAppItemResponseModel>,
));
}
}
/// @nodoc
mixin _$InstalledAppItemResponseModel {
String get appUid; String get appName; bool get isEnabled;
/// Create a copy of InstalledAppItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$InstalledAppItemResponseModelCopyWith<InstalledAppItemResponseModel> get copyWith => _$InstalledAppItemResponseModelCopyWithImpl<InstalledAppItemResponseModel>(this as InstalledAppItemResponseModel, _$identity);
/// Serializes this InstalledAppItemResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is InstalledAppItemResponseModel&&(identical(other.appUid, appUid) || other.appUid == appUid)&&(identical(other.appName, appName) || other.appName == appName)&&(identical(other.isEnabled, isEnabled) || other.isEnabled == isEnabled));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,appUid,appName,isEnabled);
@override
String toString() {
return 'InstalledAppItemResponseModel(appUid: $appUid, appName: $appName, isEnabled: $isEnabled)';
}
}
/// @nodoc
abstract mixin class $InstalledAppItemResponseModelCopyWith<$Res> {
factory $InstalledAppItemResponseModelCopyWith(InstalledAppItemResponseModel value, $Res Function(InstalledAppItemResponseModel) _then) = _$InstalledAppItemResponseModelCopyWithImpl;
@useResult
$Res call({
String appUid, String appName, bool isEnabled
});
}
/// @nodoc
class _$InstalledAppItemResponseModelCopyWithImpl<$Res>
implements $InstalledAppItemResponseModelCopyWith<$Res> {
_$InstalledAppItemResponseModelCopyWithImpl(this._self, this._then);
final InstalledAppItemResponseModel _self;
final $Res Function(InstalledAppItemResponseModel) _then;
/// Create a copy of InstalledAppItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? appUid = null,Object? appName = null,Object? isEnabled = null,}) {
return _then(_self.copyWith(
appUid: null == appUid ? _self.appUid : appUid // ignore: cast_nullable_to_non_nullable
as String,appName: null == appName ? _self.appName : appName // ignore: cast_nullable_to_non_nullable
as String,isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// Adds pattern-matching-related methods to [InstalledAppItemResponseModel].
extension InstalledAppItemResponseModelPatterns on InstalledAppItemResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _InstalledAppItemResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _InstalledAppItemResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _InstalledAppItemResponseModel value) $default,){
final _that = this;
switch (_that) {
case _InstalledAppItemResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _InstalledAppItemResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _InstalledAppItemResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String appUid, String appName, bool isEnabled)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _InstalledAppItemResponseModel() when $default != null:
return $default(_that.appUid,_that.appName,_that.isEnabled);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String appUid, String appName, bool isEnabled) $default,) {final _that = this;
switch (_that) {
case _InstalledAppItemResponseModel():
return $default(_that.appUid,_that.appName,_that.isEnabled);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String appUid, String appName, bool isEnabled)? $default,) {final _that = this;
switch (_that) {
case _InstalledAppItemResponseModel() when $default != null:
return $default(_that.appUid,_that.appName,_that.isEnabled);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _InstalledAppItemResponseModel implements InstalledAppItemResponseModel {
const _InstalledAppItemResponseModel({required this.appUid, required this.appName, required this.isEnabled});
factory _InstalledAppItemResponseModel.fromJson(Map<String, dynamic> json) => _$InstalledAppItemResponseModelFromJson(json);
@override final String appUid;
@override final String appName;
@override final bool isEnabled;
/// Create a copy of InstalledAppItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$InstalledAppItemResponseModelCopyWith<_InstalledAppItemResponseModel> get copyWith => __$InstalledAppItemResponseModelCopyWithImpl<_InstalledAppItemResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$InstalledAppItemResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _InstalledAppItemResponseModel&&(identical(other.appUid, appUid) || other.appUid == appUid)&&(identical(other.appName, appName) || other.appName == appName)&&(identical(other.isEnabled, isEnabled) || other.isEnabled == isEnabled));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,appUid,appName,isEnabled);
@override
String toString() {
return 'InstalledAppItemResponseModel(appUid: $appUid, appName: $appName, isEnabled: $isEnabled)';
}
}
/// @nodoc
abstract mixin class _$InstalledAppItemResponseModelCopyWith<$Res> implements $InstalledAppItemResponseModelCopyWith<$Res> {
factory _$InstalledAppItemResponseModelCopyWith(_InstalledAppItemResponseModel value, $Res Function(_InstalledAppItemResponseModel) _then) = __$InstalledAppItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String appUid, String appName, bool isEnabled
});
}
/// @nodoc
class __$InstalledAppItemResponseModelCopyWithImpl<$Res>
implements _$InstalledAppItemResponseModelCopyWith<$Res> {
__$InstalledAppItemResponseModelCopyWithImpl(this._self, this._then);
final _InstalledAppItemResponseModel _self;
final $Res Function(_InstalledAppItemResponseModel) _then;
/// Create a copy of InstalledAppItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? appUid = null,Object? appName = null,Object? isEnabled = null,}) {
return _then(_InstalledAppItemResponseModel(
appUid: null == appUid ? _self.appUid : appUid // ignore: cast_nullable_to_non_nullable
as String,appName: null == appName ? _self.appName : appName // ignore: cast_nullable_to_non_nullable
as String,isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on

View File

@@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_installed_apps_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GetInstalledAppsResponseModel _$GetInstalledAppsResponseModelFromJson(
Map<String, dynamic> json,
) => _GetInstalledAppsResponseModel(
total: (json['total'] as num).toInt(),
items: (json['items'] as List<dynamic>)
.map(
(e) =>
InstalledAppItemResponseModel.fromJson(e as Map<String, dynamic>),
)
.toList(),
);
Map<String, dynamic> _$GetInstalledAppsResponseModelToJson(
_GetInstalledAppsResponseModel instance,
) => <String, dynamic>{'total': instance.total, 'items': instance.items};
_InstalledAppItemResponseModel _$InstalledAppItemResponseModelFromJson(
Map<String, dynamic> json,
) => _InstalledAppItemResponseModel(
appUid: json['appUid'] as String,
appName: json['appName'] as String,
isEnabled: json['isEnabled'] as bool,
);
Map<String, dynamic> _$InstalledAppItemResponseModelToJson(
_InstalledAppItemResponseModel instance,
) => <String, dynamic>{
'appUid': instance.appUid,
'appName': instance.appName,
'isEnabled': instance.isEnabled,
};

View File

@@ -1,14 +1,10 @@
import 'package:device_management/src/core/data/models/get_installed_apps_response_model.dart';
import 'package:device_management/src/core/data/models/get_schedule_response_model.dart'; import 'package:device_management/src/core/data/models/get_schedule_response_model.dart';
import 'package:device_management/src/core/domain/entities/schedule_period_entity.dart'; import 'package:device_management/src/core/domain/entities/schedule_period_entity.dart';
import 'package:device_management/src/features/apps_surveillance/data/installed_app_entity.dart';
import '../../../features/scheduled_activities/domain/entities/scheduled_activity_entity.dart';
import '../../domain/repositories/app_surveillance_repository.dart'; import '../../domain/repositories/app_surveillance_repository.dart';
import '../../domain/repositories/scheduled_activities_repository.dart';
import '../datasources/apps_surveillance_remote_datasource.dart'; import '../datasources/apps_surveillance_remote_datasource.dart';
import '../datasources/scheduled_activities_remote_datasource.dart';
import '../models/create_scheduled_activity_request_model.dart';
import '../models/get_scheduled_activities_response_model.dart';
import '../models/update_scheduled_activity_request_model.dart';
import '../models/upsert_schedule_request_model.dart'; import '../models/upsert_schedule_request_model.dart';
class AppSurveillanceRepositoryImpl class AppSurveillanceRepositoryImpl
@@ -17,6 +13,14 @@ class AppSurveillanceRepositoryImpl
final AppSurveillanceRemoteDatasource _remote; final AppSurveillanceRemoteDatasource _remote;
@override
Future<List<InstalledAppEntity>> getInstalledApps({
required String deviceId
}) async {
final model = await _remote.getInstalledApps(deviceId: deviceId);
return model.toEntity();
}
@override @override
Future<List<SchedulePeriodEntity>> getSchedule({required String deviceId}) async { Future<List<SchedulePeriodEntity>> getSchedule({required String deviceId}) async {
final model = await _remote.getSchedule(deviceId: deviceId); final model = await _remote.getSchedule(deviceId: deviceId);

View File

@@ -1,8 +1,13 @@
import 'package:device_management/src/core/domain/entities/schedule_period_entity.dart'; import 'package:device_management/src/core/domain/entities/schedule_period_entity.dart';
import 'package:device_management/src/features/apps_surveillance/data/installed_app_entity.dart';
import '../../data/models/upsert_schedule_request_model.dart'; import '../../data/models/upsert_schedule_request_model.dart';
abstract class AppSurveillanceRepository { abstract class AppSurveillanceRepository {
Future<List<InstalledAppEntity>> getInstalledApps({
required String deviceId,
});
Future<List<SchedulePeriodEntity>> getSchedule({ Future<List<SchedulePeriodEntity>> getSchedule({
required String deviceId, required String deviceId,
}); });

View File

@@ -15,14 +15,11 @@ class AppsSurveillanceScreen extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider); final theme = ref.read(themePortProvider);
final appNames = {
'HEALTH': context.translate(I18n.health),
};
final appsState = ref.watch( final installedApps = ref.watch(
appsSurveillanceViewModelProvider.select((s)=>s.appsState) appsSurveillanceViewModelProvider.select((s)=>s.apps)
); );
final vm = ref.read(appsSurveillanceViewModelProvider.notifier);
return LegacyPageLayout( return LegacyPageLayout(
theme: theme, theme: theme,
@@ -43,13 +40,14 @@ class AppsSurveillanceScreen extends ConsumerWidget {
child: Column( child: Column(
children: [ children: [
Text(context.translate(I18n.appsSurveillanceMessage)), Text(context.translate(I18n.appsSurveillanceMessage)),
...List<Widget>.generate(appNames.length, (int i){ ...List<Widget>.generate(installedApps.length, (int i){
final appCode = appNames.keys.elementAt(i);
return _Item( return _Item(
appCode: appCode, appCode: installedApps.elementAt(i).appUid,
name: appNames[appCode]!, name: installedApps.elementAt(i).appName,
enabled: false, enabled: installedApps.elementAt(i).isEnabled,
onChanged: (value){}, onChanged: (value) {
vm.setAppEnabled(i, value);
},
); );
}) })
], ],
@@ -90,14 +88,14 @@ class _Item extends ConsumerWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('data', Text(name,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500 fontWeight: FontWeight.w500
) )
), ),
Row( Row(
children: [ children: [
Text('data'), Text(context.translate(enabled? I18n.enabled : I18n.disabled)),
SizedBox(width: SizeUtils.getByScreen(small: 18, big: 16)), SizedBox(width: SizeUtils.getByScreen(small: 18, big: 16)),
Switch(value: !enabled, onChanged: onChanged), Switch(value: !enabled, onChanged: onChanged),
], ],

View File

@@ -1,10 +1,8 @@
import 'package:device_management/src/core/data/models/upsert_schedule_request_model.dart'; import 'package:device_management/src/core/data/models/upsert_schedule_request_model.dart';
import 'package:device_management/src/core/domain/entities/schedule_period_entity.dart'; import 'package:device_management/src/core/domain/entities/schedule_period_entity.dart';
import 'package:device_management/src/core/domain/repositories/app_surveillance_repository.dart'; import 'package:device_management/src/core/domain/repositories/app_surveillance_repository.dart';
import 'package:device_management/src/core/domain/repositories/scheduled_activities_repository.dart';
import 'package:device_management/src/core/providers/app_surveillance_repository.dart'; import 'package:device_management/src/core/providers/app_surveillance_repository.dart';
import 'package:device_management/src/core/providers/scheduled_activities_repository_provider.dart'; import 'package:device_management/src/features/apps_surveillance/data/installed_app_entity.dart';
import 'package:flutter/src/material/time.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart'; import 'package:legacy_shared/legacy_shared.dart';
@@ -33,6 +31,10 @@ class AppsSurveillanceViewModel extends Notifier<AppsSurveillanceViewState> {
final device = ref.read(selectedDeviceProvider); final device = ref.read(selectedDeviceProvider);
if(device == null) return; if(device == null) return;
final apps = await _repository.getInstalledApps(
deviceId: device.identificator
);
final schedule = (await _repository.getSchedule( final schedule = (await _repository.getSchedule(
deviceId: device.identificator deviceId: device.identificator
)) ))
@@ -43,13 +45,39 @@ class AppsSurveillanceViewModel extends Notifier<AppsSurveillanceViewState> {
state = state.copyWith( state = state.copyWith(
isLoading: false, isLoading: false,
appsState: { apps: apps,
},
schedule: schedule schedule: schedule
); );
} }
Future<void> setAppEnabled(int index, bool value) async {
if (state.isSaving) return;
final device = ref.read(selectedDeviceProvider);
if (device == null) return;
try {
state = state.copyWith(
isSaving: true,
);
final updatedApp = state.apps[index]
.copyWith(isEnabled: value);
List<InstalledAppEntity> updatedApps = state.apps.toList();
updatedApps[index] = updatedApp;
state = state.copyWith(
isSaving: false,
apps: updatedApps,
);
} catch (e) {
state = state.copyWith(
isSaving: false,
errorEvent: AppsSurveillanceErrorEvent.set
);
}
}
UpdateScheduleRequestModel _toRequest() { UpdateScheduleRequestModel _toRequest() {
return UpdateScheduleRequestModel( return UpdateScheduleRequestModel(
periods: state.schedule.map((e)=> periods: state.schedule.map((e)=>
@@ -72,6 +100,7 @@ class AppsSurveillanceViewModel extends Notifier<AppsSurveillanceViewState> {
if (state.isLoading) return; if (state.isLoading) return;
if (state.isSaving) return; if (state.isSaving) return;
print(state.schedule);
if (!validatePeriods()) { if (!validatePeriods()) {
state = state.copyWith( state = state.copyWith(
errorEvent: AppsSurveillanceErrorEvent.invalid errorEvent: AppsSurveillanceErrorEvent.invalid

View File

@@ -1,3 +1,4 @@
import 'package:device_management/src/features/apps_surveillance/data/installed_app_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:sf_shared/sf_shared.dart'; import 'package:sf_shared/sf_shared.dart';
@@ -14,7 +15,7 @@ abstract class AppsSurveillanceViewState with _$AppsSurveillanceViewState {
@Default(true) bool isLoading, @Default(true) bool isLoading,
@Default(false) bool isSaving, @Default(false) bool isSaving,
DeviceEntity? selectedDevice, DeviceEntity? selectedDevice,
@Default({}) Map<String, bool> appsState, @Default([]) List<InstalledAppEntity> apps,
@Default([]) List<SchedulePeriodEntity> schedule, @Default([]) List<SchedulePeriodEntity> schedule,
@Default('') String deviceName, @Default('') String deviceName,
AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceErrorEvent? errorEvent,

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$AppsSurveillanceViewState { mixin _$AppsSurveillanceViewState {
bool get isLoading; bool get isSaving; DeviceEntity? get selectedDevice; Map<String, bool> get appsState; List<SchedulePeriodEntity> get schedule; String get deviceName; AppsSurveillanceErrorEvent? get errorEvent; AppsSurveillanceSuccessEvent? get successEvent; bool get isLoading; bool get isSaving; DeviceEntity? get selectedDevice; List<InstalledAppEntity> get apps; List<SchedulePeriodEntity> get schedule; String get deviceName; AppsSurveillanceErrorEvent? get errorEvent; AppsSurveillanceSuccessEvent? get successEvent;
/// Create a copy of AppsSurveillanceViewState /// Create a copy of AppsSurveillanceViewState
/// 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 @@ $AppsSurveillanceViewStateCopyWith<AppsSurveillanceViewState> get copyWith => _$
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppsSurveillanceViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other.appsState, appsState)&&const DeepCollectionEquality().equals(other.schedule, schedule)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); return identical(this, other) || (other.runtimeType == runtimeType&&other is AppsSurveillanceViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other.apps, apps)&&const DeepCollectionEquality().equals(other.schedule, schedule)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent));
} }
@override @override
int get hashCode => Object.hash(runtimeType,isLoading,isSaving,selectedDevice,const DeepCollectionEquality().hash(appsState),const DeepCollectionEquality().hash(schedule),deviceName,errorEvent,successEvent); int get hashCode => Object.hash(runtimeType,isLoading,isSaving,selectedDevice,const DeepCollectionEquality().hash(apps),const DeepCollectionEquality().hash(schedule),deviceName,errorEvent,successEvent);
@override @override
String toString() { String toString() {
return 'AppsSurveillanceViewState(isLoading: $isLoading, isSaving: $isSaving, selectedDevice: $selectedDevice, appsState: $appsState, schedule: $schedule, deviceName: $deviceName, errorEvent: $errorEvent, successEvent: $successEvent)'; return 'AppsSurveillanceViewState(isLoading: $isLoading, isSaving: $isSaving, selectedDevice: $selectedDevice, apps: $apps, schedule: $schedule, deviceName: $deviceName, errorEvent: $errorEvent, successEvent: $successEvent)';
} }
@@ -45,7 +45,7 @@ abstract mixin class $AppsSurveillanceViewStateCopyWith<$Res> {
factory $AppsSurveillanceViewStateCopyWith(AppsSurveillanceViewState value, $Res Function(AppsSurveillanceViewState) _then) = _$AppsSurveillanceViewStateCopyWithImpl; factory $AppsSurveillanceViewStateCopyWith(AppsSurveillanceViewState value, $Res Function(AppsSurveillanceViewState) _then) = _$AppsSurveillanceViewStateCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
bool isLoading, bool isSaving, DeviceEntity? selectedDevice, Map<String, bool> appsState, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent bool isLoading, bool isSaving, DeviceEntity? selectedDevice, List<InstalledAppEntity> apps, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent
}); });
@@ -62,13 +62,13 @@ class _$AppsSurveillanceViewStateCopyWithImpl<$Res>
/// Create a copy of AppsSurveillanceViewState /// Create a copy of AppsSurveillanceViewState
/// 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? isLoading = null,Object? isSaving = null,Object? selectedDevice = freezed,Object? appsState = null,Object? schedule = null,Object? deviceName = null,Object? errorEvent = freezed,Object? successEvent = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isSaving = null,Object? selectedDevice = freezed,Object? apps = null,Object? schedule = null,Object? deviceName = null,Object? errorEvent = freezed,Object? successEvent = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable
as bool,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable as bool,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
as DeviceEntity?,appsState: null == appsState ? _self.appsState : appsState // ignore: cast_nullable_to_non_nullable as DeviceEntity?,apps: null == apps ? _self.apps : apps // ignore: cast_nullable_to_non_nullable
as Map<String, bool>,schedule: null == schedule ? _self.schedule : schedule // ignore: cast_nullable_to_non_nullable as List<InstalledAppEntity>,schedule: null == schedule ? _self.schedule : schedule // ignore: cast_nullable_to_non_nullable
as List<SchedulePeriodEntity>,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable as List<SchedulePeriodEntity>,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
as String,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable as String,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable
as AppsSurveillanceErrorEvent?,successEvent: freezed == successEvent ? _self.successEvent : successEvent // ignore: cast_nullable_to_non_nullable as AppsSurveillanceErrorEvent?,successEvent: freezed == successEvent ? _self.successEvent : successEvent // ignore: cast_nullable_to_non_nullable
@@ -169,10 +169,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isSaving, DeviceEntity? selectedDevice, Map<String, bool> appsState, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isSaving, DeviceEntity? selectedDevice, List<InstalledAppEntity> apps, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _AppsSurveillanceViewState() when $default != null: case _AppsSurveillanceViewState() when $default != null:
return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.appsState,_that.schedule,_that.deviceName,_that.errorEvent,_that.successEvent);case _: return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.apps,_that.schedule,_that.deviceName,_that.errorEvent,_that.successEvent);case _:
return orElse(); return orElse();
} }
@@ -190,10 +190,10 @@ return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.appsSt
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isSaving, DeviceEntity? selectedDevice, Map<String, bool> appsState, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isSaving, DeviceEntity? selectedDevice, List<InstalledAppEntity> apps, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _AppsSurveillanceViewState(): case _AppsSurveillanceViewState():
return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.appsState,_that.schedule,_that.deviceName,_that.errorEvent,_that.successEvent);case _: return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.apps,_that.schedule,_that.deviceName,_that.errorEvent,_that.successEvent);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -210,10 +210,10 @@ return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.appsSt
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isSaving, DeviceEntity? selectedDevice, Map<String, bool> appsState, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isSaving, DeviceEntity? selectedDevice, List<InstalledAppEntity> apps, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _AppsSurveillanceViewState() when $default != null: case _AppsSurveillanceViewState() when $default != null:
return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.appsState,_that.schedule,_that.deviceName,_that.errorEvent,_that.successEvent);case _: return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.apps,_that.schedule,_that.deviceName,_that.errorEvent,_that.successEvent);case _:
return null; return null;
} }
@@ -225,17 +225,17 @@ return $default(_that.isLoading,_that.isSaving,_that.selectedDevice,_that.appsSt
class _AppsSurveillanceViewState implements AppsSurveillanceViewState { class _AppsSurveillanceViewState implements AppsSurveillanceViewState {
const _AppsSurveillanceViewState({this.isLoading = true, this.isSaving = false, this.selectedDevice, final Map<String, bool> appsState = const {}, final List<SchedulePeriodEntity> schedule = const [], this.deviceName = '', this.errorEvent, this.successEvent}): _appsState = appsState,_schedule = schedule; const _AppsSurveillanceViewState({this.isLoading = true, this.isSaving = false, this.selectedDevice, final List<InstalledAppEntity> apps = const [], final List<SchedulePeriodEntity> schedule = const [], this.deviceName = '', this.errorEvent, this.successEvent}): _apps = apps,_schedule = schedule;
@override@JsonKey() final bool isLoading; @override@JsonKey() final bool isLoading;
@override@JsonKey() final bool isSaving; @override@JsonKey() final bool isSaving;
@override final DeviceEntity? selectedDevice; @override final DeviceEntity? selectedDevice;
final Map<String, bool> _appsState; final List<InstalledAppEntity> _apps;
@override@JsonKey() Map<String, bool> get appsState { @override@JsonKey() List<InstalledAppEntity> get apps {
if (_appsState is EqualUnmodifiableMapView) return _appsState; if (_apps is EqualUnmodifiableListView) return _apps;
// ignore: implicit_dynamic_type // ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_appsState); return EqualUnmodifiableListView(_apps);
} }
final List<SchedulePeriodEntity> _schedule; final List<SchedulePeriodEntity> _schedule;
@@ -259,16 +259,16 @@ _$AppsSurveillanceViewStateCopyWith<_AppsSurveillanceViewState> get copyWith =>
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppsSurveillanceViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._appsState, _appsState)&&const DeepCollectionEquality().equals(other._schedule, _schedule)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppsSurveillanceViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._apps, _apps)&&const DeepCollectionEquality().equals(other._schedule, _schedule)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent));
} }
@override @override
int get hashCode => Object.hash(runtimeType,isLoading,isSaving,selectedDevice,const DeepCollectionEquality().hash(_appsState),const DeepCollectionEquality().hash(_schedule),deviceName,errorEvent,successEvent); int get hashCode => Object.hash(runtimeType,isLoading,isSaving,selectedDevice,const DeepCollectionEquality().hash(_apps),const DeepCollectionEquality().hash(_schedule),deviceName,errorEvent,successEvent);
@override @override
String toString() { String toString() {
return 'AppsSurveillanceViewState(isLoading: $isLoading, isSaving: $isSaving, selectedDevice: $selectedDevice, appsState: $appsState, schedule: $schedule, deviceName: $deviceName, errorEvent: $errorEvent, successEvent: $successEvent)'; return 'AppsSurveillanceViewState(isLoading: $isLoading, isSaving: $isSaving, selectedDevice: $selectedDevice, apps: $apps, schedule: $schedule, deviceName: $deviceName, errorEvent: $errorEvent, successEvent: $successEvent)';
} }
@@ -279,7 +279,7 @@ abstract mixin class _$AppsSurveillanceViewStateCopyWith<$Res> implements $AppsS
factory _$AppsSurveillanceViewStateCopyWith(_AppsSurveillanceViewState value, $Res Function(_AppsSurveillanceViewState) _then) = __$AppsSurveillanceViewStateCopyWithImpl; factory _$AppsSurveillanceViewStateCopyWith(_AppsSurveillanceViewState value, $Res Function(_AppsSurveillanceViewState) _then) = __$AppsSurveillanceViewStateCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
bool isLoading, bool isSaving, DeviceEntity? selectedDevice, Map<String, bool> appsState, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent bool isLoading, bool isSaving, DeviceEntity? selectedDevice, List<InstalledAppEntity> apps, List<SchedulePeriodEntity> schedule, String deviceName, AppsSurveillanceErrorEvent? errorEvent, AppsSurveillanceSuccessEvent? successEvent
}); });
@@ -296,13 +296,13 @@ class __$AppsSurveillanceViewStateCopyWithImpl<$Res>
/// Create a copy of AppsSurveillanceViewState /// Create a copy of AppsSurveillanceViewState
/// 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? isLoading = null,Object? isSaving = null,Object? selectedDevice = freezed,Object? appsState = null,Object? schedule = null,Object? deviceName = null,Object? errorEvent = freezed,Object? successEvent = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isSaving = null,Object? selectedDevice = freezed,Object? apps = null,Object? schedule = null,Object? deviceName = null,Object? errorEvent = freezed,Object? successEvent = freezed,}) {
return _then(_AppsSurveillanceViewState( return _then(_AppsSurveillanceViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable
as bool,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable as bool,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
as DeviceEntity?,appsState: null == appsState ? _self._appsState : appsState // ignore: cast_nullable_to_non_nullable as DeviceEntity?,apps: null == apps ? _self._apps : apps // ignore: cast_nullable_to_non_nullable
as Map<String, bool>,schedule: null == schedule ? _self._schedule : schedule // ignore: cast_nullable_to_non_nullable as List<InstalledAppEntity>,schedule: null == schedule ? _self._schedule : schedule // ignore: cast_nullable_to_non_nullable
as List<SchedulePeriodEntity>,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable as List<SchedulePeriodEntity>,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
as String,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable as String,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable
as AppsSurveillanceErrorEvent?,successEvent: freezed == successEvent ? _self.successEvent : successEvent // ignore: cast_nullable_to_non_nullable as AppsSurveillanceErrorEvent?,successEvent: freezed == successEvent ? _self.successEvent : successEvent // ignore: cast_nullable_to_non_nullable

View File

@@ -52,8 +52,8 @@ class _PeriodFormSheetState extends ConsumerState<_PeriodFormSheet> {
} }
String _buildTime(TimeOfDay time) { String _buildTime(TimeOfDay time) {
final hh = time.hour; final hh = time.hour.toString().padLeft(2, '0');
final mm = time.minute; final mm = time.minute.toString().padLeft(2, '0');
return '$hh:$mm'; return '$hh:$mm';
} }

View File

@@ -7,6 +7,6 @@
<versions> <versions>
<version>2.6.4</version> <version>2.6.4</version>
</versions> </versions>
<lastUpdated>20260325000000</lastUpdated> <lastUpdated>20260326000000</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>

View File

@@ -1 +1 @@
afdf53af75a016d3a59635398d34f60d f68228177676fb62b06951038b70f33b

View File

@@ -1 +1 @@
bf02df387eb61f33404881f4a9a3c80dfa29e6d1 a3d9c8512c55c03c4c509590c2c6909009f4476e

View File

@@ -838,8 +838,9 @@
"errorTakePicture": "Error taking photo", "errorTakePicture": "Error taking photo",
"errorFetchPhotos": "Error fetching photos", "errorFetchPhotos": "Error fetching photos",
"errorCall": "Error making call", "errorCall": "Error making call",
"timezoneOther": "Other timezones",
"appsSurveillanceMessage": "After disabling it, the device won't be able to use this feature or application", "appsSurveillanceMessage": "After disabling it, the device won't be able to use this feature or application",
"appsScheduleMessage": "After setting a restriction period, the watch will not be able to use restricted features or apps during that time.\nIf you do not set a restriction period, the watch will automatically switch between enabled and restricted modes throughout the day by default.", "appsScheduleMessage": "After setting a restriction period, the watch will not be able to use restricted features or apps during that time.\nIf you do not set a restriction period, the watch will automatically switch between enabled and restricted modes throughout the day by default.",
"disablePeriods": "Disable periods" "disablePeriods": "Disable periods",
"enabled": "Enabled",
"disabled": "Disabled"
} }

View File

@@ -836,9 +836,10 @@
"errorTakePicture": "Error al tomar la foto", "errorTakePicture": "Error al tomar la foto",
"errorFetchPhotos": "Error al obtener las fotos", "errorFetchPhotos": "Error al obtener las fotos",
"errorCall": "Error al realizar la llamada", "errorCall": "Error al realizar la llamada",
"timezoneOther": "Otras zonas horarias",
"appsSurveillanceMessage": "Después de desactivarlo, el reloj no podrá utilizar esta función o aplicación", "appsSurveillanceMessage": "Después de desactivarlo, el reloj no podrá utilizar esta función o aplicación",
"disablePeriods": "Periodos de desactivación", "disablePeriods": "Periodos de desactivación",
"appsScheduleMessage": "Después de configurar un periodo de inhabilitación, el reloj no podrá utilizar funciones o aplicaciones deshabilitadas durante este periodo.\nSi no establece un periodo de inhabilitación, se habilitará y deshabilitará durante todo el día de forma predeterminada.", "appsScheduleMessage": "Después de configurar un periodo de inhabilitación, el reloj no podrá utilizar funciones o aplicaciones deshabilitadas durante este periodo.\nSi no establece un periodo de inhabilitación, se habilitará y deshabilitará durante todo el día de forma predeterminada.",
"period": "Periodo de tiempo {index}" "period": "Periodo de tiempo {index}",
"enabled": "Habilitado",
"disabled": "Deshabilitado"
} }

View File

@@ -843,4 +843,6 @@ class I18n {
static const String disablePeriods = 'disablePeriods'; static const String disablePeriods = 'disablePeriods';
static const String appsScheduleMessage = 'appsScheduleMessage'; static const String appsScheduleMessage = 'appsScheduleMessage';
static const String period = 'period'; static const String period = 'period';
static const String enabled = 'enabled';
static const String disabled = 'disabled';
} }