Rise
The Vieneo Province
Loading...
Searching...
No Matches
DiscordSocialPresence.h
Go to the documentation of this file.
1#pragma once
2
4#include <functional>
5#include <memory>
6
7namespace RiseDiscord
8{
9 constexpr std::uint64_t ApplicationId = 497844043951374357ULL;
10 constexpr std::uint32_t SteamApplicationId = 795990;
11 using Log = std::function<void(const char*, bool warning)>;
12 using Identity = std::function<void(std::uint64_t)>;
13
14 struct Result
15 {
16 bool successful{};
17 int errorType{};
18 int errorCode{};
19 };
20
21 // Only the adapter knows Discord's ABI. Tests substitute the desktop transport.
23 {
24 public:
25 using Completion = std::function<void(Result)>;
26 using UserCompletion = std::function<void(Result, std::uint64_t)>;
27 virtual ~SocialSdk() = default;
28 virtual void Pump() = 0;
29 virtual void Update(const Activity&, Completion) = 0;
30 virtual void QueryUser(UserCompletion) = 0;
31 virtual void Clear() = 0;
32 };
33
34 std::unique_ptr<SocialSdk> CreateSocialSdk(const Log& log);
35
37 {
38 struct State;
39 std::shared_ptr<State> state;
40 std::unique_ptr<SocialSdk> sdk;
41
42 public:
43 PresenceSession(std::unique_ptr<SocialSdk>, Log, Identity);
48 void FrameMove(std::uint64_t monotonicMilliseconds);
49 void Stop();
50 };
51}
std::shared_ptr< State > state
PresenceSession(const PresenceSession &)=delete
PresenceSession & operator=(const PresenceSession &)=delete
void FrameMove(std::uint64_t monotonicMilliseconds)
std::unique_ptr< SocialSdk > sdk
PresenceSession(std::unique_ptr< SocialSdk >, Log, Identity)
virtual ~SocialSdk()=default
virtual void Update(const Activity &, Completion)=0
std::function< void(Result, std::uint64_t)> UserCompletion
virtual void Clear()=0
virtual void Pump()=0
std::function< void(Result)> Completion
virtual void QueryUser(UserCompletion)=0
std::function< void(std::uint64_t)> Identity
constexpr std::uint64_t ApplicationId
constexpr std::uint32_t SteamApplicationId
std::unique_ptr< SocialSdk > CreateSocialSdk(const Log &log)
std::function< void(const char *, bool warning)> Log
typedef void(S_CALLTYPE *SteamAPIWarningMessageHook_t)(int