File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
common/views/WatchTogether Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 4
4
import Message from ' ./Message.svelte'
5
5
import { SendHorizontal , DoorOpen , UserPlus } from ' lucide-svelte'
6
6
export let invite
7
+
8
+ /** @type {import('simple-store-svelte').Writable<import('./w2g.js').W2GClient | null>} */
7
9
export let state
8
10
9
11
function cleanup () {
Original file line number Diff line number Diff line change 14
14
</script >
15
15
16
16
<div class ='message d-flex flex-row mt-15' class:flex-row ={incoming } class:flex-row-reverse ={! incoming }>
17
- <img src ={user .avatar ?.medium || ' https://s4.anilist.co/file/anilistcdn/user/avatar/large/default.png' } alt =' ProfilePicture' class =' w-50 h-50 rounded-circle p-5 mt-auto' />
17
+ <img src ={user ? .avatar ?.medium || ' https://s4.anilist.co/file/anilistcdn/user/avatar/large/default.png' } alt =' ProfilePicture' class =' w-50 h-50 rounded-circle p-5 mt-auto' />
18
18
<div class ='d-flex flex-column px-10 align-items-start flex-auto' class:align-items-start ={incoming } class:align-items-end ={! incoming }>
19
19
<div class =' pb-5 d-flex flex-row align-items-center px-5' >
20
20
<div class =' font-weight-bold font-size-18 line-height-normal' >
21
- {user .name || ' Anonymous' }
21
+ {user ? .name || ' Anonymous' }
22
22
</div >
23
23
<div class =' text-muted pl-10 font-size-12 line-height-normal' >
24
24
{time .toLocaleTimeString ()}
Original file line number Diff line number Diff line change 8
8
</script >
9
9
10
10
<div class =' d-flex align-items-center pb-10' >
11
- <img src ={user .avatar ?.medium || ' https://s4.anilist.co/file/anilistcdn/user/avatar/large/default.png' } alt =' ProfilePicture' class =' w-50 h-50 rounded-circle p-5 mt-auto' />
11
+ <img src ={user ? .avatar ?.medium || ' https://s4.anilist.co/file/anilistcdn/user/avatar/large/default.png' } alt =' ProfilePicture' class =' w-50 h-50 rounded-circle p-5 mt-auto' />
12
12
<div class =' font-size-18 line-height-normal pl-5' >
13
- {user .name || ' Anonymous' }
13
+ {user ? .name || ' Anonymous' }
14
14
</div >
15
- {#if user .name }
15
+ {#if user ? .name }
16
16
<span class ='pointer text-primary d-flex align-items-center ml-auto' use:click ={() => IPC .emit (' open' , ' https://anilist.co/user/' + user .name )}>
17
17
<ExternalLink size =' 2rem' />
18
18
</span >
Original file line number Diff line number Diff line change @@ -103,7 +103,8 @@ export class W2GClient extends EventEmitter {
103
103
}
104
104
105
105
_playerStateChanged ( state ) {
106
- debug ( `_playerStateChanged: ${ this . player . paused } ${ state . paused } ${ this . player . time } ${ state . time } ` )
106
+ debug ( `_playerStateChanged: ${ this . player ?. paused } ${ state ?. paused } ${ this . player ?. time } ${ state ?. time } ` )
107
+ if ( ! state ) return false
107
108
if ( this . player . paused !== state . paused || this . player . time !== state . time ) {
108
109
this . player = state
109
110
return true
@@ -177,6 +178,7 @@ export class W2GClient extends EventEmitter {
177
178
} )
178
179
break
179
180
case EventTypes . MagnetLinkEvent : {
181
+ if ( data . payload ?. magnet === undefined ) break
180
182
const { hash, magnet } = data . payload
181
183
if ( hash !== this . magnet ?. hash ) {
182
184
this . isHost = false
@@ -187,13 +189,15 @@ export class W2GClient extends EventEmitter {
187
189
break
188
190
}
189
191
case EventTypes . MediaIndexEvent : {
192
+ if ( data . payload ?. index === undefined ) break
190
193
if ( this . index !== data . payload . index ) {
191
194
this . index = data . payload . index
192
195
this . emit ( 'index' , data . payload . index )
193
196
}
194
197
break
195
198
}
196
199
case EventTypes . PlayerStateEvent : {
200
+ if ( data . payload ?. time === undefined ) break
197
201
if ( this . _playerStateChanged ( data . payload ) ) this . emit ( 'player' , data . payload )
198
202
break
199
203
}
You can’t perform that action at this time.
0 commit comments