Skip to content

Commit d14137c

Browse files
committed
eliminate LatestClient API helper
1 parent 2818c6b commit d14137c

24 files changed

Lines changed: 125 additions & 514 deletions

src/Exports.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "RA_Resource.h"
77

88
#include "api\IServer.hh"
9-
#include "api\impl\OfflineServer.hh"
109

1110
#include "context\IConsoleContext.hh"
1211
#include "context\IRcClient.hh"
@@ -103,7 +102,6 @@ static void InitializeOfflineMode()
103102
auto& pConfiguration = ra::services::ServiceLocator::GetMutable<ra::services::IConfiguration>();
104103
pConfiguration.SetFeatureEnabled(ra::services::Feature::Offline, true);
105104

106-
ra::services::ServiceLocator::Provide<ra::api::IServer>(std::make_unique<ra::api::impl::OfflineServer>());
107105
ra::services::ServiceLocator::Provide<ra::context::IRcClient>(std::make_unique<ra::services::impl::OfflineRcClient>());
108106

109107
// reattach hooks to new rc_client_t

src/RA_Integration.vcxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@
7474
<ItemGroup>
7575
<ClCompile Include="api\ApiCall.cpp" />
7676
<ClCompile Include="api\impl\ConnectedServer.cpp" />
77-
<ClCompile Include="api\impl\DisconnectedServer.cpp" />
78-
<ClCompile Include="api\impl\OfflineServer.cpp" />
7977
<ClCompile Include="data\context\EmulatorContext.cpp" />
8078
<ClCompile Include="data\context\GameContext.cpp" />
8179
<ClCompile Include="data\context\SessionTracker.cpp" />
@@ -194,10 +192,8 @@
194192
<ClInclude Include="api\FetchLeaderboardInfo.hh" />
195193
<ClInclude Include="api\impl\ConnectedServer.hh" />
196194
<ClInclude Include="api\impl\DisconnectedServer.hh" />
197-
<ClInclude Include="api\impl\OfflineServer.hh" />
198195
<ClInclude Include="api\impl\ServerBase.hh" />
199196
<ClInclude Include="api\IServer.hh" />
200-
<ClInclude Include="api\LatestClient.hh" />
201197
<ClInclude Include="api\UpdateAchievement.hh" />
202198
<ClInclude Include="api\UpdateLeaderboard.hh" />
203199
<ClInclude Include="api\UpdateRichPresence.hh" />

src/RA_Integration.vcxproj.filters

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@
132132
<ClCompile Include="api\impl\ConnectedServer.cpp">
133133
<Filter>API\impl</Filter>
134134
</ClCompile>
135-
<ClCompile Include="api\impl\DisconnectedServer.cpp">
136-
<Filter>API\impl</Filter>
137-
</ClCompile>
138-
<ClCompile Include="api\impl\OfflineServer.cpp">
139-
<Filter>API\impl</Filter>
140-
</ClCompile>
141135
<ClCompile Include="ui\drawing\gdi\GDISurface.cpp">
142136
<Filter>UI\Drawing\GDI</Filter>
143137
</ClCompile>
@@ -527,9 +521,6 @@
527521
<ClInclude Include="api\impl\DisconnectedServer.hh">
528522
<Filter>API\impl</Filter>
529523
</ClInclude>
530-
<ClInclude Include="api\impl\OfflineServer.hh">
531-
<Filter>API\impl</Filter>
532-
</ClInclude>
533524
<ClInclude Include="ui\drawing\gdi\GDISurface.hh">
534525
<Filter>UI\Drawing\GDI</Filter>
535526
</ClInclude>
@@ -584,9 +575,6 @@
584575
<ClInclude Include="ui\win32\bindings\CheckBoxBinding.hh">
585576
<Filter>UI\Win32\Bindings</Filter>
586577
</ClInclude>
587-
<ClInclude Include="api\LatestClient.hh">
588-
<Filter>API</Filter>
589-
</ClInclude>
590578
<ClInclude Include="ui\ViewModelCollection.hh">
591579
<Filter>UI</Filter>
592580
</ClInclude>

src/api/ApiCall.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ FetchAchievementInfo::Response FetchAchievementInfo::Request::Call() const { ret
1818
UpdateLeaderboard::Response UpdateLeaderboard::Request::Call() const { return Server().UpdateLeaderboard(*this); }
1919
FetchLeaderboardInfo::Response FetchLeaderboardInfo::Request::Call() const { return Server().FetchLeaderboardInfo(*this); }
2020
UpdateRichPresence::Response UpdateRichPresence::Request::Call() const { return Server().UpdateRichPresence(*this); }
21-
LatestClient::Response LatestClient::Request::Call() const { return Server().LatestClient(*this); }
2221
UploadBadge::Response UploadBadge::Request::Call() const { return Server().UploadBadge(*this); }
2322

2423
} // namespace api

src/api/IServer.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "api/FetchAchievementInfo.hh"
66
#include "api/FetchLeaderboardInfo.hh"
7-
#include "api/LatestClient.hh"
87
#include "api/ResolveHash.hh"
98
#include "api/UpdateAchievement.hh"
109
#include "api/UpdateLeaderboard.hh"
@@ -28,7 +27,6 @@ public:
2827
virtual UpdateRichPresence::Response UpdateRichPresence(const UpdateRichPresence::Request& request) = 0;
2928

3029
// === other functions ===
31-
virtual LatestClient::Response LatestClient(const LatestClient::Request& request) = 0;
3230
virtual UploadBadge::Response UploadBadge(const UploadBadge::Request& request) = 0;
3331

3432
protected:

src/api/LatestClient.hh

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/api/impl/ConnectedServer.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -752,33 +752,6 @@ UpdateRichPresence::Response ConnectedServer::UpdateRichPresence(const UpdateRic
752752
return response;
753753
}
754754

755-
LatestClient::Response ConnectedServer::LatestClient(const LatestClient::Request& request)
756-
{
757-
LatestClient::Response response;
758-
rapidjson::Document document;
759-
std::string sPostData;
760-
761-
// LatestClient doesn't require User/Password, so the next few lines are a subset of DoRequest
762-
AppendUrlParam(sPostData, "r", "latestclient");
763-
AppendUrlParam(sPostData, "e", std::to_string(request.EmulatorId));
764-
RA_LOG_INFO("%s Request: %s", LatestClient::Name(), sPostData.c_str());
765-
766-
ra::services::Http::Request httpRequest(ra::util::String::Printf("%s/dorequest.php", m_sHost));
767-
httpRequest.SetPostData(sPostData);
768-
769-
const auto httpResponse = httpRequest.Call();
770-
if (GetJson(LatestClient::Name(), httpResponse, response, document))
771-
{
772-
response.Result = ApiResult::Success;
773-
GetRequiredJsonField(response.LatestVersion, document, "LatestVersion", response);
774-
GetOptionalJsonField(response.MinimumVersion, document, "MinimumVersion");
775-
if (response.MinimumVersion.empty())
776-
response.MinimumVersion = response.LatestVersion;
777-
}
778-
779-
return response;
780-
}
781-
782755
UploadBadge::Response ConnectedServer::UploadBadge(const UploadBadge::Request& request)
783756
{
784757
UploadBadge::Response response;

src/api/impl/ConnectedServer.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public:
2121
UpdateLeaderboard::Response UpdateLeaderboard(const UpdateLeaderboard::Request& request) override;
2222
FetchLeaderboardInfo::Response FetchLeaderboardInfo(const FetchLeaderboardInfo::Request& request) override;
2323
UpdateRichPresence::Response UpdateRichPresence(const UpdateRichPresence::Request& request) override;
24-
LatestClient::Response LatestClient(const LatestClient::Request& request) override;
2524
UploadBadge::Response UploadBadge(const UploadBadge::Request& request) override;
2625

2726
private:

src/api/impl/DisconnectedServer.cpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/api/impl/DisconnectedServer.hh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#pragma once
22

3-
#include "OfflineServer.hh"
3+
#include "ServerBase.hh"
44

55
namespace ra {
66
namespace api {
77
namespace impl {
88

9-
class DisconnectedServer : public OfflineServer
9+
class DisconnectedServer : public ServerBase
1010
{
1111
public:
1212
explicit DisconnectedServer(const std::string& sHost) : m_sHost(sHost) {}
@@ -15,8 +15,6 @@ public:
1515

1616
const std::string& Host() const noexcept { return m_sHost; }
1717

18-
LatestClient::Response LatestClient(const LatestClient::Request& request) override;
19-
2018
private:
2119
const std::string m_sHost;
2220
};

0 commit comments

Comments
 (0)