member id instead of whole object in state.

This commit is contained in:
Miroslav Šedivý 2020-12-01 23:59:02 +01:00
parent 4c247f61ff
commit a268bddc57
2 changed files with 8 additions and 23 deletions

View File

@ -6,7 +6,7 @@
:webrtc="webrtc" :webrtc="webrtc"
:screenWidth="state.screen.size.width" :screenWidth="state.screen.size.width"
:screenHeight="state.screen.size.height" :screenHeight="state.screen.size.height"
:isControling="state.member.is_controlling" :isControling="controlling"
:scrollSensitivity="state.control.scroll.sensitivity" :scrollSensitivity="state.control.scroll.sensitivity"
:scrollInvert="state.control.scroll.inverse" :scrollInvert="state.control.scroll.inverse"
/> />
@ -94,7 +94,7 @@
sensitivity: 1, sensitivity: 1,
}, },
clipboard: null, clipboard: null,
host: null, host_id: null,
}, },
screen: { screen: {
size: { size: {
@ -104,16 +104,7 @@
}, },
configurations: [], configurations: [],
}, },
member: { member_id: null,
id: null,
name: null,
is_admin: false,
is_watching: false,
is_controlling: false,
can_watch: false,
can_control: false,
clipboard_access: false,
},
members: {}, members: {},
} as NekoState } as NekoState
@ -122,7 +113,7 @@
} }
public get controlling() { public get controlling() {
return this.state.member.is_controlling return this.state.control.host_id !== null && this.state.member_id === this.state.control.host_id
} }
///////////////////////////// /////////////////////////////
@ -325,12 +316,6 @@
this.websocket.disconnect() this.websocket.disconnect()
} }
@Watch('state.video.playing')
onVideoPlayingChanged(play: boolean) {
// TODO: check if user has tab focused and send via websocket
Vue.set(this.state.member, 'is_watching', play)
}
@Watch('state.screen.size') @Watch('state.screen.size')
onResize() { onResize() {
const { width, height } = this.state.screen.size const { width, height } = this.state.screen.size

View File

@ -3,7 +3,7 @@ export default interface State {
video: Video video: Video
control: Control control: Control
screen: Screen screen: Screen
member: Member member_id: string | null
members: Record<string, Member> members: Record<string, Member>
} }
@ -36,7 +36,7 @@ export interface Video {
export interface Control { export interface Control {
scroll: Scroll scroll: Scroll
clipboard: Clipboard | null clipboard: Clipboard | null
host: Member | null host_id: string | null
} }
export interface Scroll { export interface Scroll {
@ -66,8 +66,8 @@ export interface ScreenSize {
// Member // Member
///////////////////////////// /////////////////////////////
export interface Member { export interface Member {
id: string | null id: string
name: string | null name: string
is_admin: boolean is_admin: boolean
is_watching: boolean is_watching: boolean
is_controlling: boolean is_controlling: boolean