Skip to content

Commit 3067774

Browse files
committed
Added offAll method interface method to remove all listeners
1 parent 99c7363 commit 3067774

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

chat-android/src/main/java/com/ably/chat/Room.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package com.ably.chat
44

55
import io.ably.lib.types.AblyException
66
import io.ably.lib.types.ErrorInfo
7-
import io.ably.lib.util.Log
87
import io.ably.lib.util.Log.LogHandler
98

109
/**

chat-android/src/main/java/com/ably/chat/RoomStatus.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ interface IRoomStatus {
3333
*/
3434
fun roomStatusChanged(change: RoomStatusChange)
3535
}
36+
37+
/**
38+
* Removes all listeners that were added by the `onChange` method.
39+
*/
40+
fun offAll();
3641
}
3742

3843
class RoomStatus(override val current: RoomLifecycle, override val error: ErrorInfo?) : IRoomStatus {
@@ -45,6 +50,10 @@ class RoomStatus(override val current: RoomLifecycle, override val error: ErrorI
4550
listeners.remove(listener)
4651
}
4752
}
53+
54+
override fun offAll() {
55+
listeners.clear();
56+
}
4857
}
4958

5059
/**

0 commit comments

Comments
 (0)