diff --git a/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/providers/call_history_provider.g.dart b/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/providers/call_history_provider.g.dart index c4dcdbf6..6c7cf829 100644 --- a/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/providers/call_history_provider.g.dart +++ b/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/providers/call_history_provider.g.dart @@ -66,7 +66,7 @@ final class CallHistoryProvider } } -String _$callHistoryHash() => r'f5b99a06bc69f62660d1cf7b66648a279724f216'; +String _$callHistoryHash() => r'86542b22355569620e6c9d58091b6580103b852e'; final class CallHistoryFamily extends $Family with $FunctionalFamilyOverride>, String> { diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_model.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_controller.dart similarity index 88% rename from modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_model.dart rename to modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_controller.dart index 397f7124..781b8942 100644 --- a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_model.dart +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_controller.dart @@ -1,21 +1,19 @@ import 'dart:async'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:get_it/get_it.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:videocall_sdk/videocall_sdk.dart'; import '../../domain/entities/videocall_error.dart'; import '../../domain/entities/videocall_participant.dart'; -import 'group_call_view_state.dart'; +import 'group_call_state.dart'; -final groupCallViewModelProvider = - NotifierProvider.autoDispose( - GroupCallViewModel.new, -); +part 'group_call_controller.g.dart'; -class GroupCallViewModel extends Notifier { - late final VideocallChannelService _channelService; - late final VideocallDeviceService _deviceService; +@riverpod +class GroupCallController extends _$GroupCallController { + late VideocallChannelService _channelService; + late VideocallDeviceService _deviceService; StreamSubscription<({bool result, int reason, String channelId})>? _joinSub; StreamSubscription<({int reason, String channelId})>? _leaveSub; @@ -29,14 +27,14 @@ class GroupCallViewModel extends Notifier { _participantUpdateSub; @override - GroupCallViewState build() { + GroupCallState build() { _channelService = GetIt.I(); _deviceService = GetIt.I(); ref.onDispose(_disposeSubscriptions); _subscribeToStreams(); - return const GroupCallViewState(); + return const GroupCallState(); } void _subscribeToStreams() { @@ -50,8 +48,6 @@ class GroupCallViewModel extends Notifier { _channelService.participantUpdateStream.listen(_onParticipantUpdate); } - // -- Channel actions -- - Future joinChannel(String channelId) async { await _channelService.enableUploadAudioStream(true); await _channelService.enableUploadVideoStream(true); @@ -75,8 +71,6 @@ class GroupCallViewModel extends Notifier { await _channelService.stop(); } - // -- Media controls -- - Future toggleMic() async { final newValue = !state.isMicEnabled; await _channelService.enableUploadAudioStream(newValue); @@ -95,8 +89,6 @@ class GroupCallViewModel extends Notifier { await _deviceService.switchCamera(); } - // -- Stream callbacks -- - Future _onJoin( ({bool result, int reason, String channelId}) event) async { if (!ref.mounted) return; @@ -108,7 +100,6 @@ class GroupCallViewModel extends Notifier { state = state.copyWith(isJoined: true, channelId: event.channelId); - // Start local video final selfParticipant = await _channelService.getSelfParticipant(); if (selfParticipant == null || !ref.mounted) return; @@ -180,11 +171,8 @@ class GroupCallViewModel extends Notifier { ChannelChangeParam changeParam, }) event) { if (!ref.mounted) return; - // Update participant in list if needed } - // -- Helpers -- - void clearError() { state = state.copyWith(errorEvent: null); } diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_controller.g.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_controller.g.dart new file mode 100644 index 00000000..b0774944 --- /dev/null +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_controller.g.dart @@ -0,0 +1,64 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'group_call_controller.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(GroupCallController) +const groupCallControllerProvider = GroupCallControllerProvider._(); + +final class GroupCallControllerProvider + extends $NotifierProvider { + const GroupCallControllerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'groupCallControllerProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$groupCallControllerHash(); + + @$internal + @override + GroupCallController create() => GroupCallController(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(GroupCallState value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$groupCallControllerHash() => + r'c8528072cb1b6d2bb15d50b199405938e7d3acd0'; + +abstract class _$GroupCallController extends $Notifier { + GroupCallState build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + GroupCallState, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_state.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_state.dart similarity index 76% rename from modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_state.dart rename to modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_state.dart index dac47143..e10efda7 100644 --- a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_state.dart +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_state.dart @@ -4,11 +4,11 @@ import 'package:videocall_sdk/videocall_sdk.dart'; import '../../domain/entities/videocall_error.dart'; import '../../domain/entities/videocall_participant.dart'; -part 'group_call_view_state.freezed.dart'; +part 'group_call_state.freezed.dart'; @freezed -abstract class GroupCallViewState with _$GroupCallViewState { - const factory GroupCallViewState({ +abstract class GroupCallState with _$GroupCallState { + const factory GroupCallState({ @Default('') String channelId, @Default(false) bool isJoined, @Default(true) bool isMicEnabled, @@ -17,5 +17,5 @@ abstract class GroupCallViewState with _$GroupCallViewState { JCMediaDeviceVideoCanvas? localCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent, - }) = _GroupCallViewState; + }) = _GroupCallState; } diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_state.freezed.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_state.freezed.dart similarity index 69% rename from modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_state.freezed.dart rename to modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_state.freezed.dart index a69991a1..76af9792 100644 --- a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/group_call_view_state.freezed.dart +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/group_call_state.freezed.dart @@ -3,7 +3,7 @@ // 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 'group_call_view_state.dart'; +part of 'group_call_state.dart'; // ************************************************************************** // FreezedGenerator @@ -12,20 +12,20 @@ part of 'group_call_view_state.dart'; // dart format off T _$identity(T value) => value; /// @nodoc -mixin _$GroupCallViewState { +mixin _$GroupCallState { String get channelId; bool get isJoined; bool get isMicEnabled; bool get isCameraEnabled; List get participants; JCMediaDeviceVideoCanvas? get localCanvas; VideocallErrorEvent? get errorEvent; VideocallSuccessEvent? get successEvent; -/// Create a copy of GroupCallViewState +/// Create a copy of GroupCallState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$GroupCallViewStateCopyWith get copyWith => _$GroupCallViewStateCopyWithImpl(this as GroupCallViewState, _$identity); +$GroupCallStateCopyWith get copyWith => _$GroupCallStateCopyWithImpl(this as GroupCallState, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is GroupCallViewState&&(identical(other.channelId, channelId) || other.channelId == channelId)&&(identical(other.isJoined, isJoined) || other.isJoined == isJoined)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isCameraEnabled, isCameraEnabled) || other.isCameraEnabled == isCameraEnabled)&&const DeepCollectionEquality().equals(other.participants, participants)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is GroupCallState&&(identical(other.channelId, channelId) || other.channelId == channelId)&&(identical(other.isJoined, isJoined) || other.isJoined == isJoined)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isCameraEnabled, isCameraEnabled) || other.isCameraEnabled == isCameraEnabled)&&const DeepCollectionEquality().equals(other.participants, participants)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); } @@ -34,15 +34,15 @@ int get hashCode => Object.hash(runtimeType,channelId,isJoined,isMicEnabled,isCa @override String toString() { - return 'GroupCallViewState(channelId: $channelId, isJoined: $isJoined, isMicEnabled: $isMicEnabled, isCameraEnabled: $isCameraEnabled, participants: $participants, localCanvas: $localCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; + return 'GroupCallState(channelId: $channelId, isJoined: $isJoined, isMicEnabled: $isMicEnabled, isCameraEnabled: $isCameraEnabled, participants: $participants, localCanvas: $localCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; } } /// @nodoc -abstract mixin class $GroupCallViewStateCopyWith<$Res> { - factory $GroupCallViewStateCopyWith(GroupCallViewState value, $Res Function(GroupCallViewState) _then) = _$GroupCallViewStateCopyWithImpl; +abstract mixin class $GroupCallStateCopyWith<$Res> { + factory $GroupCallStateCopyWith(GroupCallState value, $Res Function(GroupCallState) _then) = _$GroupCallStateCopyWithImpl; @useResult $Res call({ String channelId, bool isJoined, bool isMicEnabled, bool isCameraEnabled, List participants, JCMediaDeviceVideoCanvas? localCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent @@ -53,14 +53,14 @@ $Res call({ } /// @nodoc -class _$GroupCallViewStateCopyWithImpl<$Res> - implements $GroupCallViewStateCopyWith<$Res> { - _$GroupCallViewStateCopyWithImpl(this._self, this._then); +class _$GroupCallStateCopyWithImpl<$Res> + implements $GroupCallStateCopyWith<$Res> { + _$GroupCallStateCopyWithImpl(this._self, this._then); - final GroupCallViewState _self; - final $Res Function(GroupCallViewState) _then; + final GroupCallState _self; + final $Res Function(GroupCallState) _then; -/// Create a copy of GroupCallViewState +/// Create a copy of GroupCallState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? channelId = null,Object? isJoined = null,Object? isMicEnabled = null,Object? isCameraEnabled = null,Object? participants = null,Object? localCanvas = freezed,Object? errorEvent = freezed,Object? successEvent = freezed,}) { return _then(_self.copyWith( @@ -79,8 +79,8 @@ as VideocallSuccessEvent?, } -/// Adds pattern-matching-related methods to [GroupCallViewState]. -extension GroupCallViewStatePatterns on GroupCallViewState { +/// Adds pattern-matching-related methods to [GroupCallState]. +extension GroupCallStatePatterns on GroupCallState { /// A variant of `map` that fallback to returning `orElse`. /// /// It is equivalent to doing: @@ -93,10 +93,10 @@ extension GroupCallViewStatePatterns on GroupCallViewState { /// } /// ``` -@optionalTypeArgs TResult maybeMap(TResult Function( _GroupCallViewState value)? $default,{required TResult orElse(),}){ +@optionalTypeArgs TResult maybeMap(TResult Function( _GroupCallState value)? $default,{required TResult orElse(),}){ final _that = this; switch (_that) { -case _GroupCallViewState() when $default != null: +case _GroupCallState() when $default != null: return $default(_that);case _: return orElse(); @@ -115,10 +115,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult map(TResult Function( _GroupCallViewState value) $default,){ +@optionalTypeArgs TResult map(TResult Function( _GroupCallState value) $default,){ final _that = this; switch (_that) { -case _GroupCallViewState(): +case _GroupCallState(): return $default(_that);case _: throw StateError('Unexpected subclass'); @@ -136,10 +136,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult? mapOrNull(TResult? Function( _GroupCallViewState value)? $default,){ +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _GroupCallState value)? $default,){ final _that = this; switch (_that) { -case _GroupCallViewState() when $default != null: +case _GroupCallState() when $default != null: return $default(_that);case _: return null; @@ -159,7 +159,7 @@ return $default(_that);case _: @optionalTypeArgs TResult maybeWhen(TResult Function( String channelId, bool isJoined, bool isMicEnabled, bool isCameraEnabled, List participants, JCMediaDeviceVideoCanvas? localCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { -case _GroupCallViewState() when $default != null: +case _GroupCallState() when $default != null: return $default(_that.channelId,_that.isJoined,_that.isMicEnabled,_that.isCameraEnabled,_that.participants,_that.localCanvas,_that.errorEvent,_that.successEvent);case _: return orElse(); @@ -180,7 +180,7 @@ return $default(_that.channelId,_that.isJoined,_that.isMicEnabled,_that.isCamera @optionalTypeArgs TResult when(TResult Function( String channelId, bool isJoined, bool isMicEnabled, bool isCameraEnabled, List participants, JCMediaDeviceVideoCanvas? localCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent) $default,) {final _that = this; switch (_that) { -case _GroupCallViewState(): +case _GroupCallState(): return $default(_that.channelId,_that.isJoined,_that.isMicEnabled,_that.isCameraEnabled,_that.participants,_that.localCanvas,_that.errorEvent,_that.successEvent);case _: throw StateError('Unexpected subclass'); @@ -200,7 +200,7 @@ return $default(_that.channelId,_that.isJoined,_that.isMicEnabled,_that.isCamera @optionalTypeArgs TResult? whenOrNull(TResult? Function( String channelId, bool isJoined, bool isMicEnabled, bool isCameraEnabled, List participants, JCMediaDeviceVideoCanvas? localCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent)? $default,) {final _that = this; switch (_that) { -case _GroupCallViewState() when $default != null: +case _GroupCallState() when $default != null: return $default(_that.channelId,_that.isJoined,_that.isMicEnabled,_that.isCameraEnabled,_that.participants,_that.localCanvas,_that.errorEvent,_that.successEvent);case _: return null; @@ -212,8 +212,8 @@ return $default(_that.channelId,_that.isJoined,_that.isMicEnabled,_that.isCamera /// @nodoc -class _GroupCallViewState implements GroupCallViewState { - const _GroupCallViewState({this.channelId = '', this.isJoined = false, this.isMicEnabled = true, this.isCameraEnabled = true, final List participants = const [], this.localCanvas, this.errorEvent, this.successEvent}): _participants = participants; +class _GroupCallState implements GroupCallState { + const _GroupCallState({this.channelId = '', this.isJoined = false, this.isMicEnabled = true, this.isCameraEnabled = true, final List participants = const [], this.localCanvas, this.errorEvent, this.successEvent}): _participants = participants; @override@JsonKey() final String channelId; @@ -231,17 +231,17 @@ class _GroupCallViewState implements GroupCallViewState { @override final VideocallErrorEvent? errorEvent; @override final VideocallSuccessEvent? successEvent; -/// Create a copy of GroupCallViewState +/// Create a copy of GroupCallState /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -_$GroupCallViewStateCopyWith<_GroupCallViewState> get copyWith => __$GroupCallViewStateCopyWithImpl<_GroupCallViewState>(this, _$identity); +_$GroupCallStateCopyWith<_GroupCallState> get copyWith => __$GroupCallStateCopyWithImpl<_GroupCallState>(this, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _GroupCallViewState&&(identical(other.channelId, channelId) || other.channelId == channelId)&&(identical(other.isJoined, isJoined) || other.isJoined == isJoined)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isCameraEnabled, isCameraEnabled) || other.isCameraEnabled == isCameraEnabled)&&const DeepCollectionEquality().equals(other._participants, _participants)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GroupCallState&&(identical(other.channelId, channelId) || other.channelId == channelId)&&(identical(other.isJoined, isJoined) || other.isJoined == isJoined)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isCameraEnabled, isCameraEnabled) || other.isCameraEnabled == isCameraEnabled)&&const DeepCollectionEquality().equals(other._participants, _participants)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); } @@ -250,15 +250,15 @@ int get hashCode => Object.hash(runtimeType,channelId,isJoined,isMicEnabled,isCa @override String toString() { - return 'GroupCallViewState(channelId: $channelId, isJoined: $isJoined, isMicEnabled: $isMicEnabled, isCameraEnabled: $isCameraEnabled, participants: $participants, localCanvas: $localCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; + return 'GroupCallState(channelId: $channelId, isJoined: $isJoined, isMicEnabled: $isMicEnabled, isCameraEnabled: $isCameraEnabled, participants: $participants, localCanvas: $localCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; } } /// @nodoc -abstract mixin class _$GroupCallViewStateCopyWith<$Res> implements $GroupCallViewStateCopyWith<$Res> { - factory _$GroupCallViewStateCopyWith(_GroupCallViewState value, $Res Function(_GroupCallViewState) _then) = __$GroupCallViewStateCopyWithImpl; +abstract mixin class _$GroupCallStateCopyWith<$Res> implements $GroupCallStateCopyWith<$Res> { + factory _$GroupCallStateCopyWith(_GroupCallState value, $Res Function(_GroupCallState) _then) = __$GroupCallStateCopyWithImpl; @override @useResult $Res call({ String channelId, bool isJoined, bool isMicEnabled, bool isCameraEnabled, List participants, JCMediaDeviceVideoCanvas? localCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent @@ -269,17 +269,17 @@ $Res call({ } /// @nodoc -class __$GroupCallViewStateCopyWithImpl<$Res> - implements _$GroupCallViewStateCopyWith<$Res> { - __$GroupCallViewStateCopyWithImpl(this._self, this._then); +class __$GroupCallStateCopyWithImpl<$Res> + implements _$GroupCallStateCopyWith<$Res> { + __$GroupCallStateCopyWithImpl(this._self, this._then); - final _GroupCallViewState _self; - final $Res Function(_GroupCallViewState) _then; + final _GroupCallState _self; + final $Res Function(_GroupCallState) _then; -/// Create a copy of GroupCallViewState +/// Create a copy of GroupCallState /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $Res call({Object? channelId = null,Object? isJoined = null,Object? isMicEnabled = null,Object? isCameraEnabled = null,Object? participants = null,Object? localCanvas = freezed,Object? errorEvent = freezed,Object? successEvent = freezed,}) { - return _then(_GroupCallViewState( + return _then(_GroupCallState( channelId: null == channelId ? _self.channelId : channelId // ignore: cast_nullable_to_non_nullable as String,isJoined: null == isJoined ? _self.isJoined : isJoined // ignore: cast_nullable_to_non_nullable as bool,isMicEnabled: null == isMicEnabled ? _self.isMicEnabled : isMicEnabled // ignore: cast_nullable_to_non_nullable diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_model.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_controller.dart similarity index 68% rename from modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_model.dart rename to modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_controller.dart index af1d806d..46447a5c 100644 --- a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_model.dart +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_controller.dart @@ -1,23 +1,21 @@ import 'dart:async'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:get_it/get_it.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:sf_shared/sf_shared.dart'; -import 'package:videocall_sdk/videocall_sdk.dart'; +import 'package:videocall_sdk/videocall_sdk.dart' hide VideocallState; import '../../domain/entities/videocall_error.dart'; -import 'videocall_view_state.dart'; +import 'videocall_state.dart'; -final videocallViewModelProvider = - NotifierProvider.autoDispose( - VideocallViewModel.new, -); +part 'videocall_controller.g.dart'; -class VideocallViewModel extends Notifier { - late final VideocallSdkManager _manager; - late final VideocallCallService _callService; - late final VideocallDeviceService _deviceService; - late final VideocallClient _client; +@riverpod +class VideocallController extends _$VideocallController { + late VideocallSdkManager _manager; + late VideocallCallService _callService; + late VideocallDeviceService _deviceService; + late VideocallClient _client; StreamSubscription? _callAddSub; StreamSubscription? _callUpdateSub; @@ -26,7 +24,7 @@ class VideocallViewModel extends Notifier { StreamSubscription? _clientStateSub; @override - VideocallViewState build() { + VideocallState build() { _manager = GetIt.I(); _callService = GetIt.I(); _deviceService = GetIt.I(); @@ -38,12 +36,14 @@ class VideocallViewModel extends Notifier { ref.onDispose(_disposeSubscriptions); Future.microtask(_initSdk); - return VideocallViewState(deviceId: deviceId); + return VideocallState(deviceId: deviceId); } Future _initSdk() async { if (_manager.isInitialized) { _subscribeToStreams(); + await _configureDevice(); + if (!ref.mounted) return; state = state.copyWith(isSdkReady: true); return; } @@ -57,9 +57,26 @@ class VideocallViewModel extends Notifier { } _subscribeToStreams(); + await _configureDevice(); + if (!ref.mounted) return; state = state.copyWith(isSdkReady: true); } + Future _configureDevice() async { + _deviceService.setDefaultSpeakerOn(true); + _deviceService.setCameraProperty(640, 360, 30); + _deviceService.setVideoAngle(0); + _callService.setMaxCallNum(1); + _callService.setTermWhenNetDisconnected(true); + + final device = ref.read(selectedDeviceProvider).value; + final isRtos = device?.capabilities?.isRtos ?? false; + final mediaConfig = await VideocallCallService.generateMediaConfigByMode( + isRtos ? MediaConfig.MODE_RTOS : MediaConfig.MODE_INTELLIGENT_HARDWARE, + ); + _callService.updateMediaConfig(mediaConfig); + } + void _subscribeToStreams() { _callAddSub = _callService.callItemAddStream.listen(_onCallItemAdd); _callUpdateSub = @@ -70,8 +87,6 @@ class VideocallViewModel extends Notifier { _clientStateSub = _client.stateStream.listen(_onClientStateChange); } - // -- Auth -- - Future login({ required String userId, required String password, @@ -86,22 +101,31 @@ class VideocallViewModel extends Notifier { return true; } - // -- Call actions -- - Future startCall(String remoteUserId) async { + final device = ref.read(selectedDeviceProvider).value; + final targetUserId = + remoteUserId.isNotEmpty ? remoteUserId : 'w_${device?.imei ?? ''}'; + state = state.copyWith( - remoteUserId: remoteUserId, + remoteUserId: targetUserId, screenMode: VideocallScreenMode.outgoing, errorEvent: null, ); + await _deviceService.startAudio(); + await _deviceService.startCamera(); + + final callParam = CallParam(ticket: state.deviceId); final ok = await _callService.startCall( - userId: remoteUserId, + userId: targetUserId, isVideo: true, + callParam: callParam, ); if (!ref.mounted) return; if (!ok) { + await _deviceService.stopAudio(); + await _deviceService.stopCamera(); state = state.copyWith( screenMode: VideocallScreenMode.idle, errorEvent: VideocallErrorEvent.callStart, @@ -110,10 +134,15 @@ class VideocallViewModel extends Notifier { } Future answerCall() async { + await _deviceService.startAudio(); + await _deviceService.startCamera(); + final ok = await _callService.answerCall(isVideo: true); if (!ref.mounted) return; if (!ok) { + await _deviceService.stopAudio(); + await _deviceService.stopCamera(); state = state.copyWith( screenMode: VideocallScreenMode.idle, errorEvent: VideocallErrorEvent.callAnswer, @@ -125,6 +154,8 @@ class VideocallViewModel extends Notifier { await _callService.hangUp(); if (!ref.mounted) return; await _stopVideoViews(); + await _deviceService.stopAudio(); + await _deviceService.stopCamera(); state = state.copyWith( screenMode: VideocallScreenMode.idle, currentCall: null, @@ -141,8 +172,6 @@ class VideocallViewModel extends Notifier { ); } - // -- Media controls -- - Future toggleMic() async { final item = await _callService.getActiveCallItem(); if (item == null) return; @@ -165,13 +194,19 @@ class VideocallViewModel extends Notifier { state = state.copyWith(isFrontCamera: !state.isFrontCamera); } - // -- Video views -- - - Future _startVideoViews() async { + Future _startLocalVideo() async { final localCanvas = await _callService.startLocalVideo(); if (!ref.mounted) return; state = state.copyWith(localCanvas: localCanvas); + } + Future _stopLocalVideo() async { + await _callService.stopLocalVideo(); + if (!ref.mounted) return; + state = state.copyWith(localCanvas: null); + } + + Future _startRemoteVideo() async { final remoteCanvas = await _callService.startRemoteVideo(); if (!ref.mounted) return; state = state.copyWith( @@ -180,6 +215,12 @@ class VideocallViewModel extends Notifier { ); } + Future _stopRemoteVideo() async { + await _callService.stopRemoteVideo(); + if (!ref.mounted) return; + state = state.copyWith(remoteCanvas: null, isRemoteVideoAvailable: false); + } + Future _stopVideoViews() async { await _callService.stopLocalVideo(); await _callService.stopRemoteVideo(); @@ -191,8 +232,6 @@ class VideocallViewModel extends Notifier { ); } - // -- Stream callbacks -- - void _onCallItemAdd(VideocallItem item) { if (!ref.mounted) return; if (item.direction == CallDirection.incoming) { @@ -213,19 +252,35 @@ class VideocallViewModel extends Notifier { if (!ref.mounted) return; state = state.copyWith(currentCall: item); - if (item.state == VideocallState.talking && - state.screenMode != VideocallScreenMode.inCall) { + final isTalking = item.state.name == 'talking'; + + if (isTalking && state.screenMode != VideocallScreenMode.inCall) { state = state.copyWith( screenMode: VideocallScreenMode.inCall, successEvent: VideocallSuccessEvent.connected, ); - _startVideoViews(); + } + + if (item.uploadVideoStreamSelf && state.localCanvas == null) { + _startLocalVideo(); + } else if (!item.uploadVideoStreamSelf && state.localCanvas != null) { + _stopLocalVideo(); + } + + if (isTalking && + item.uploadVideoStreamOther && + state.remoteCanvas == null) { + _startRemoteVideo(); + } else if (!item.uploadVideoStreamOther && state.remoteCanvas != null) { + _stopRemoteVideo(); } } void _onCallItemRemove(({int reason, String description}) event) { if (!ref.mounted) return; _stopVideoViews(); + _deviceService.stopAudio(); + _deviceService.stopCamera(); state = state.copyWith( screenMode: VideocallScreenMode.idle, currentCall: null, @@ -250,8 +305,6 @@ class VideocallViewModel extends Notifier { } } - // -- Helpers -- - void clearError() { state = state.copyWith(errorEvent: null); } diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_controller.g.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_controller.g.dart new file mode 100644 index 00000000..045d7653 --- /dev/null +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_controller.g.dart @@ -0,0 +1,64 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'videocall_controller.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(VideocallController) +const videocallControllerProvider = VideocallControllerProvider._(); + +final class VideocallControllerProvider + extends $NotifierProvider { + const VideocallControllerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'videocallControllerProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$videocallControllerHash(); + + @$internal + @override + VideocallController create() => VideocallController(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(VideocallState value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$videocallControllerHash() => + r'2fc967b9e44ca13586fd36e0d3eaab1014d52821'; + +abstract class _$VideocallController extends $Notifier { + VideocallState build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + VideocallState, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_state.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_state.dart similarity index 81% rename from modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_state.dart rename to modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_state.dart index 7b2c7c00..ff868354 100644 --- a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_state.dart +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_state.dart @@ -3,11 +3,11 @@ import 'package:videocall_sdk/videocall_sdk.dart'; import '../../domain/entities/videocall_error.dart'; -part 'videocall_view_state.freezed.dart'; +part 'videocall_state.freezed.dart'; @freezed -abstract class VideocallViewState with _$VideocallViewState { - const factory VideocallViewState({ +abstract class VideocallState with _$VideocallState { + const factory VideocallState({ @Default('') String deviceId, @Default('') String localUserId, @Default('') String remoteUserId, @@ -22,5 +22,5 @@ abstract class VideocallViewState with _$VideocallViewState { JCMediaDeviceVideoCanvas? remoteCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent, - }) = _VideocallViewState; + }) = _VideocallState; } diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_state.freezed.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_state.freezed.dart similarity index 69% rename from modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_state.freezed.dart rename to modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_state.freezed.dart index b18c98d6..1e5c0fdb 100644 --- a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/state/videocall_view_state.freezed.dart +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/providers/videocall_state.freezed.dart @@ -3,7 +3,7 @@ // 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 'videocall_view_state.dart'; +part of 'videocall_state.dart'; // ************************************************************************** // FreezedGenerator @@ -12,20 +12,20 @@ part of 'videocall_view_state.dart'; // dart format off T _$identity(T value) => value; /// @nodoc -mixin _$VideocallViewState { +mixin _$VideocallState { String get deviceId; String get localUserId; String get remoteUserId; VideocallScreenMode get screenMode; bool get isSdkReady; bool get isMicEnabled; bool get isSpeakerEnabled; bool get isFrontCamera; bool get isRemoteVideoAvailable; VideocallItem? get currentCall; JCMediaDeviceVideoCanvas? get localCanvas; JCMediaDeviceVideoCanvas? get remoteCanvas; VideocallErrorEvent? get errorEvent; VideocallSuccessEvent? get successEvent; -/// Create a copy of VideocallViewState +/// Create a copy of VideocallState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$VideocallViewStateCopyWith get copyWith => _$VideocallViewStateCopyWithImpl(this as VideocallViewState, _$identity); +$VideocallStateCopyWith get copyWith => _$VideocallStateCopyWithImpl(this as VideocallState, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is VideocallViewState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.localUserId, localUserId) || other.localUserId == localUserId)&&(identical(other.remoteUserId, remoteUserId) || other.remoteUserId == remoteUserId)&&(identical(other.screenMode, screenMode) || other.screenMode == screenMode)&&(identical(other.isSdkReady, isSdkReady) || other.isSdkReady == isSdkReady)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isSpeakerEnabled, isSpeakerEnabled) || other.isSpeakerEnabled == isSpeakerEnabled)&&(identical(other.isFrontCamera, isFrontCamera) || other.isFrontCamera == isFrontCamera)&&(identical(other.isRemoteVideoAvailable, isRemoteVideoAvailable) || other.isRemoteVideoAvailable == isRemoteVideoAvailable)&&(identical(other.currentCall, currentCall) || other.currentCall == currentCall)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.remoteCanvas, remoteCanvas) || other.remoteCanvas == remoteCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is VideocallState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.localUserId, localUserId) || other.localUserId == localUserId)&&(identical(other.remoteUserId, remoteUserId) || other.remoteUserId == remoteUserId)&&(identical(other.screenMode, screenMode) || other.screenMode == screenMode)&&(identical(other.isSdkReady, isSdkReady) || other.isSdkReady == isSdkReady)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isSpeakerEnabled, isSpeakerEnabled) || other.isSpeakerEnabled == isSpeakerEnabled)&&(identical(other.isFrontCamera, isFrontCamera) || other.isFrontCamera == isFrontCamera)&&(identical(other.isRemoteVideoAvailable, isRemoteVideoAvailable) || other.isRemoteVideoAvailable == isRemoteVideoAvailable)&&(identical(other.currentCall, currentCall) || other.currentCall == currentCall)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.remoteCanvas, remoteCanvas) || other.remoteCanvas == remoteCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); } @@ -34,15 +34,15 @@ int get hashCode => Object.hash(runtimeType,deviceId,localUserId,remoteUserId,sc @override String toString() { - return 'VideocallViewState(deviceId: $deviceId, localUserId: $localUserId, remoteUserId: $remoteUserId, screenMode: $screenMode, isSdkReady: $isSdkReady, isMicEnabled: $isMicEnabled, isSpeakerEnabled: $isSpeakerEnabled, isFrontCamera: $isFrontCamera, isRemoteVideoAvailable: $isRemoteVideoAvailable, currentCall: $currentCall, localCanvas: $localCanvas, remoteCanvas: $remoteCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; + return 'VideocallState(deviceId: $deviceId, localUserId: $localUserId, remoteUserId: $remoteUserId, screenMode: $screenMode, isSdkReady: $isSdkReady, isMicEnabled: $isMicEnabled, isSpeakerEnabled: $isSpeakerEnabled, isFrontCamera: $isFrontCamera, isRemoteVideoAvailable: $isRemoteVideoAvailable, currentCall: $currentCall, localCanvas: $localCanvas, remoteCanvas: $remoteCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; } } /// @nodoc -abstract mixin class $VideocallViewStateCopyWith<$Res> { - factory $VideocallViewStateCopyWith(VideocallViewState value, $Res Function(VideocallViewState) _then) = _$VideocallViewStateCopyWithImpl; +abstract mixin class $VideocallStateCopyWith<$Res> { + factory $VideocallStateCopyWith(VideocallState value, $Res Function(VideocallState) _then) = _$VideocallStateCopyWithImpl; @useResult $Res call({ String deviceId, String localUserId, String remoteUserId, VideocallScreenMode screenMode, bool isSdkReady, bool isMicEnabled, bool isSpeakerEnabled, bool isFrontCamera, bool isRemoteVideoAvailable, VideocallItem? currentCall, JCMediaDeviceVideoCanvas? localCanvas, JCMediaDeviceVideoCanvas? remoteCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent @@ -53,14 +53,14 @@ $Res call({ } /// @nodoc -class _$VideocallViewStateCopyWithImpl<$Res> - implements $VideocallViewStateCopyWith<$Res> { - _$VideocallViewStateCopyWithImpl(this._self, this._then); +class _$VideocallStateCopyWithImpl<$Res> + implements $VideocallStateCopyWith<$Res> { + _$VideocallStateCopyWithImpl(this._self, this._then); - final VideocallViewState _self; - final $Res Function(VideocallViewState) _then; + final VideocallState _self; + final $Res Function(VideocallState) _then; -/// Create a copy of VideocallViewState +/// Create a copy of VideocallState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? deviceId = null,Object? localUserId = null,Object? remoteUserId = null,Object? screenMode = null,Object? isSdkReady = null,Object? isMicEnabled = null,Object? isSpeakerEnabled = null,Object? isFrontCamera = null,Object? isRemoteVideoAvailable = null,Object? currentCall = freezed,Object? localCanvas = freezed,Object? remoteCanvas = freezed,Object? errorEvent = freezed,Object? successEvent = freezed,}) { return _then(_self.copyWith( @@ -85,8 +85,8 @@ as VideocallSuccessEvent?, } -/// Adds pattern-matching-related methods to [VideocallViewState]. -extension VideocallViewStatePatterns on VideocallViewState { +/// Adds pattern-matching-related methods to [VideocallState]. +extension VideocallStatePatterns on VideocallState { /// A variant of `map` that fallback to returning `orElse`. /// /// It is equivalent to doing: @@ -99,10 +99,10 @@ extension VideocallViewStatePatterns on VideocallViewState { /// } /// ``` -@optionalTypeArgs TResult maybeMap(TResult Function( _VideocallViewState value)? $default,{required TResult orElse(),}){ +@optionalTypeArgs TResult maybeMap(TResult Function( _VideocallState value)? $default,{required TResult orElse(),}){ final _that = this; switch (_that) { -case _VideocallViewState() when $default != null: +case _VideocallState() when $default != null: return $default(_that);case _: return orElse(); @@ -121,10 +121,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult map(TResult Function( _VideocallViewState value) $default,){ +@optionalTypeArgs TResult map(TResult Function( _VideocallState value) $default,){ final _that = this; switch (_that) { -case _VideocallViewState(): +case _VideocallState(): return $default(_that);case _: throw StateError('Unexpected subclass'); @@ -142,10 +142,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult? mapOrNull(TResult? Function( _VideocallViewState value)? $default,){ +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _VideocallState value)? $default,){ final _that = this; switch (_that) { -case _VideocallViewState() when $default != null: +case _VideocallState() when $default != null: return $default(_that);case _: return null; @@ -165,7 +165,7 @@ return $default(_that);case _: @optionalTypeArgs TResult maybeWhen(TResult Function( String deviceId, String localUserId, String remoteUserId, VideocallScreenMode screenMode, bool isSdkReady, bool isMicEnabled, bool isSpeakerEnabled, bool isFrontCamera, bool isRemoteVideoAvailable, VideocallItem? currentCall, JCMediaDeviceVideoCanvas? localCanvas, JCMediaDeviceVideoCanvas? remoteCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { -case _VideocallViewState() when $default != null: +case _VideocallState() when $default != null: return $default(_that.deviceId,_that.localUserId,_that.remoteUserId,_that.screenMode,_that.isSdkReady,_that.isMicEnabled,_that.isSpeakerEnabled,_that.isFrontCamera,_that.isRemoteVideoAvailable,_that.currentCall,_that.localCanvas,_that.remoteCanvas,_that.errorEvent,_that.successEvent);case _: return orElse(); @@ -186,7 +186,7 @@ return $default(_that.deviceId,_that.localUserId,_that.remoteUserId,_that.screen @optionalTypeArgs TResult when(TResult Function( String deviceId, String localUserId, String remoteUserId, VideocallScreenMode screenMode, bool isSdkReady, bool isMicEnabled, bool isSpeakerEnabled, bool isFrontCamera, bool isRemoteVideoAvailable, VideocallItem? currentCall, JCMediaDeviceVideoCanvas? localCanvas, JCMediaDeviceVideoCanvas? remoteCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent) $default,) {final _that = this; switch (_that) { -case _VideocallViewState(): +case _VideocallState(): return $default(_that.deviceId,_that.localUserId,_that.remoteUserId,_that.screenMode,_that.isSdkReady,_that.isMicEnabled,_that.isSpeakerEnabled,_that.isFrontCamera,_that.isRemoteVideoAvailable,_that.currentCall,_that.localCanvas,_that.remoteCanvas,_that.errorEvent,_that.successEvent);case _: throw StateError('Unexpected subclass'); @@ -206,7 +206,7 @@ return $default(_that.deviceId,_that.localUserId,_that.remoteUserId,_that.screen @optionalTypeArgs TResult? whenOrNull(TResult? Function( String deviceId, String localUserId, String remoteUserId, VideocallScreenMode screenMode, bool isSdkReady, bool isMicEnabled, bool isSpeakerEnabled, bool isFrontCamera, bool isRemoteVideoAvailable, VideocallItem? currentCall, JCMediaDeviceVideoCanvas? localCanvas, JCMediaDeviceVideoCanvas? remoteCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent)? $default,) {final _that = this; switch (_that) { -case _VideocallViewState() when $default != null: +case _VideocallState() when $default != null: return $default(_that.deviceId,_that.localUserId,_that.remoteUserId,_that.screenMode,_that.isSdkReady,_that.isMicEnabled,_that.isSpeakerEnabled,_that.isFrontCamera,_that.isRemoteVideoAvailable,_that.currentCall,_that.localCanvas,_that.remoteCanvas,_that.errorEvent,_that.successEvent);case _: return null; @@ -218,8 +218,8 @@ return $default(_that.deviceId,_that.localUserId,_that.remoteUserId,_that.screen /// @nodoc -class _VideocallViewState implements VideocallViewState { - const _VideocallViewState({this.deviceId = '', this.localUserId = '', this.remoteUserId = '', this.screenMode = VideocallScreenMode.idle, this.isSdkReady = false, this.isMicEnabled = true, this.isSpeakerEnabled = true, this.isFrontCamera = true, this.isRemoteVideoAvailable = false, this.currentCall, this.localCanvas, this.remoteCanvas, this.errorEvent, this.successEvent}); +class _VideocallState implements VideocallState { + const _VideocallState({this.deviceId = '', this.localUserId = '', this.remoteUserId = '', this.screenMode = VideocallScreenMode.idle, this.isSdkReady = false, this.isMicEnabled = true, this.isSpeakerEnabled = true, this.isFrontCamera = true, this.isRemoteVideoAvailable = false, this.currentCall, this.localCanvas, this.remoteCanvas, this.errorEvent, this.successEvent}); @override@JsonKey() final String deviceId; @@ -237,17 +237,17 @@ class _VideocallViewState implements VideocallViewState { @override final VideocallErrorEvent? errorEvent; @override final VideocallSuccessEvent? successEvent; -/// Create a copy of VideocallViewState +/// Create a copy of VideocallState /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -_$VideocallViewStateCopyWith<_VideocallViewState> get copyWith => __$VideocallViewStateCopyWithImpl<_VideocallViewState>(this, _$identity); +_$VideocallStateCopyWith<_VideocallState> get copyWith => __$VideocallStateCopyWithImpl<_VideocallState>(this, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _VideocallViewState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.localUserId, localUserId) || other.localUserId == localUserId)&&(identical(other.remoteUserId, remoteUserId) || other.remoteUserId == remoteUserId)&&(identical(other.screenMode, screenMode) || other.screenMode == screenMode)&&(identical(other.isSdkReady, isSdkReady) || other.isSdkReady == isSdkReady)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isSpeakerEnabled, isSpeakerEnabled) || other.isSpeakerEnabled == isSpeakerEnabled)&&(identical(other.isFrontCamera, isFrontCamera) || other.isFrontCamera == isFrontCamera)&&(identical(other.isRemoteVideoAvailable, isRemoteVideoAvailable) || other.isRemoteVideoAvailable == isRemoteVideoAvailable)&&(identical(other.currentCall, currentCall) || other.currentCall == currentCall)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.remoteCanvas, remoteCanvas) || other.remoteCanvas == remoteCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _VideocallState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.localUserId, localUserId) || other.localUserId == localUserId)&&(identical(other.remoteUserId, remoteUserId) || other.remoteUserId == remoteUserId)&&(identical(other.screenMode, screenMode) || other.screenMode == screenMode)&&(identical(other.isSdkReady, isSdkReady) || other.isSdkReady == isSdkReady)&&(identical(other.isMicEnabled, isMicEnabled) || other.isMicEnabled == isMicEnabled)&&(identical(other.isSpeakerEnabled, isSpeakerEnabled) || other.isSpeakerEnabled == isSpeakerEnabled)&&(identical(other.isFrontCamera, isFrontCamera) || other.isFrontCamera == isFrontCamera)&&(identical(other.isRemoteVideoAvailable, isRemoteVideoAvailable) || other.isRemoteVideoAvailable == isRemoteVideoAvailable)&&(identical(other.currentCall, currentCall) || other.currentCall == currentCall)&&(identical(other.localCanvas, localCanvas) || other.localCanvas == localCanvas)&&(identical(other.remoteCanvas, remoteCanvas) || other.remoteCanvas == remoteCanvas)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successEvent, successEvent) || other.successEvent == successEvent)); } @@ -256,15 +256,15 @@ int get hashCode => Object.hash(runtimeType,deviceId,localUserId,remoteUserId,sc @override String toString() { - return 'VideocallViewState(deviceId: $deviceId, localUserId: $localUserId, remoteUserId: $remoteUserId, screenMode: $screenMode, isSdkReady: $isSdkReady, isMicEnabled: $isMicEnabled, isSpeakerEnabled: $isSpeakerEnabled, isFrontCamera: $isFrontCamera, isRemoteVideoAvailable: $isRemoteVideoAvailable, currentCall: $currentCall, localCanvas: $localCanvas, remoteCanvas: $remoteCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; + return 'VideocallState(deviceId: $deviceId, localUserId: $localUserId, remoteUserId: $remoteUserId, screenMode: $screenMode, isSdkReady: $isSdkReady, isMicEnabled: $isMicEnabled, isSpeakerEnabled: $isSpeakerEnabled, isFrontCamera: $isFrontCamera, isRemoteVideoAvailable: $isRemoteVideoAvailable, currentCall: $currentCall, localCanvas: $localCanvas, remoteCanvas: $remoteCanvas, errorEvent: $errorEvent, successEvent: $successEvent)'; } } /// @nodoc -abstract mixin class _$VideocallViewStateCopyWith<$Res> implements $VideocallViewStateCopyWith<$Res> { - factory _$VideocallViewStateCopyWith(_VideocallViewState value, $Res Function(_VideocallViewState) _then) = __$VideocallViewStateCopyWithImpl; +abstract mixin class _$VideocallStateCopyWith<$Res> implements $VideocallStateCopyWith<$Res> { + factory _$VideocallStateCopyWith(_VideocallState value, $Res Function(_VideocallState) _then) = __$VideocallStateCopyWithImpl; @override @useResult $Res call({ String deviceId, String localUserId, String remoteUserId, VideocallScreenMode screenMode, bool isSdkReady, bool isMicEnabled, bool isSpeakerEnabled, bool isFrontCamera, bool isRemoteVideoAvailable, VideocallItem? currentCall, JCMediaDeviceVideoCanvas? localCanvas, JCMediaDeviceVideoCanvas? remoteCanvas, VideocallErrorEvent? errorEvent, VideocallSuccessEvent? successEvent @@ -275,17 +275,17 @@ $Res call({ } /// @nodoc -class __$VideocallViewStateCopyWithImpl<$Res> - implements _$VideocallViewStateCopyWith<$Res> { - __$VideocallViewStateCopyWithImpl(this._self, this._then); +class __$VideocallStateCopyWithImpl<$Res> + implements _$VideocallStateCopyWith<$Res> { + __$VideocallStateCopyWithImpl(this._self, this._then); - final _VideocallViewState _self; - final $Res Function(_VideocallViewState) _then; + final _VideocallState _self; + final $Res Function(_VideocallState) _then; -/// Create a copy of VideocallViewState +/// Create a copy of VideocallState /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $Res call({Object? deviceId = null,Object? localUserId = null,Object? remoteUserId = null,Object? screenMode = null,Object? isSdkReady = null,Object? isMicEnabled = null,Object? isSpeakerEnabled = null,Object? isFrontCamera = null,Object? isRemoteVideoAvailable = null,Object? currentCall = freezed,Object? localCanvas = freezed,Object? remoteCanvas = freezed,Object? errorEvent = freezed,Object? successEvent = freezed,}) { - return _then(_VideocallViewState( + return _then(_VideocallState( deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable as String,localUserId: null == localUserId ? _self.localUserId : localUserId // ignore: cast_nullable_to_non_nullable as String,remoteUserId: null == remoteUserId ? _self.remoteUserId : remoteUserId // ignore: cast_nullable_to_non_nullable diff --git a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/videocall_screen.dart b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/videocall_screen.dart index 7b3fb48c..a3e1c68d 100644 --- a/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/videocall_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/videocall/presentation/videocall_screen.dart @@ -7,8 +7,8 @@ import 'package:sf_localizations/sf_localizations.dart'; import 'package:sf_shared/sf_shared.dart'; import '../domain/entities/videocall_error.dart'; -import 'state/videocall_view_model.dart'; -import 'state/videocall_view_state.dart'; +import 'providers/videocall_controller.dart'; +import 'providers/videocall_state.dart'; import 'widgets/call_controls_widget.dart'; import 'widgets/call_status_indicator.dart'; import 'widgets/incoming_call_overlay.dart'; @@ -34,11 +34,11 @@ class _VideocallScreenState extends ConsumerState { @override Widget build(BuildContext context) { - final state = ref.watch(videocallViewModelProvider); - final vm = ref.read(videocallViewModelProvider.notifier); + final state = ref.watch(videocallControllerProvider); + final vm = ref.read(videocallControllerProvider.notifier); ref.listen( - videocallViewModelProvider.select((s) => s.errorEvent), + videocallControllerProvider.select((s) => s.errorEvent), (_, next) { if (next == null) return; final key = switch (next) { @@ -58,7 +58,7 @@ class _VideocallScreenState extends ConsumerState { ); ref.listen( - videocallViewModelProvider.select((s) => s.successEvent), + videocallControllerProvider.select((s) => s.successEvent), (_, next) { if (next == null) return; if (next == VideocallSuccessEvent.callEnded) { @@ -93,9 +93,9 @@ class _IdleView extends StatelessWidget { required this.vm, }); - final VideocallViewState state; + final VideocallState state; final TextEditingController controller; - final VideocallViewModel vm; + final VideocallController vm; @override Widget build(BuildContext context) { @@ -197,8 +197,8 @@ class _IdleView extends StatelessWidget { class _OutgoingView extends StatelessWidget { const _OutgoingView({required this.state, required this.vm}); - final VideocallViewState state; - final VideocallViewModel vm; + final VideocallState state; + final VideocallController vm; @override Widget build(BuildContext context) { @@ -215,8 +215,8 @@ class _OutgoingView extends StatelessWidget { class _IncomingView extends StatelessWidget { const _IncomingView({required this.state, required this.vm}); - final VideocallViewState state; - final VideocallViewModel vm; + final VideocallState state; + final VideocallController vm; @override Widget build(BuildContext context) { @@ -232,8 +232,8 @@ class _IncomingView extends StatelessWidget { class _InCallView extends StatelessWidget { const _InCallView({required this.state, required this.vm}); - final VideocallViewState state; - final VideocallViewModel vm; + final VideocallState state; + final VideocallController vm; @override Widget build(BuildContext context) { diff --git a/packages/sf_shared/lib/src/data/models/device_capabilities_model.dart b/packages/sf_shared/lib/src/data/models/device_capabilities_model.dart index acd1b78b..6d44e4aa 100644 --- a/packages/sf_shared/lib/src/data/models/device_capabilities_model.dart +++ b/packages/sf_shared/lib/src/data/models/device_capabilities_model.dart @@ -26,6 +26,7 @@ abstract class DeviceCapabilitiesModel with _$DeviceCapabilitiesModel { DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume, + String? system, }) = _DeviceCapabilitiesModel; factory DeviceCapabilitiesModel.fromJson(Map json) => @@ -284,5 +285,6 @@ extension DeviceCapabilitiesModelMapper on DeviceCapabilitiesModel { alarm: volume!.alarm, ) : null, + system: system, ); } diff --git a/packages/sf_shared/lib/src/data/models/device_capabilities_model.freezed.dart b/packages/sf_shared/lib/src/data/models/device_capabilities_model.freezed.dart index b3dc8e36..94101b51 100644 --- a/packages/sf_shared/lib/src/data/models/device_capabilities_model.freezed.dart +++ b/packages/sf_shared/lib/src/data/models/device_capabilities_model.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$DeviceCapabilitiesModel { - DeviceCapabilityOptionModel? get heartbeats; DeviceCapabilityEnabledModel? get bloodPressure; DeviceCapabilityAlertsModel? get alerts; DeviceCapabilityEnabledModel? get podometer; DeviceCapabilityContactsModel? get contacts; DeviceCapabilitySettingsModel? get settings; DeviceCapabilityCommandsModel? get commands; DeviceCapabilityTakepillsModel? get takepills; DeviceCapabilityOptionModel? get location; DeviceCapabilityCameraModel? get camera; DeviceCapabilityDoNotDisturbModel? get doNotDisturbs; DeviceCapabilityAlarmsModel? get alarms; DeviceCapabilityAppUsageModel? get appUsageSchedules; DeviceCapabilityEnabledModel? get keyboard; DeviceCapabilityEnabledModel? get nightMode; DeviceCapabilityEnabledModel? get wifi; DeviceCapabilityEnabledModel? get deviceBackground; DeviceCapabilityVolumeModel? get volume; + DeviceCapabilityOptionModel? get heartbeats; DeviceCapabilityEnabledModel? get bloodPressure; DeviceCapabilityAlertsModel? get alerts; DeviceCapabilityEnabledModel? get podometer; DeviceCapabilityContactsModel? get contacts; DeviceCapabilitySettingsModel? get settings; DeviceCapabilityCommandsModel? get commands; DeviceCapabilityTakepillsModel? get takepills; DeviceCapabilityOptionModel? get location; DeviceCapabilityCameraModel? get camera; DeviceCapabilityDoNotDisturbModel? get doNotDisturbs; DeviceCapabilityAlarmsModel? get alarms; DeviceCapabilityAppUsageModel? get appUsageSchedules; DeviceCapabilityEnabledModel? get keyboard; DeviceCapabilityEnabledModel? get nightMode; DeviceCapabilityEnabledModel? get wifi; DeviceCapabilityEnabledModel? get deviceBackground; DeviceCapabilityVolumeModel? get volume; String? get system; /// Create a copy of DeviceCapabilitiesModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $DeviceCapabilitiesModelCopyWith get copyWith => _$Devi @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesModel&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesModel&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.system, system) || other.system == system)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume); +int get hashCode => Object.hashAll([runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume,system]); @override String toString() { - return 'DeviceCapabilitiesModel(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume)'; + return 'DeviceCapabilitiesModel(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume, system: $system)'; } @@ -48,7 +48,7 @@ abstract mixin class $DeviceCapabilitiesModelCopyWith<$Res> { factory $DeviceCapabilitiesModelCopyWith(DeviceCapabilitiesModel value, $Res Function(DeviceCapabilitiesModel) _then) = _$DeviceCapabilitiesModelCopyWithImpl; @useResult $Res call({ - DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume + DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume, String? system }); @@ -65,7 +65,7 @@ class _$DeviceCapabilitiesModelCopyWithImpl<$Res> /// Create a copy of DeviceCapabilitiesModel /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,Object? system = freezed,}) { return _then(_self.copyWith( heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable as DeviceCapabilityOptionModel?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable @@ -85,7 +85,8 @@ as DeviceCapabilityEnabledModel?,nightMode: freezed == nightMode ? _self.nightMo as DeviceCapabilityEnabledModel?,wifi: freezed == wifi ? _self.wifi : wifi // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledModel?,deviceBackground: freezed == deviceBackground ? _self.deviceBackground : deviceBackground // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledModel?,volume: freezed == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable -as DeviceCapabilityVolumeModel?, +as DeviceCapabilityVolumeModel?,system: freezed == system ? _self.system : system // ignore: cast_nullable_to_non_nullable +as String?, )); } /// Create a copy of DeviceCapabilitiesModel @@ -386,10 +387,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume, String? system)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _DeviceCapabilitiesModel() when $default != null: -return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume);case _: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume,_that.system);case _: return orElse(); } @@ -407,10 +408,10 @@ return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podomete /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume, String? system) $default,) {final _that = this; switch (_that) { case _DeviceCapabilitiesModel(): -return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume);case _: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume,_that.system);case _: throw StateError('Unexpected subclass'); } @@ -427,10 +428,10 @@ return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podomete /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume, String? system)? $default,) {final _that = this; switch (_that) { case _DeviceCapabilitiesModel() when $default != null: -return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume);case _: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume,_that.system);case _: return null; } @@ -442,7 +443,7 @@ return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podomete @JsonSerializable() class _DeviceCapabilitiesModel implements DeviceCapabilitiesModel { - const _DeviceCapabilitiesModel({this.heartbeats, this.bloodPressure, this.alerts, this.podometer, this.contacts, this.settings, this.commands, this.takepills, this.location, this.camera, this.doNotDisturbs, this.alarms, this.appUsageSchedules, this.keyboard, this.nightMode, this.wifi, this.deviceBackground, this.volume}); + const _DeviceCapabilitiesModel({this.heartbeats, this.bloodPressure, this.alerts, this.podometer, this.contacts, this.settings, this.commands, this.takepills, this.location, this.camera, this.doNotDisturbs, this.alarms, this.appUsageSchedules, this.keyboard, this.nightMode, this.wifi, this.deviceBackground, this.volume, this.system}); factory _DeviceCapabilitiesModel.fromJson(Map json) => _$DeviceCapabilitiesModelFromJson(json); @override final DeviceCapabilityOptionModel? heartbeats; @@ -463,6 +464,7 @@ class _DeviceCapabilitiesModel implements DeviceCapabilitiesModel { @override final DeviceCapabilityEnabledModel? wifi; @override final DeviceCapabilityEnabledModel? deviceBackground; @override final DeviceCapabilityVolumeModel? volume; +@override final String? system; /// Create a copy of DeviceCapabilitiesModel /// with the given fields replaced by the non-null parameter values. @@ -477,16 +479,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesModel&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesModel&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.system, system) || other.system == system)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume); +int get hashCode => Object.hashAll([runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume,system]); @override String toString() { - return 'DeviceCapabilitiesModel(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume)'; + return 'DeviceCapabilitiesModel(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume, system: $system)'; } @@ -497,7 +499,7 @@ abstract mixin class _$DeviceCapabilitiesModelCopyWith<$Res> implements $DeviceC factory _$DeviceCapabilitiesModelCopyWith(_DeviceCapabilitiesModel value, $Res Function(_DeviceCapabilitiesModel) _then) = __$DeviceCapabilitiesModelCopyWithImpl; @override @useResult $Res call({ - DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume + DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera, DeviceCapabilityDoNotDisturbModel? doNotDisturbs, DeviceCapabilityAlarmsModel? alarms, DeviceCapabilityAppUsageModel? appUsageSchedules, DeviceCapabilityEnabledModel? keyboard, DeviceCapabilityEnabledModel? nightMode, DeviceCapabilityEnabledModel? wifi, DeviceCapabilityEnabledModel? deviceBackground, DeviceCapabilityVolumeModel? volume, String? system }); @@ -514,7 +516,7 @@ class __$DeviceCapabilitiesModelCopyWithImpl<$Res> /// Create a copy of DeviceCapabilitiesModel /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,Object? system = freezed,}) { return _then(_DeviceCapabilitiesModel( heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable as DeviceCapabilityOptionModel?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable @@ -534,7 +536,8 @@ as DeviceCapabilityEnabledModel?,nightMode: freezed == nightMode ? _self.nightMo as DeviceCapabilityEnabledModel?,wifi: freezed == wifi ? _self.wifi : wifi // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledModel?,deviceBackground: freezed == deviceBackground ? _self.deviceBackground : deviceBackground // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledModel?,volume: freezed == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable -as DeviceCapabilityVolumeModel?, +as DeviceCapabilityVolumeModel?,system: freezed == system ? _self.system : system // ignore: cast_nullable_to_non_nullable +as String?, )); } diff --git a/packages/sf_shared/lib/src/data/models/device_capabilities_model.g.dart b/packages/sf_shared/lib/src/data/models/device_capabilities_model.g.dart index 6a4eb353..2d5d59fb 100644 --- a/packages/sf_shared/lib/src/data/models/device_capabilities_model.g.dart +++ b/packages/sf_shared/lib/src/data/models/device_capabilities_model.g.dart @@ -99,6 +99,7 @@ _DeviceCapabilitiesModel _$DeviceCapabilitiesModelFromJson( : DeviceCapabilityVolumeModel.fromJson( json['volume'] as Map, ), + system: json['system'] as String?, ); Map _$DeviceCapabilitiesModelToJson( @@ -122,6 +123,7 @@ Map _$DeviceCapabilitiesModelToJson( 'wifi': instance.wifi, 'deviceBackground': instance.deviceBackground, 'volume': instance.volume, + 'system': instance.system, }; _DeviceCapabilityEnabledModel _$DeviceCapabilityEnabledModelFromJson( diff --git a/packages/sf_shared/lib/src/data/models/get_devices_response_model.dart b/packages/sf_shared/lib/src/data/models/get_devices_response_model.dart index 03b0f7d1..a4dff04a 100644 --- a/packages/sf_shared/lib/src/data/models/get_devices_response_model.dart +++ b/packages/sf_shared/lib/src/data/models/get_devices_response_model.dart @@ -42,6 +42,7 @@ abstract class GetDevicesItemResponseModel with _$GetDevicesItemResponseModel { required String connectionServer, required String protocol, required String type, + String? imei, Map? capabilities, String? backgroundImageId, required int createdAt, @@ -80,6 +81,7 @@ extension GetDevicesResponseModelMapper on GetDevicesResponseModel { connectionServer: item.connectionServer, protocol: item.protocol, type: item.type, + imei: item.imei, queueCommands: item.queueCommands, capabilities: item.capabilities != null ? DeviceCapabilitiesModel.fromJson( diff --git a/packages/sf_shared/lib/src/data/models/get_devices_response_model.freezed.dart b/packages/sf_shared/lib/src/data/models/get_devices_response_model.freezed.dart index 18bae0fb..ee520d40 100644 --- a/packages/sf_shared/lib/src/data/models/get_devices_response_model.freezed.dart +++ b/packages/sf_shared/lib/src/data/models/get_devices_response_model.freezed.dart @@ -284,7 +284,7 @@ as List, /// @nodoc mixin _$GetDevicesItemResponseModel { - String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; int? get lastConnection; String? get carrierGenre; int? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String get carrierName; String? get comment; String? get phone; String? get simId; String? get simStatus; Map? get paymentOptions; bool get queueCommands; Map get settings; String get connectionServer; String get protocol; String get type; Map? get capabilities; String? get backgroundImageId; int get createdAt; int? get updatedAt; + String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; int? get lastConnection; String? get carrierGenre; int? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String get carrierName; String? get comment; String? get phone; String? get simId; String? get simStatus; Map? get paymentOptions; bool get queueCommands; Map get settings; String get connectionServer; String get protocol; String get type; String? get imei; Map? get capabilities; String? get backgroundImageId; int get createdAt; int? get updatedAt; /// Create a copy of GetDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -297,16 +297,16 @@ $GetDevicesItemResponseModelCopyWith get copyWith = @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other.flags, flags)&&const DeepCollectionEquality().equals(other.tags, tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&(identical(other.simStatus, simStatus) || other.simStatus == simStatus)&&const DeepCollectionEquality().equals(other.paymentOptions, paymentOptions)&&(identical(other.queueCommands, queueCommands) || other.queueCommands == queueCommands)&&const DeepCollectionEquality().equals(other.settings, settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other.capabilities, capabilities)&&(identical(other.backgroundImageId, backgroundImageId) || other.backgroundImageId == backgroundImageId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other.flags, flags)&&const DeepCollectionEquality().equals(other.tags, tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&(identical(other.simStatus, simStatus) || other.simStatus == simStatus)&&const DeepCollectionEquality().equals(other.paymentOptions, paymentOptions)&&(identical(other.queueCommands, queueCommands) || other.queueCommands == queueCommands)&&const DeepCollectionEquality().equals(other.settings, settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.imei, imei) || other.imei == imei)&&const DeepCollectionEquality().equals(other.capabilities, capabilities)&&(identical(other.backgroundImageId, backgroundImageId) || other.backgroundImageId == backgroundImageId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,simStatus,const DeepCollectionEquality().hash(paymentOptions),queueCommands,const DeepCollectionEquality().hash(settings),connectionServer,protocol,type,const DeepCollectionEquality().hash(capabilities),backgroundImageId,createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,simStatus,const DeepCollectionEquality().hash(paymentOptions),queueCommands,const DeepCollectionEquality().hash(settings),connectionServer,protocol,type,imei,const DeepCollectionEquality().hash(capabilities),backgroundImageId,createdAt,updatedAt]); @override String toString() { - return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, simStatus: $simStatus, paymentOptions: $paymentOptions, queueCommands: $queueCommands, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; + return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, simStatus: $simStatus, paymentOptions: $paymentOptions, queueCommands: $queueCommands, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, imei: $imei, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; } @@ -317,7 +317,7 @@ abstract mixin class $GetDevicesItemResponseModelCopyWith<$Res> { factory $GetDevicesItemResponseModelCopyWith(GetDevicesItemResponseModel value, $Res Function(GetDevicesItemResponseModel) _then) = _$GetDevicesItemResponseModelCopyWithImpl; @useResult $Res call({ - String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, String? imei, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt }); @@ -334,7 +334,7 @@ class _$GetDevicesItemResponseModelCopyWithImpl<$Res> /// Create a copy of GetDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = null,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? simStatus = freezed,Object? paymentOptions = freezed,Object? queueCommands = null,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = null,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? simStatus = freezed,Object? paymentOptions = freezed,Object? queueCommands = null,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? imei = freezed,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable @@ -361,7 +361,8 @@ as bool,settings: null == settings ? _self.settings : settings // ignore: cast_n as Map,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable +as String,imei: freezed == imei ? _self.imei : imei // ignore: cast_nullable_to_non_nullable +as String?,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable as Map?,backgroundImageId: freezed == backgroundImageId ? _self.backgroundImageId : backgroundImageId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable @@ -450,10 +451,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, String? imei, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _GetDevicesItemResponseModel() when $default != null: -return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.queueCommands,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.queueCommands,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.imei,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: return orElse(); } @@ -471,10 +472,10 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, String? imei, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt) $default,) {final _that = this; switch (_that) { case _GetDevicesItemResponseModel(): -return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.queueCommands,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.queueCommands,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.imei,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: throw StateError('Unexpected subclass'); } @@ -491,10 +492,10 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, String? imei, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt)? $default,) {final _that = this; switch (_that) { case _GetDevicesItemResponseModel() when $default != null: -return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.queueCommands,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.queueCommands,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.imei,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: return null; } @@ -506,7 +507,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co @JsonSerializable() class _GetDevicesItemResponseModel implements GetDevicesItemResponseModel { - const _GetDevicesItemResponseModel({required this.id, required this.identificator, this.battery, this.userId, this.companyId, this.delegationId, this.groupId, required final Map flags, final List? tags, this.lastConnection, this.carrierGenre, this.carrierBirthday, this.carrierWeight, this.carrierStepLength, required this.carrierName, this.comment, this.phone, this.simId, this.simStatus, final Map? paymentOptions, this.queueCommands = false, required final Map settings, required this.connectionServer, required this.protocol, required this.type, final Map? capabilities, this.backgroundImageId, required this.createdAt, this.updatedAt}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions,_settings = settings,_capabilities = capabilities; + const _GetDevicesItemResponseModel({required this.id, required this.identificator, this.battery, this.userId, this.companyId, this.delegationId, this.groupId, required final Map flags, final List? tags, this.lastConnection, this.carrierGenre, this.carrierBirthday, this.carrierWeight, this.carrierStepLength, required this.carrierName, this.comment, this.phone, this.simId, this.simStatus, final Map? paymentOptions, this.queueCommands = false, required final Map settings, required this.connectionServer, required this.protocol, required this.type, this.imei, final Map? capabilities, this.backgroundImageId, required this.createdAt, this.updatedAt}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions,_settings = settings,_capabilities = capabilities; factory _GetDevicesItemResponseModel.fromJson(Map json) => _$GetDevicesItemResponseModelFromJson(json); @override final String id; @@ -562,6 +563,7 @@ class _GetDevicesItemResponseModel implements GetDevicesItemResponseModel { @override final String connectionServer; @override final String protocol; @override final String type; +@override final String? imei; final Map? _capabilities; @override Map? get capabilities { final value = _capabilities; @@ -588,16 +590,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&(identical(other.simStatus, simStatus) || other.simStatus == simStatus)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&(identical(other.queueCommands, queueCommands) || other.queueCommands == queueCommands)&&const DeepCollectionEquality().equals(other._settings, _settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._capabilities, _capabilities)&&(identical(other.backgroundImageId, backgroundImageId) || other.backgroundImageId == backgroundImageId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&(identical(other.simStatus, simStatus) || other.simStatus == simStatus)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&(identical(other.queueCommands, queueCommands) || other.queueCommands == queueCommands)&&const DeepCollectionEquality().equals(other._settings, _settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.imei, imei) || other.imei == imei)&&const DeepCollectionEquality().equals(other._capabilities, _capabilities)&&(identical(other.backgroundImageId, backgroundImageId) || other.backgroundImageId == backgroundImageId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,simStatus,const DeepCollectionEquality().hash(_paymentOptions),queueCommands,const DeepCollectionEquality().hash(_settings),connectionServer,protocol,type,const DeepCollectionEquality().hash(_capabilities),backgroundImageId,createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,simStatus,const DeepCollectionEquality().hash(_paymentOptions),queueCommands,const DeepCollectionEquality().hash(_settings),connectionServer,protocol,type,imei,const DeepCollectionEquality().hash(_capabilities),backgroundImageId,createdAt,updatedAt]); @override String toString() { - return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, simStatus: $simStatus, paymentOptions: $paymentOptions, queueCommands: $queueCommands, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; + return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, simStatus: $simStatus, paymentOptions: $paymentOptions, queueCommands: $queueCommands, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, imei: $imei, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; } @@ -608,7 +610,7 @@ abstract mixin class _$GetDevicesItemResponseModelCopyWith<$Res> implements $Get factory _$GetDevicesItemResponseModelCopyWith(_GetDevicesItemResponseModel value, $Res Function(_GetDevicesItemResponseModel) _then) = __$GetDevicesItemResponseModelCopyWithImpl; @override @useResult $Res call({ - String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, Map? paymentOptions, bool queueCommands, Map settings, String connectionServer, String protocol, String type, String? imei, Map? capabilities, String? backgroundImageId, int createdAt, int? updatedAt }); @@ -625,7 +627,7 @@ class __$GetDevicesItemResponseModelCopyWithImpl<$Res> /// Create a copy of GetDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = null,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? simStatus = freezed,Object? paymentOptions = freezed,Object? queueCommands = null,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = null,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? simStatus = freezed,Object? paymentOptions = freezed,Object? queueCommands = null,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? imei = freezed,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { return _then(_GetDevicesItemResponseModel( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable @@ -652,7 +654,8 @@ as bool,settings: null == settings ? _self._settings : settings // ignore: cast_ as Map,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,capabilities: freezed == capabilities ? _self._capabilities : capabilities // ignore: cast_nullable_to_non_nullable +as String,imei: freezed == imei ? _self.imei : imei // ignore: cast_nullable_to_non_nullable +as String?,capabilities: freezed == capabilities ? _self._capabilities : capabilities // ignore: cast_nullable_to_non_nullable as Map?,backgroundImageId: freezed == backgroundImageId ? _self.backgroundImageId : backgroundImageId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable diff --git a/packages/sf_shared/lib/src/data/models/get_devices_response_model.g.dart b/packages/sf_shared/lib/src/data/models/get_devices_response_model.g.dart index b6baffed..5c695d47 100644 --- a/packages/sf_shared/lib/src/data/models/get_devices_response_model.g.dart +++ b/packages/sf_shared/lib/src/data/models/get_devices_response_model.g.dart @@ -48,6 +48,7 @@ _GetDevicesItemResponseModel _$GetDevicesItemResponseModelFromJson( connectionServer: json['connectionServer'] as String, protocol: json['protocol'] as String, type: json['type'] as String, + imei: json['imei'] as String?, capabilities: json['capabilities'] as Map?, backgroundImageId: json['backgroundImageId'] as String?, createdAt: (json['createdAt'] as num).toInt(), @@ -82,6 +83,7 @@ Map _$GetDevicesItemResponseModelToJson( 'connectionServer': instance.connectionServer, 'protocol': instance.protocol, 'type': instance.type, + 'imei': instance.imei, 'capabilities': instance.capabilities, 'backgroundImageId': instance.backgroundImageId, 'createdAt': instance.createdAt, diff --git a/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.dart b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.dart index a5bc7d05..b6c3cac7 100644 --- a/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.dart +++ b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.dart @@ -23,6 +23,7 @@ abstract class DeviceCapabilitiesEntity with _$DeviceCapabilitiesEntity { DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume, + String? system, }) = _DeviceCapabilitiesEntity; } @@ -71,6 +72,11 @@ abstract class DeviceCapabilityContactTypeEntity }) = _DeviceCapabilityContactTypeEntity; } +extension DeviceCapabilitiesSystemX on DeviceCapabilitiesEntity { + bool get isRtos => system == 'rtos'; + bool get isAndroid => system == 'android'; +} + extension DeviceCapabilityContactsX on DeviceCapabilityContactsEntity { int maxForType(String type, {int fallback = 10}) => types.where((t) => t.type == type).firstOrNull?.amount ?? fallback; diff --git a/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.freezed.dart b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.freezed.dart index e9a5c067..5b32f04c 100644 --- a/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.freezed.dart +++ b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$DeviceCapabilitiesEntity { - DeviceCapabilityOptionEntity? get heartbeats; DeviceCapabilityEnabledEntity? get bloodPressure; DeviceCapabilityAlertsEntity? get alerts; DeviceCapabilityEnabledEntity? get podometer; DeviceCapabilityContactsEntity? get contacts; DeviceCapabilitySettingsEntity? get settings; DeviceCapabilityCommandsEntity? get commands; DeviceCapabilityTakepillsEntity? get takepills; DeviceCapabilityOptionEntity? get location; DeviceCapabilityCameraEntity? get camera; DeviceCapabilityDoNotDisturbEntity? get doNotDisturbs; DeviceCapabilityAlarmsEntity? get alarms; DeviceCapabilityAppUsageEntity? get appUsageSchedules; DeviceCapabilityEnabledEntity? get keyboard; DeviceCapabilityEnabledEntity? get nightMode; DeviceCapabilityEnabledEntity? get wifi; DeviceCapabilityEnabledEntity? get deviceBackground; DeviceCapabilityVolumeEntity? get volume; + DeviceCapabilityOptionEntity? get heartbeats; DeviceCapabilityEnabledEntity? get bloodPressure; DeviceCapabilityAlertsEntity? get alerts; DeviceCapabilityEnabledEntity? get podometer; DeviceCapabilityContactsEntity? get contacts; DeviceCapabilitySettingsEntity? get settings; DeviceCapabilityCommandsEntity? get commands; DeviceCapabilityTakepillsEntity? get takepills; DeviceCapabilityOptionEntity? get location; DeviceCapabilityCameraEntity? get camera; DeviceCapabilityDoNotDisturbEntity? get doNotDisturbs; DeviceCapabilityAlarmsEntity? get alarms; DeviceCapabilityAppUsageEntity? get appUsageSchedules; DeviceCapabilityEnabledEntity? get keyboard; DeviceCapabilityEnabledEntity? get nightMode; DeviceCapabilityEnabledEntity? get wifi; DeviceCapabilityEnabledEntity? get deviceBackground; DeviceCapabilityVolumeEntity? get volume; String? get system; /// Create a copy of DeviceCapabilitiesEntity /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $DeviceCapabilitiesEntityCopyWith get copyWith => _$De @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.system, system) || other.system == system)); } @override -int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume); +int get hashCode => Object.hashAll([runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume,system]); @override String toString() { - return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume)'; + return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume, system: $system)'; } @@ -45,7 +45,7 @@ abstract mixin class $DeviceCapabilitiesEntityCopyWith<$Res> { factory $DeviceCapabilitiesEntityCopyWith(DeviceCapabilitiesEntity value, $Res Function(DeviceCapabilitiesEntity) _then) = _$DeviceCapabilitiesEntityCopyWithImpl; @useResult $Res call({ - DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume + DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume, String? system }); @@ -62,7 +62,7 @@ class _$DeviceCapabilitiesEntityCopyWithImpl<$Res> /// Create a copy of DeviceCapabilitiesEntity /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,Object? system = freezed,}) { return _then(_self.copyWith( heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable as DeviceCapabilityOptionEntity?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable @@ -82,7 +82,8 @@ as DeviceCapabilityEnabledEntity?,nightMode: freezed == nightMode ? _self.nightM as DeviceCapabilityEnabledEntity?,wifi: freezed == wifi ? _self.wifi : wifi // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledEntity?,deviceBackground: freezed == deviceBackground ? _self.deviceBackground : deviceBackground // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledEntity?,volume: freezed == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable -as DeviceCapabilityVolumeEntity?, +as DeviceCapabilityVolumeEntity?,system: freezed == system ? _self.system : system // ignore: cast_nullable_to_non_nullable +as String?, )); } /// Create a copy of DeviceCapabilitiesEntity @@ -383,10 +384,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume, String? system)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _DeviceCapabilitiesEntity() when $default != null: -return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume);case _: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume,_that.system);case _: return orElse(); } @@ -404,10 +405,10 @@ return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podomete /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume, String? system) $default,) {final _that = this; switch (_that) { case _DeviceCapabilitiesEntity(): -return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume);case _: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume,_that.system);case _: throw StateError('Unexpected subclass'); } @@ -424,10 +425,10 @@ return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podomete /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume, String? system)? $default,) {final _that = this; switch (_that) { case _DeviceCapabilitiesEntity() when $default != null: -return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume);case _: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera,_that.doNotDisturbs,_that.alarms,_that.appUsageSchedules,_that.keyboard,_that.nightMode,_that.wifi,_that.deviceBackground,_that.volume,_that.system);case _: return null; } @@ -439,7 +440,7 @@ return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podomete class _DeviceCapabilitiesEntity implements DeviceCapabilitiesEntity { - const _DeviceCapabilitiesEntity({this.heartbeats, this.bloodPressure, this.alerts, this.podometer, this.contacts, this.settings, this.commands, this.takepills, this.location, this.camera, this.doNotDisturbs, this.alarms, this.appUsageSchedules, this.keyboard, this.nightMode, this.wifi, this.deviceBackground, this.volume}); + const _DeviceCapabilitiesEntity({this.heartbeats, this.bloodPressure, this.alerts, this.podometer, this.contacts, this.settings, this.commands, this.takepills, this.location, this.camera, this.doNotDisturbs, this.alarms, this.appUsageSchedules, this.keyboard, this.nightMode, this.wifi, this.deviceBackground, this.volume, this.system}); @override final DeviceCapabilityOptionEntity? heartbeats; @@ -460,6 +461,7 @@ class _DeviceCapabilitiesEntity implements DeviceCapabilitiesEntity { @override final DeviceCapabilityEnabledEntity? wifi; @override final DeviceCapabilityEnabledEntity? deviceBackground; @override final DeviceCapabilityVolumeEntity? volume; +@override final String? system; /// Create a copy of DeviceCapabilitiesEntity /// with the given fields replaced by the non-null parameter values. @@ -471,16 +473,16 @@ _$DeviceCapabilitiesEntityCopyWith<_DeviceCapabilitiesEntity> get copyWith => __ @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)&&(identical(other.doNotDisturbs, doNotDisturbs) || other.doNotDisturbs == doNotDisturbs)&&(identical(other.alarms, alarms) || other.alarms == alarms)&&(identical(other.appUsageSchedules, appUsageSchedules) || other.appUsageSchedules == appUsageSchedules)&&(identical(other.keyboard, keyboard) || other.keyboard == keyboard)&&(identical(other.nightMode, nightMode) || other.nightMode == nightMode)&&(identical(other.wifi, wifi) || other.wifi == wifi)&&(identical(other.deviceBackground, deviceBackground) || other.deviceBackground == deviceBackground)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.system, system) || other.system == system)); } @override -int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume); +int get hashCode => Object.hashAll([runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera,doNotDisturbs,alarms,appUsageSchedules,keyboard,nightMode,wifi,deviceBackground,volume,system]); @override String toString() { - return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume)'; + return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera, doNotDisturbs: $doNotDisturbs, alarms: $alarms, appUsageSchedules: $appUsageSchedules, keyboard: $keyboard, nightMode: $nightMode, wifi: $wifi, deviceBackground: $deviceBackground, volume: $volume, system: $system)'; } @@ -491,7 +493,7 @@ abstract mixin class _$DeviceCapabilitiesEntityCopyWith<$Res> implements $Device factory _$DeviceCapabilitiesEntityCopyWith(_DeviceCapabilitiesEntity value, $Res Function(_DeviceCapabilitiesEntity) _then) = __$DeviceCapabilitiesEntityCopyWithImpl; @override @useResult $Res call({ - DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume + DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera, DeviceCapabilityDoNotDisturbEntity? doNotDisturbs, DeviceCapabilityAlarmsEntity? alarms, DeviceCapabilityAppUsageEntity? appUsageSchedules, DeviceCapabilityEnabledEntity? keyboard, DeviceCapabilityEnabledEntity? nightMode, DeviceCapabilityEnabledEntity? wifi, DeviceCapabilityEnabledEntity? deviceBackground, DeviceCapabilityVolumeEntity? volume, String? system }); @@ -508,7 +510,7 @@ class __$DeviceCapabilitiesEntityCopyWithImpl<$Res> /// Create a copy of DeviceCapabilitiesEntity /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,Object? doNotDisturbs = freezed,Object? alarms = freezed,Object? appUsageSchedules = freezed,Object? keyboard = freezed,Object? nightMode = freezed,Object? wifi = freezed,Object? deviceBackground = freezed,Object? volume = freezed,Object? system = freezed,}) { return _then(_DeviceCapabilitiesEntity( heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable as DeviceCapabilityOptionEntity?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable @@ -528,7 +530,8 @@ as DeviceCapabilityEnabledEntity?,nightMode: freezed == nightMode ? _self.nightM as DeviceCapabilityEnabledEntity?,wifi: freezed == wifi ? _self.wifi : wifi // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledEntity?,deviceBackground: freezed == deviceBackground ? _self.deviceBackground : deviceBackground // ignore: cast_nullable_to_non_nullable as DeviceCapabilityEnabledEntity?,volume: freezed == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable -as DeviceCapabilityVolumeEntity?, +as DeviceCapabilityVolumeEntity?,system: freezed == system ? _self.system : system // ignore: cast_nullable_to_non_nullable +as String?, )); } diff --git a/packages/sf_shared/lib/src/domain/entities/device_entity.dart b/packages/sf_shared/lib/src/domain/entities/device_entity.dart index 7312977f..361512dd 100644 --- a/packages/sf_shared/lib/src/domain/entities/device_entity.dart +++ b/packages/sf_shared/lib/src/domain/entities/device_entity.dart @@ -31,6 +31,7 @@ abstract class DeviceEntity with _$DeviceEntity { @Default('') String connectionServer, @Default('') String protocol, @Default('') String type, + String? imei, @Default(false) bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, diff --git a/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart b/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart index 90339d68..48dac654 100644 --- a/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart +++ b/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$DeviceEntity { - String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; String? get lastConnection; String? get carrierGenre; String? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String? get carrierName; String? get comment; String? get phone; String? get simId; Map? get paymentOptions; DeviceSettingsEntity get settings; String get connectionServer; String get protocol; String get type; bool get queueCommands; DeviceCapabilitiesEntity? get capabilities; String? get backgroundImageId; String get createdAt; String? get updatedAt; + String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; String? get lastConnection; String? get carrierGenre; String? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String? get carrierName; String? get comment; String? get phone; String? get simId; Map? get paymentOptions; DeviceSettingsEntity get settings; String get connectionServer; String get protocol; String get type; String? get imei; bool get queueCommands; DeviceCapabilitiesEntity? get capabilities; String? get backgroundImageId; String get createdAt; String? get updatedAt; /// Create a copy of DeviceEntity /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $DeviceEntityCopyWith get copyWith => _$DeviceEntityCopyWithImpl Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(paymentOptions),settings,connectionServer,protocol,type,queueCommands,capabilities,backgroundImageId,createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(paymentOptions),settings,connectionServer,protocol,type,imei,queueCommands,capabilities,backgroundImageId,createdAt,updatedAt]); @override String toString() { - return 'DeviceEntity(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, paymentOptions: $paymentOptions, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, queueCommands: $queueCommands, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; + return 'DeviceEntity(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, paymentOptions: $paymentOptions, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, imei: $imei, queueCommands: $queueCommands, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; } @@ -45,7 +45,7 @@ abstract mixin class $DeviceEntityCopyWith<$Res> { factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl; @useResult $Res call({ - String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, String? imei, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt }); @@ -62,7 +62,7 @@ class _$DeviceEntityCopyWithImpl<$Res> /// Create a copy of DeviceEntity /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = freezed,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? paymentOptions = freezed,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? queueCommands = null,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = freezed,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? paymentOptions = freezed,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? imei = freezed,Object? queueCommands = null,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable @@ -87,7 +87,8 @@ as Map?,settings: null == settings ? _self.settings : settings as DeviceSettingsEntity,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,queueCommands: null == queueCommands ? _self.queueCommands : queueCommands // ignore: cast_nullable_to_non_nullable +as String,imei: freezed == imei ? _self.imei : imei // ignore: cast_nullable_to_non_nullable +as String?,queueCommands: null == queueCommands ? _self.queueCommands : queueCommands // ignore: cast_nullable_to_non_nullable as bool,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable as DeviceCapabilitiesEntity?,backgroundImageId: freezed == backgroundImageId ? _self.backgroundImageId : backgroundImageId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable @@ -198,10 +199,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, String? imei, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _DeviceEntity() when $default != null: -return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.queueCommands,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.imei,_that.queueCommands,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: return orElse(); } @@ -219,10 +220,10 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, String? imei, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt) $default,) {final _that = this; switch (_that) { case _DeviceEntity(): -return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.queueCommands,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.imei,_that.queueCommands,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: throw StateError('Unexpected subclass'); } @@ -239,10 +240,10 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, String? imei, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt)? $default,) {final _that = this; switch (_that) { case _DeviceEntity() when $default != null: -return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.queueCommands,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.imei,_that.queueCommands,_that.capabilities,_that.backgroundImageId,_that.createdAt,_that.updatedAt);case _: return null; } @@ -254,7 +255,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co class _DeviceEntity implements DeviceEntity { - const _DeviceEntity({required this.id, required this.identificator, this.battery, this.userId, this.companyId, this.delegationId, this.groupId, final Map flags = const {}, final List? tags, this.lastConnection, this.carrierGenre, this.carrierBirthday, this.carrierWeight, this.carrierStepLength, this.carrierName, this.comment, this.phone, this.simId, final Map? paymentOptions, this.settings = const DeviceSettingsEntity(), this.connectionServer = '', this.protocol = '', this.type = '', this.queueCommands = false, this.capabilities, this.backgroundImageId, this.createdAt = '', this.updatedAt}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions; + const _DeviceEntity({required this.id, required this.identificator, this.battery, this.userId, this.companyId, this.delegationId, this.groupId, final Map flags = const {}, final List? tags, this.lastConnection, this.carrierGenre, this.carrierBirthday, this.carrierWeight, this.carrierStepLength, this.carrierName, this.comment, this.phone, this.simId, final Map? paymentOptions, this.settings = const DeviceSettingsEntity(), this.connectionServer = '', this.protocol = '', this.type = '', this.imei, this.queueCommands = false, this.capabilities, this.backgroundImageId, this.createdAt = '', this.updatedAt}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions; @override final String id; @@ -302,6 +303,7 @@ class _DeviceEntity implements DeviceEntity { @override@JsonKey() final String connectionServer; @override@JsonKey() final String protocol; @override@JsonKey() final String type; +@override final String? imei; @override@JsonKey() final bool queueCommands; @override final DeviceCapabilitiesEntity? capabilities; @override final String? backgroundImageId; @@ -318,16 +320,16 @@ _$DeviceEntityCopyWith<_DeviceEntity> get copyWith => __$DeviceEntityCopyWithImp @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.queueCommands, queueCommands) || other.queueCommands == queueCommands)&&(identical(other.capabilities, capabilities) || other.capabilities == capabilities)&&(identical(other.backgroundImageId, backgroundImageId) || other.backgroundImageId == backgroundImageId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.imei, imei) || other.imei == imei)&&(identical(other.queueCommands, queueCommands) || other.queueCommands == queueCommands)&&(identical(other.capabilities, capabilities) || other.capabilities == capabilities)&&(identical(other.backgroundImageId, backgroundImageId) || other.backgroundImageId == backgroundImageId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); } @override -int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(_paymentOptions),settings,connectionServer,protocol,type,queueCommands,capabilities,backgroundImageId,createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(_paymentOptions),settings,connectionServer,protocol,type,imei,queueCommands,capabilities,backgroundImageId,createdAt,updatedAt]); @override String toString() { - return 'DeviceEntity(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, paymentOptions: $paymentOptions, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, queueCommands: $queueCommands, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; + return 'DeviceEntity(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, paymentOptions: $paymentOptions, settings: $settings, connectionServer: $connectionServer, protocol: $protocol, type: $type, imei: $imei, queueCommands: $queueCommands, capabilities: $capabilities, backgroundImageId: $backgroundImageId, createdAt: $createdAt, updatedAt: $updatedAt)'; } @@ -338,7 +340,7 @@ abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWi factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl; @override @useResult $Res call({ - String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, String? imei, bool queueCommands, DeviceCapabilitiesEntity? capabilities, String? backgroundImageId, String createdAt, String? updatedAt }); @@ -355,7 +357,7 @@ class __$DeviceEntityCopyWithImpl<$Res> /// Create a copy of DeviceEntity /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = freezed,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? paymentOptions = freezed,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? queueCommands = null,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? identificator = null,Object? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = freezed,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? paymentOptions = freezed,Object? settings = null,Object? connectionServer = null,Object? protocol = null,Object? type = null,Object? imei = freezed,Object? queueCommands = null,Object? capabilities = freezed,Object? backgroundImageId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { return _then(_DeviceEntity( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable @@ -380,7 +382,8 @@ as Map?,settings: null == settings ? _self.settings : settings as DeviceSettingsEntity,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,queueCommands: null == queueCommands ? _self.queueCommands : queueCommands // ignore: cast_nullable_to_non_nullable +as String,imei: freezed == imei ? _self.imei : imei // ignore: cast_nullable_to_non_nullable +as String?,queueCommands: null == queueCommands ? _self.queueCommands : queueCommands // ignore: cast_nullable_to_non_nullable as bool,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable as DeviceCapabilitiesEntity?,backgroundImageId: freezed == backgroundImageId ? _self.backgroundImageId : backgroundImageId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable diff --git a/packages/videocall_sdk/lib/src/models/videocall_item.dart b/packages/videocall_sdk/lib/src/models/videocall_item.dart index 9705719b..c2eac430 100644 --- a/packages/videocall_sdk/lib/src/models/videocall_item.dart +++ b/packages/videocall_sdk/lib/src/models/videocall_item.dart @@ -7,24 +7,34 @@ class VideocallItem { required this.isVideo, required this.direction, required this.state, + this.uploadVideoStreamSelf = false, + this.uploadVideoStreamOther = false, }); final String userId; final bool isVideo; final CallDirection direction; final VideocallState state; + final bool uploadVideoStreamSelf; + final bool uploadVideoStreamOther; VideocallItem copyWith({ String? userId, bool? isVideo, CallDirection? direction, VideocallState? state, + bool? uploadVideoStreamSelf, + bool? uploadVideoStreamOther, }) { return VideocallItem( userId: userId ?? this.userId, isVideo: isVideo ?? this.isVideo, direction: direction ?? this.direction, state: state ?? this.state, + uploadVideoStreamSelf: + uploadVideoStreamSelf ?? this.uploadVideoStreamSelf, + uploadVideoStreamOther: + uploadVideoStreamOther ?? this.uploadVideoStreamOther, ); } } diff --git a/packages/videocall_sdk/lib/src/services/videocall_call_service.dart b/packages/videocall_sdk/lib/src/services/videocall_call_service.dart index 3f23967d..d4030cc9 100644 --- a/packages/videocall_sdk/lib/src/services/videocall_call_service.dart +++ b/packages/videocall_sdk/lib/src/services/videocall_call_service.dart @@ -265,6 +265,8 @@ class VideocallCallService with JCCallCallback { ? CallDirection.incoming : CallDirection.outgoing, state: state, + uploadVideoStreamSelf: item.uploadVideoStreamSelf, + uploadVideoStreamOther: item.uploadVideoStreamOther, ); }