You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Amazon] StopConnect for UDC in Android tv-casting-app
Updated native layer and iOS tv-casting-app to use native layer
ConnectionState instead of a pendingPasscode customer check.
Changes
* Expose native layer ConnectionState to iOS tv-casting-app
* Update iOS tv-casting-app to use ConnectionState to determine if we
should call stopConnect()
* Only call stopConnect() on navigate back from ConnectionExampleView
* Updated doc to indicate when a object method will free itself as a
side effect
Test
1. Manually verified UDC attempt is successful both Android iOS for following
1. Attempt UDC attempt (both commissionee & commissioner generated passcode)
2. Navigate back to discovery page
3. Start new UDC attempt (both commissionee & commissioner generated passcode)
2. Manually verified UDC attempt is successful both Android iOS for following. UDC will finish in the background.
1. Attempt UDC attempt (both commissionee & commissioner generated passcode)
2. Confirm passcode on TV app or casting app depending on who
generated passcode
3. Navigate back before commission fnishes.
3. Manual regression test following
* UDC attempt happy path (no navigate back) for both commissinee &
commissioner generated passcode
// Only stop connection if we are still connecting to the device
51
+
if err ==nil && connectionState == MC_CASTING_PLAYER_CONNECTING {
49
52
self.Log.info("MCConnectionExampleViewModel cancelConnect(). User navigating back from ConnectionView")
53
+
// NOTE, once stopConnecting() is called, the targetCastingPlayer's native object is freed
50
54
leterr= selectedCastingPlayer?.stopConnecting()
51
55
if err ==nil{
52
56
self.connectionStatus ="User cancelled the connection attempt with CastingPlayer.stopConnecting()."
@@ -125,17 +129,9 @@ class MCConnectionExampleViewModel: ObservableObject {
125
129
dataSource.update(newCommissionableData)
126
130
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, Updated MCAppParametersDataSource instance with new MCCommissionableData.")
self.connectionStatus ="Failed to update the MCAppParametersDataSource with the user entered passcode: \n\nRoute back to disconnect and try again."
130
134
self.connectionSuccess =false
131
-
// Since we failed to update the passcode, Attempt to cancel the connection attempt with
132
-
// the CastingPlayer/Commissioner.
133
-
leterr= selectedCastingPlayer?.stopConnecting()
134
-
if err ==nil{
135
-
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, InitializationExample.getAppParametersDataSource() failed, then stopConnecting() succeeded")
136
-
}else{
137
-
self.Log.error("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, InitializationExample.getAppParametersDataSource() failed, then stopConnecting() failed due to: \(err)")
138
-
}
139
135
return
140
136
}
141
137
@@ -144,28 +140,13 @@ class MCConnectionExampleViewModel: ObservableObject {
144
140
if errContinue ==nil{
145
141
self.connectionStatus ="Continuing to connect with user entered passcode: \(userEnteredPasscode)"
146
142
}else{
147
-
self.connectionStatus ="Continue Connecting to Casting Player failed with: \(String(describing: errContinue))\n\nRoute back and try again."
143
+
self.connectionStatus ="Continue Connecting to Casting Player failed with: \(String(describing: errContinue))\n\nRoute back to disconnect and try again."
148
144
self.Log.error("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, MCCastingPlayer.continueConnecting() failed due to: \(errContinue)")
149
-
// Since continueConnecting() failed, Attempt to cancel the connection attempt with
150
-
// the CastingPlayer/Commissioner.
151
-
leterr= selectedCastingPlayer?.stopConnecting()
152
-
if err ==nil{
153
-
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, MCCastingPlayer.continueConnecting() failed, then stopConnecting() succeeded")
154
-
}else{
155
-
self.Log.error("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, MCCastingPlayer.continueConnecting() failed, then stopConnecting() failed due to: \(err)")
156
-
}
157
145
}
158
146
}, cancelConnecting:{
159
-
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, Connection attempt cancelled by the user, calling MCCastingPlayer.stopConnecting()")
160
-
leterr= selectedCastingPlayer?.stopConnecting()
147
+
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, Connection attempt cancelled by the user")
161
148
self.connectionSuccess =false
162
-
if err ==nil{
163
-
self.connectionStatus ="User cancelled the connection attempt with CastingPlayer. \n\nRoute back to exit."
164
-
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, User cancelled the connection attempt with MCCastingPlayer, MCCastingPlayer.stopConnecting() succeeded.")
165
-
}else{
166
-
self.connectionStatus ="Cancel connection failed due to: \(String(describing: err))\n\nRoute back to exit."
167
-
self.Log.error("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, MCCastingPlayer.stopConnecting() failed due to: \(err)")
168
-
}
149
+
self.connectionStatus ="User cancelled the connection attempt with CastingPlayer. \n\nRoute back to disconnect & exit."
0 commit comments