mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-31 14:51:02 +00:00
ci: adding sonar ignore
This commit is contained in:
17
src/main/services/ws/events/friend-game-session.ts
Normal file
17
src/main/services/ws/events/friend-game-session.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { FriendGameSession } from "@main/generated/envelope";
|
||||
import { HydraApi } from "@main/services/hydra-api";
|
||||
import { publishFriendStartedPlayingGameNotification } from "@main/services/notifications";
|
||||
import { GameStats } from "@types";
|
||||
|
||||
export const friendGameSessionEvent = async (payload: FriendGameSession) => {
|
||||
const [friend, gameStats] = await Promise.all([
|
||||
HydraApi.get(`/users/${payload.friendId}`),
|
||||
HydraApi.get<GameStats>(
|
||||
`/games/stats?objectId=${payload.objectId}&shop=steam`
|
||||
),
|
||||
]);
|
||||
|
||||
if (friend && gameStats) {
|
||||
publishFriendStartedPlayingGameNotification(friend, gameStats);
|
||||
}
|
||||
};
|
||||
16
src/main/services/ws/events/friend-request.ts
Normal file
16
src/main/services/ws/events/friend-request.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { FriendRequest } from "@main/generated/envelope";
|
||||
import { HydraApi } from "@main/services/hydra-api";
|
||||
import { publishNewFriendRequestNotification } from "@main/services/notifications";
|
||||
import { WindowManager } from "@main/services/window-manager";
|
||||
|
||||
export const friendRequestEvent = async (payload: FriendRequest) => {
|
||||
WindowManager.mainWindow?.webContents.send("on-sync-friend-requests", {
|
||||
friendRequestCount: payload.friendRequestCount,
|
||||
});
|
||||
|
||||
const user = await HydraApi.get(`/users/${payload.senderId}`);
|
||||
|
||||
if (user) {
|
||||
publishNewFriendRequestNotification(user);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user