extract member state to custom struct.

This commit is contained in:
Miroslav Šedivý
2020-12-03 16:10:52 +01:00
parent 5f3b9f72cf
commit d7b5bd6842
9 changed files with 64 additions and 77 deletions

View File

@ -13,13 +13,12 @@ const (
)
const (
MEMBER_CREATED = "member/created"
MEMBER_DELETED = "member/deleted"
MEMBER_CONNECTED = "member/connected"
MEMBER_DISCONNECTED = "member/disconnected"
MEMBER_RECEIVING_STARTED = "member/receiving/started"
MEMBER_RECEIVING_STOPPED = "member/receiving/stopped"
MEMBER_PROFILE_UPDATED = "member/profile/updated"
MEMBER_CREATED = "member/created"
MEMBER_DELETED = "member/deleted"
MEMBER_CONNECTED = "member/connected"
MEMBER_DISCONNECTED = "member/disconnected"
MEMBER_PROFILE = "member/profile"
MEMBER_STATE = "member/state"
)
const (

View File

@ -66,12 +66,18 @@ type MemberProfile struct {
CanAccessClipboard bool `json:"can_access_clipboard"`
}
type MemberState struct {
Event string `json:"event,omitempty"`
ID string `json:"id,omitempty"`
IsConnected bool `json:"is_connected"`
IsReceiving bool `json:"is_receiving"`
}
type MemberData struct {
Event string `json:"event,omitempty"`
ID string `json:"id"`
Profile MemberProfile `json:"profile"`
IsConnected bool `json:"is_connected"`
IsReceiving bool `json:"is_receiving"`
State MemberState `json:"state"`
}
/////////////////////////////

View File

@ -62,9 +62,8 @@ type SessionManager interface {
OnDeleted(listener func(session Session))
OnConnected(listener func(session Session))
OnDisconnected(listener func(session Session))
OnReceivingStarted(listener func(session Session))
OnReceivingStopped(listener func(session Session))
OnProfileUpdated(listener func(session Session))
OnProfileChanged(listener func(session Session))
OnStateChanged(listener func(session Session))
ImplicitHosting() bool