mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Merge pull request #7350 from zackhow/android-analytics
Android: Add usage statistics to android
This commit is contained in:
@ -190,5 +190,4 @@ void HttpAnalyticsBackend::Send(std::string report)
|
||||
if (m_http.IsValid())
|
||||
m_http.Post(m_endpoint, report);
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
@ -183,5 +183,4 @@ protected:
|
||||
std::string m_endpoint;
|
||||
HttpRequest m_http{std::chrono::seconds{5}};
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
27
Source/Core/Common/AndroidAnalytics.cpp
Normal file
27
Source/Core/Common/AndroidAnalytics.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "Common/AndroidAnalytics.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
std::function<void(std::string, std::string)> s_android_send_report;
|
||||
void AndroidSetReportHandler(std::function<void(std::string, std::string)> func)
|
||||
{
|
||||
s_android_send_report = std::move(func);
|
||||
}
|
||||
AndroidAnalyticsBackend::AndroidAnalyticsBackend(std::string passed_endpoint)
|
||||
: m_endpoint{std::move(passed_endpoint)}
|
||||
{
|
||||
}
|
||||
AndroidAnalyticsBackend::~AndroidAnalyticsBackend() = default;
|
||||
|
||||
void AndroidAnalyticsBackend::Send(std::string report)
|
||||
{
|
||||
s_android_send_report(m_endpoint, report);
|
||||
}
|
||||
} // namespace Common
|
26
Source/Core/Common/AndroidAnalytics.h
Normal file
26
Source/Core/Common/AndroidAnalytics.h
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Analytics.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
void AndroidSetReportHandler(std::function<void(std::string, std::string)> function);
|
||||
|
||||
class AndroidAnalyticsBackend : public AnalyticsReportingBackend
|
||||
{
|
||||
public:
|
||||
explicit AndroidAnalyticsBackend(const std::string endpoint);
|
||||
|
||||
~AndroidAnalyticsBackend() override;
|
||||
void Send(std::string report) override;
|
||||
|
||||
private:
|
||||
std::string m_endpoint;
|
||||
};
|
||||
} // namespace Common
|
@ -71,6 +71,7 @@ endif()
|
||||
|
||||
if(ANDROID)
|
||||
target_sources(common PRIVATE
|
||||
AndroidAnalytics.cpp
|
||||
Logging/ConsoleListenerDroid.cpp
|
||||
)
|
||||
elseif(WIN32)
|
||||
|
Reference in New Issue
Block a user