Skip to content

Commit

Permalink
Fixed issue where leave notifications would trigger for every other p…
Browse files Browse the repository at this point in the history
…layer when leaving a world.
  • Loading branch information
Raphiiko committed Sep 8, 2024
1 parent 219a04c commit 3e2fa5f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Duration inputs for shutdown sequence triggers being broken on systems using a 12-hour clock.
- Shutdown sequence being triggered over and over by the sleep mode trigger, when not using it to shut down or reboot the PC.
- Issue where leave notifications would trigger for every other player when leaving a world.

## [1.13.3]

Expand Down
4 changes: 3 additions & 1 deletion src-ui/app/services/join-notifications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { VRChatService } from './vrchat.service';
import { NotificationService } from './notification.service';
import {
concatMap,
delay,
distinctUntilChanged,
filter,
firstValueFrom,
Expand Down Expand Up @@ -102,7 +103,7 @@ export class JoinNotificationsService {
this.vrchat.world
.pipe(
skip(1),
distinctUntilChanged((a, b) => a.instanceId === b.instanceId)
distinctUntilChanged((a, b) => a.instanceId === b.instanceId && a.loaded === b.loaded)
)
.subscribe(() => {
this.queuedNotifications = [];
Expand All @@ -116,6 +117,7 @@ export class JoinNotificationsService {
this.queuedNotifications.push(notificationId);
return val;
}),
delay(500), // Allows queued notifications to be cancelled before they fire in case of a world change
concatMap(async (val) => {
// Skip if it's ID is not queued
if (!this.queuedNotifications.includes(val.id ?? '')) return;
Expand Down
1 change: 1 addition & 0 deletions src-ui/app/services/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class NotificationService {
public async send(content: string, duration = 3000): Promise<string | null> {
try {
const settings = await firstValueFrom(this.appSettingsService.settings);
info(`[Notification] Sending notification (${duration}ms): "${content}"`);
switch (settings.notificationProvider) {
case 'OYASUMIVR':
return await this.sendOyasumiNotification(content, duration);
Expand Down
6 changes: 4 additions & 2 deletions src-ui/app/services/vrchat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,12 @@ export class VRChatService {
break;
}
case 'OnPlayerLeft':
this._world.next({
const context = {

Check failure on line 698 in src-ui/app/services/vrchat.service.ts

View workflow job for this annotation

GitHub Actions / build-dev-release (windows-latest)

Unexpected lexical declaration in case block
...structuredClone(this._world.value),
playerCount: Math.max(this._world.value.playerCount - 1, 0),
});
};
if (event.displayName === this._user.value?.displayName) context.loaded = false;
this._world.next(context);
break;
case 'OnLocationChange':
this._world.next({
Expand Down

0 comments on commit 3e2fa5f

Please sign in to comment.