Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
livekitAndroidXuningTest
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
davidliu
2022-03-23 01:34:37 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
830bcb41428e72b46e56bb77487f3b67ce45eeda
830bcb41
1 parent
7229d58d
Show FlowObservable annotation in docs
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
26 行增加
和
3 行删除
livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Participant.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/track/TrackPublication.kt
livekit-android-sdk/src/main/java/io/livekit/android/util/FlowDelegate.kt
livekit-lint/src/test/java/io/livekit/lint/FlowDelegateUsageDetectorTest.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt
查看文件 @
830bcb4
...
...
@@ -65,17 +65,21 @@ constructor(
@Deprecated("Use events instead.")
var listener: RoomListener? = null
@FlowObservable
@get:FlowObservable
var sid: Sid? by flowDelegate(null)
@FlowObservable
@get:FlowObservable
var name: String? by flowDelegate(null)
private set
@FlowObservable
@get:FlowObservable
var state: State by flowDelegate(State.DISCONNECTED)
private set
@FlowObservable
@get:FlowObservable
var metadata: String? by flowDelegate(null)
private set
...
...
@@ -129,12 +133,14 @@ constructor(
private var mutableRemoteParticipants by flowDelegate(emptyMap<String, RemoteParticipant>())
@FlowObservable
@get:FlowObservable
val remoteParticipants: Map<String, RemoteParticipant>
get() = mutableRemoteParticipants
private var mutableActiveSpeakers by flowDelegate(emptyList<Participant>())
@FlowObservable
@get:FlowObservable
val activeSpeakers: List<Participant>
get() = mutableActiveSpeakers
...
...
livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Participant.kt
查看文件 @
830bcb4
...
...
@@ -34,6 +34,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
var participantInfo: LivekitModels.ParticipantInfo? by flowDelegate(null)
private set
...
...
@@ -41,6 +42,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
var identity: String? by flowDelegate(identity)
internal set
...
...
@@ -48,6 +50,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
var audioLevel: Float by flowDelegate(0f)
internal set
...
...
@@ -55,6 +58,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
var isSpeaking: Boolean by flowDelegate(false) { newValue, oldValue ->
if (newValue != oldValue) {
...
...
@@ -64,13 +68,15 @@ open class Participant(
}
}
internal set
@FlowObservable
@get:FlowObservable
var name by flowDelegate<String?>(null)
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
var metadata: String? by flowDelegate(null) { newMetadata, oldMetadata ->
if (newMetadata != oldMetadata) {
...
...
@@ -84,6 +90,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
var connectionQuality by flowDelegate(ConnectionQuality.UNKNOWN)
internal set
...
...
@@ -106,6 +113,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
var tracks by flowDelegate(emptyMap<String, TrackPublication>())
protected set
...
...
@@ -113,6 +121,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
val audioTracks by flowDelegate(
stateFlow = ::tracks.flow
...
...
@@ -123,6 +132,7 @@ open class Participant(
/**
* Changes can be observed by using [io.livekit.android.util.flow]
*/
@FlowObservable
@get:FlowObservable
val videoTracks by flowDelegate(
stateFlow = ::tracks.flow
...
...
livekit-android-sdk/src/main/java/io/livekit/android/room/track/TrackPublication.kt
查看文件 @
830bcb4
...
...
@@ -12,6 +12,7 @@ open class TrackPublication(
participant: Participant
) {
@FlowObservable
@get:FlowObservable
open var track: Track? by flowDelegate(track)
internal set
...
...
@@ -22,6 +23,7 @@ open class TrackPublication(
var kind: Track.Kind
private set
@FlowObservable
@get:FlowObservable
open var muted: Boolean by flowDelegate(false)
internal set
...
...
livekit-android-sdk/src/main/java/io/livekit/android/util/FlowDelegate.kt
查看文件 @
830bcb4
...
...
@@ -65,7 +65,7 @@ val <T> KProperty0<T>.flow: StateFlow<T>
/**
* Indicates that the target property changes can be observed with [flow].
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.PROPERTY_GETTER)
@Target(AnnotationTarget.CLASS, AnnotationTarget.PROPERTY
, AnnotationTarget.PROPERTY
_GETTER)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
annotation class FlowObservable
...
...
livekit-lint/src/test/java/io/livekit/lint/FlowDelegateUsageDetectorTest.kt
查看文件 @
830bcb4
...
...
@@ -22,6 +22,7 @@ class FlowDelegateUsageDetectorTest {
import io.livekit.android.util.flow
import io.livekit.android.util.flowDelegate
class Example {
@FlowObservable
@get:FlowObservable
val value: Int by flowDelegate(0)
fun foo() {
...
...
@@ -50,6 +51,7 @@ class FlowDelegateUsageDetectorTest {
import io.livekit.android.util.flow
import io.livekit.android.util.flowDelegate
class Example {
@FlowObservable
@get:FlowObservable
val value: Int by flowDelegate(0)
fun foo() {
...
...
@@ -78,6 +80,7 @@ class FlowDelegateUsageDetectorTest {
import io.livekit.android.util.flow
import io.livekit.android.util.flowDelegate
class FlowContainer {
@FlowObservable
@get:FlowObservable
val value: Int by flowDelegate(0)
}
...
...
@@ -109,6 +112,7 @@ class FlowDelegateUsageDetectorTest {
import io.livekit.android.util.flow
import io.livekit.android.util.flowDelegate
class FlowContainer {
@FlowObservable
@get:FlowObservable
val value: Int by flowDelegate(0)
}
...
...
@@ -141,6 +145,7 @@ class FlowDelegateUsageDetectorTest {
import io.livekit.android.util.flowDelegate
class FlowContainer {
var value: Int by flowDelegate(0)
@FlowObservable
@get:FlowObservable
val otherValue: Int
get() = value
...
...
@@ -205,7 +210,7 @@ fun flowAccess(): TestFile {
val <T> KProperty0<T>.flow: StateFlow<T>
get() = delegate as StateFlow<T>
@Target(AnnotationTarget.PROPERTY_GETTER)
@Target(AnnotationTarget.PROPERTY
, AnnotationTarget.PROPERTY
_GETTER)
@Retention(AnnotationRetention.SOURCE)
@MustBeDocumented
annotation class FlowObservable
...
...
请
注册
或
登录
后发表评论