From 2e8fe55de72b79e26742a6a4bc67c8ed9ab637dd Mon Sep 17 00:00:00 2001 From: Frangu Vlad Date: Sat, 1 Dec 2018 18:49:26 +0200 Subject: [PATCH] fix: bugs introduced 3 versions down (#128) * fix: Bugs * fix: Set default partySize to 1 --- src/structures/Activity.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/structures/Activity.ts b/src/structures/Activity.ts index 01da4f4..e901d0c 100644 --- a/src/structures/Activity.ts +++ b/src/structures/Activity.ts @@ -73,7 +73,7 @@ export default class Activity implements Disposable { } let previousTimestamp = null; - if (this.state && this.state.startTimestamp) previousTimestamp = this.state.startTimestamp; + if (this._state && this._state.startTimestamp) previousTimestamp = this._state.startTimestamp; this._state = { ...this._state, @@ -98,7 +98,7 @@ export default class Activity implements Disposable { public async allowSpectate() { const liveshare = await vsls.getApi(); if (!liveshare) return; - const join = await liveshare.share(); + const join = await liveshare.share({ suppressNotification: true, access: vsls.Access.ReadOnly }); this._state = { ...this._state, spectateSecret: join ? Buffer.from(join.toString()).toString('base64') : undefined, @@ -124,9 +124,9 @@ export default class Activity implements Disposable { public async allowJoinRequests() { const liveshare = await vsls.getApi(); if (!liveshare) return; - const join = await liveshare.share(); + const join = await liveshare.share({ suppressNotification: true }); this._state = { - ...this.state, + ...this._state, partyId: join ? join.query : undefined, partySize: 1, partyMax: 5, @@ -156,8 +156,9 @@ export default class Activity implements Disposable { public changePartyId(id?: string) { if (!this._state) return; this._state = { + ...this._state, partyId: id, - partySize: this._state.partySize ? this._state.partySize + 1 : 2, + partySize: this._state.partySize ? this._state.partySize + 1 : 1, partyMax: id ? 5 : undefined };