Skip to content

Commit 9eea8b9

Browse files
committed
fix null error in JS logger when inserting PPT files
1 parent cf011fb commit 9eea8b9

File tree

7 files changed

+79
-54
lines changed

7 files changed

+79
-54
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ dependencies {
265265
api 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.8.0'
266266

267267
// Agora
268-
implementation("com.github.netless-io:whiteboard-android:nl_2.17.0-alpha.14") {
268+
implementation("com.github.netless-io:whiteboard-android:nl_2.17.0-alpha.15") {
269269
force true
270270
}
271271
// for local fastboard debug
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
here are what injected into build
2+
3+
4+
5+
6+
7+
8+
9+

app/src/main/assets/flatboard/whiteboard-bridge.js

Lines changed: 52 additions & 52 deletions
Large diffs are not rendered by default.

app/src/main/java/io/agora/flat/common/board/AgoraBoardRoom.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ class AgoraBoardRoom @Inject constructor(
131131
override fun onFastError(error: FastException) {
132132
if (error.code == FastException.ROOM_KICKED) {
133133
boardError.value = BoardError.Kicked
134+
} else {
135+
// boardError.value = BoardError.Unknown(error.message ?: "Unknown error")
134136
}
135137
}
136138
})
@@ -140,6 +142,10 @@ class AgoraBoardRoom @Inject constructor(
140142
updateRoomController(writable)
141143
}
142144

145+
fastRoom?.setErrorHandler {
146+
logger.e("[BOARD] error ${it.message}")
147+
}
148+
143149
val fastResource = object : FastResource() {
144150
override fun getBackgroundColor(darkMode: Boolean): Int {
145151
return ContextCompat.getColor(

app/src/main/java/io/agora/flat/common/board/BoardEntity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ sealed class BoardPhase {
1010

1111
sealed class BoardError {
1212
object Kicked : BoardError()
13+
data class Unknown(val message: String) : BoardError()
1314
}

app/src/main/java/io/agora/flat/ui/activity/play/ExtComponent.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class ExtComponent(
6666
showLoading(it.loading)
6767
it.error?.run {
6868
handleErrorMessage(it.error)
69+
viewModel.clearError()
6970
}
7071
}
7172
}

app/src/main/java/io/agora/flat/ui/activity/play/ExtensionViewModel.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import javax.inject.Inject
1919
class ExtensionViewModel @Inject constructor(
2020
private val errorManager: RoomErrorManager,
2121
private val boardRoom: AgoraBoardRoom,
22-
private val eventBus: EventBus
22+
private val eventBus: EventBus,
2323
) : ViewModel() {
2424
private val _state = MutableStateFlow(ExtensionState())
2525
val state = _state.asStateFlow()
@@ -51,6 +51,10 @@ class ExtensionViewModel @Inject constructor(
5151
is BoardError.Kicked -> {
5252
eventBus.produceEvent(RoomKickedEvent)
5353
}
54+
55+
is BoardError.Unknown -> {
56+
_state.value = _state.value.copy(error = UiMessage(error.message))
57+
}
5458
}
5559
}
5660
}
@@ -61,6 +65,10 @@ class ExtensionViewModel @Inject constructor(
6165
}
6266
}
6367
}
68+
69+
fun clearError() {
70+
_state.value = _state.value.copy(error = null)
71+
}
6472
}
6573

6674
data class ExtensionState(

0 commit comments

Comments
 (0)