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;
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
};