Skip to content

Commit

Permalink
make Participant.name non-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Dec 23, 2023
1 parent a0b27d0 commit d3f83a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/LiveKit/Participant/Participant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Participant: NSObject, ObservableObject, Loggable {
public var identity: String { _state.identity }

@objc
public var name: String? { _state.name }
public var name: String { _state.name }

@objc
public var audioLevel: Float { _state.audioLevel }
Expand Down Expand Up @@ -75,7 +75,7 @@ public class Participant: NSObject, ObservableObject, Loggable {
struct State: Equatable, Hashable {
var sid: Sid
var identity: String
var name: String?
var name: String
var audioLevel: Float = 0.0
var isSpeaking: Bool = false
var metadata: String?
Expand All @@ -91,7 +91,7 @@ public class Participant: NSObject, ObservableObject, Loggable {
self.room = room

// initial state
_state = StateSync(State(sid: sid, identity: identity))
_state = StateSync(State(sid: sid, identity: identity, name: ""))

super.init()

Expand Down Expand Up @@ -153,7 +153,7 @@ public class Participant: NSObject, ObservableObject, Loggable {
func cleanUp(notify _notify: Bool = true) async {
await unpublishAll(notify: _notify)
// Reset state
_state.mutate { $0 = State(sid: "", identity: "") }
_state.mutate { $0 = State(sid: "", identity: "", name: "") }
}

func unpublishAll(notify _: Bool = true) async {
Expand Down

0 comments on commit d3f83a3

Please sign in to comment.