@@ -111,35 +111,31 @@ mixin StateLifecycleMixin on StateNotifier<CallState> {
111111 }) {
112112 _logWithState ('lifecycleCallCreated' , 'ringing: $ringing ' );
113113
114- state = state
115- .copyFromMetadata (
116- data.metadata,
117- )
118- .copyWith (
119- status: data.toCallStatus (state: state, ringing: ringing),
120- callParticipants: data.metadata.toCallParticipants (state),
121- isRingingFlow: ringing,
122- audioOutputDevice: callConnectOptions.audioOutputDevice,
123- audioInputDevice: callConnectOptions.audioInputDevice,
124- videoInputDevice: callConnectOptions.videoInputDevice,
125- );
114+ final newState = state.copyFromMetadata (data.metadata);
115+
116+ state = newState.copyWith (
117+ status: data.toCallStatus (state: newState, ringing: ringing),
118+ callParticipants: data.metadata.toCallParticipants (newState),
119+ isRingingFlow: ringing,
120+ audioOutputDevice: callConnectOptions.audioOutputDevice,
121+ audioInputDevice: callConnectOptions.audioInputDevice,
122+ videoInputDevice: callConnectOptions.videoInputDevice,
123+ );
126124 }
127125
128126 void lifecycleCallRinging (
129127 CallRingingData data,
130128 ) {
131129 _logWithState ('lifecycleCallRinging' );
132130
133- state = state
134- .copyFromMetadata (
135- data.metadata,
136- )
137- .copyWith (
138- status: data.toCallStatus (state: state),
139- isRingingFlow: data.ringing,
140- ownCapabilities: data.metadata.details.ownCapabilities.toList (),
141- callParticipants: data.metadata.toCallParticipants (state),
142- );
131+ final newState = state.copyFromMetadata (data.metadata);
132+
133+ state = newState.copyWith (
134+ status: data.toCallStatus (state: newState),
135+ isRingingFlow: data.ringing,
136+ ownCapabilities: data.metadata.details.ownCapabilities.toList (),
137+ callParticipants: data.metadata.toCallParticipants (newState),
138+ );
143139 }
144140
145141 void lifecycleCallJoining () {
@@ -157,18 +153,16 @@ mixin StateLifecycleMixin on StateNotifier<CallState> {
157153 final status = state.status.isJoining ? CallStatus .joined () : state.status;
158154 _logWithState ('lifecycleCallJoined' , 'newStatus: $status ' );
159155
160- state = state
161- .copyFromMetadata (
162- data.metadata,
163- )
164- .copyWith (
165- status: status,
166- ownCapabilities: data.metadata.details.ownCapabilities.toList (),
167- callParticipants: data.metadata.toCallParticipants (state),
168- audioOutputDevice: callConnectOptions? .audioOutputDevice,
169- audioInputDevice: callConnectOptions? .audioInputDevice,
170- videoInputDevice: callConnectOptions? .videoInputDevice,
171- );
156+ final newState = state.copyFromMetadata (data.metadata);
157+
158+ state = newState.copyWith (
159+ status: status,
160+ ownCapabilities: data.metadata.details.ownCapabilities.toList (),
161+ callParticipants: data.metadata.toCallParticipants (newState),
162+ audioOutputDevice: callConnectOptions? .audioOutputDevice,
163+ audioInputDevice: callConnectOptions? .audioInputDevice,
164+ videoInputDevice: callConnectOptions? .videoInputDevice,
165+ );
172166 }
173167
174168 void lifecycleCallReconnectingFailed () {
0 commit comments