fix: bugs introduced 3 versions down (#128)

* fix: Bugs

* fix: Set default partySize to 1
This commit is contained in:
Frangu Vlad 2018-12-01 18:49:26 +02:00 committed by Crawl
parent 66f21b1c7e
commit 2e8fe55de7

View file

@ -73,7 +73,7 @@ export default class Activity implements Disposable {
} }
let previousTimestamp = null; 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 = {
...this._state, ...this._state,
@ -98,7 +98,7 @@ export default class Activity implements Disposable {
public async allowSpectate() { public async allowSpectate() {
const liveshare = await vsls.getApi(); const liveshare = await vsls.getApi();
if (!liveshare) return; if (!liveshare) return;
const join = await liveshare.share(); const join = await liveshare.share({ suppressNotification: true, access: vsls.Access.ReadOnly });
this._state = { this._state = {
...this._state, ...this._state,
spectateSecret: join ? Buffer.from(join.toString()).toString('base64') : undefined, spectateSecret: join ? Buffer.from(join.toString()).toString('base64') : undefined,
@ -124,9 +124,9 @@ export default class Activity implements Disposable {
public async allowJoinRequests() { public async allowJoinRequests() {
const liveshare = await vsls.getApi(); const liveshare = await vsls.getApi();
if (!liveshare) return; if (!liveshare) return;
const join = await liveshare.share(); const join = await liveshare.share({ suppressNotification: true });
this._state = { this._state = {
...this.state, ...this._state,
partyId: join ? join.query : undefined, partyId: join ? join.query : undefined,
partySize: 1, partySize: 1,
partyMax: 5, partyMax: 5,
@ -156,8 +156,9 @@ export default class Activity implements Disposable {
public changePartyId(id?: string) { public changePartyId(id?: string) {
if (!this._state) return; if (!this._state) return;
this._state = { this._state = {
...this._state,
partyId: id, partyId: id,
partySize: this._state.partySize ? this._state.partySize + 1 : 2, partySize: this._state.partySize ? this._state.partySize + 1 : 1,
partyMax: id ? 5 : undefined partyMax: id ? 5 : undefined
}; };