Files
shadPS4/src/imgui/shadnet_notifications_layer.h
T
georgemoralis aff387e8a9 First ShadNet integration (#4607)
* initial shadnet client (based on my previous prs)

* some np_handler work mostly based on our previous pr

* improved login/logout event of shadnet

* added np_score support from previous pr

* friends and notifications ui

* clang is not my friend

* clang fix again

* added webapi support for shadnet

* applied metrik's fix

* clang

* fixed some wrong LOG_ERRORS

* updated emulator settings

* trying to fix npcommid bugs

* fixed npcommid

* improved NPcommid detection so it won't write null values to database

* metrik's suggestion

* removed one line

* more command types

* fixed duplicated log print

* fixed compile

* improved reconnection retries

* simplify error code

* stephen suggestion

* made friends hotkey

* fixup

* more proper handling of reconnecting

* fixed return code
2026-06-24 23:57:43 +03:00

53 lines
1.3 KiB
C++

// SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <cstddef>
#include <string>
#include <vector>
namespace ImGui::ShadNetNotify {
// Kind drives the colored tag shown on the toast and in the history list.
enum class Kind {
FriendRequest,
FriendNew,
FriendLost,
Online,
Info,
};
// A retained notification entry
struct HistoryEntry {
Kind kind;
std::string text;
std::string time; // local "HH:MM:SS" captured when pushed
};
// Display style for a kind: short tag + RGBA color
struct KindDisplay {
const char* tag;
float color[4];
};
KindDisplay DisplayOf(Kind kind);
// Queue a shadNet notification: shows a transient toast AND appends to history.
void Push(Kind kind, std::string text);
// History access for UI (newest entries last)
std::vector<HistoryEntry> GetHistory();
void ClearHistory();
// Unread tracking for a UI badge: number of events pushed since the last MarkRead().
// Call MarkRead() when the user is actually viewing the notifications list.
std::size_t UnreadCount();
void MarkRead();
// Add/remove the toast overlay layer. Call Register() once after ImGui init and
// Unregister() on teardown.
void Register();
void Unregister();
} // namespace ImGui::ShadNetNotify