File tree Expand file tree Collapse file tree
demo-app/src/main/kotlin/io/getstream/video/android/ui/join
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import kotlinx.coroutines.flow.flatMapLatest
4545import kotlinx.coroutines.flow.flowOf
4646import kotlinx.coroutines.flow.shareIn
4747import kotlinx.coroutines.launch
48+ import java.io.IOException
4849import java.util.UUID
4950import javax.inject.Inject
5051
@@ -142,9 +143,12 @@ class CallJoinViewModel @Inject constructor(
142143 googleSignInClient.signOut()
143144
144145 StreamVideo .instanceOrNull()?.let { streamVideo ->
145- streamVideo.getDevice().firstOrNull()?.let { device ->
146- streamVideo.deleteDevice(device)
146+ val device = try {
147+ streamVideo.getDevice().firstOrNull()
148+ } catch (_: IOException ) {
149+ null
147150 }
151+ device?.let { streamVideo.deleteDevice(it) }
148152 streamVideo.logOut()
149153 }
150154
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import kotlinx.coroutines.Deferred
3535import kotlinx.coroutines.flow.Flow
3636import kotlinx.coroutines.flow.MutableStateFlow
3737import kotlinx.coroutines.flow.StateFlow
38+ import java.io.IOException
3839
3940/* *
4041 * The main interface to control the Video calls. [StreamVideoClient] implements this interface.
@@ -112,7 +113,12 @@ public interface StreamVideo : NotificationHandler {
112113 /* *
113114 * Get a cached device used to receive push notifications.
114115 *
116+ * Collecting the returned [Flow] accesses persistent storage and may throw an [IOException]
117+ * if the stored device cannot be read. Consumers that treat device retrieval as a best-effort
118+ * operation should handle [IOException] explicitly without swallowing coroutine cancellation.
119+ *
115120 * @return stream of Device.
121+ * @throws IOException when the returned flow is collected and persistent storage cannot be read.
116122 */
117123 public fun getDevice (): Flow <Device ?>
118124
You can’t perform that action at this time.
0 commit comments