forked from organicmaps/organicmaps-tmp
[platform] http uploader dummy interface.
This commit is contained in:
parent
d5c1fe7839
commit
7bc2cc23d9
7 changed files with 83 additions and 0 deletions
|
@ -71,6 +71,7 @@ set(
|
|||
com/mapswithme/opengl/androidoglcontextfactory.cpp
|
||||
com/mapswithme/opengl/gl3stub.c
|
||||
com/mapswithme/platform/HttpThread.cpp
|
||||
com/mapswithme/platform/HttpUploader.cpp
|
||||
com/mapswithme/platform/GuiThread.cpp
|
||||
com/mapswithme/platform/Language.cpp
|
||||
com/mapswithme/platform/MarketingService.cpp
|
||||
|
|
12
android/jni/com/mapswithme/platform/HttpUploader.cpp
Normal file
12
android/jni/com/mapswithme/platform/HttpUploader.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "platform/http_uploader.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace platform
|
||||
{
|
||||
void HttpUploader::Upload() const
|
||||
{
|
||||
// Dummy implementation.
|
||||
CHECK(m_callback, ());
|
||||
}
|
||||
} // namespace platform
|
|
@ -23,6 +23,7 @@ set(
|
|||
http_request.cpp
|
||||
http_request.hpp
|
||||
http_thread_callback.hpp
|
||||
http_uploader.hpp
|
||||
local_country_file.cpp
|
||||
local_country_file.hpp
|
||||
local_country_file_utils.cpp
|
||||
|
@ -57,6 +58,7 @@ if(${PLATFORM_IPHONE})
|
|||
http_thread_apple.h
|
||||
http_thread_apple.mm
|
||||
http_client_apple.mm
|
||||
http_uploader_apple.mm
|
||||
marketing_service_ios.mm
|
||||
platform_ios.mm
|
||||
platform_unix_impl.cpp
|
||||
|
@ -88,6 +90,7 @@ else() # neither iPhone nor Android
|
|||
http_client_curl.cpp
|
||||
http_thread_qt.cpp
|
||||
http_thread_qt.hpp
|
||||
http_uploader_dummy.cpp
|
||||
marketing_service_dummy.cpp
|
||||
platform_win.cpp
|
||||
secure_storage_dummy.cpp
|
||||
|
@ -101,6 +104,7 @@ else() # neither iPhone nor Android
|
|||
http_client_apple.mm
|
||||
http_thread_apple.h
|
||||
http_thread_apple.mm
|
||||
http_uploader_apple.mm
|
||||
marketing_service_dummy.cpp
|
||||
platform_mac.mm
|
||||
platform_unix_impl.cpp
|
||||
|
@ -115,6 +119,7 @@ else() # neither iPhone nor Android
|
|||
http_client_curl.cpp
|
||||
http_thread_qt.cpp
|
||||
http_thread_qt.hpp
|
||||
http_uploader_dummy.cpp
|
||||
marketing_service_dummy.cpp
|
||||
platform_linux.cpp
|
||||
platform_unix_impl.cpp
|
||||
|
|
33
platform/http_uploader.hpp
Normal file
33
platform/http_uploader.hpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace platform
|
||||
{
|
||||
class HttpUploader
|
||||
{
|
||||
public:
|
||||
using ResultCallback = std::function<void(int32_t httpCode)>;
|
||||
|
||||
void SetMethod(std::string const & method) { m_method = method; }
|
||||
void SetUrl(std::string const & url) { m_url = url; }
|
||||
void SetParams(std::map<std::string, std::string> const & params) { m_params = params; }
|
||||
void SetHeaders(std::map<std::string, std::string> const & headers) { m_headers = headers; }
|
||||
void SetFileKey(std::string const & fileKey) { m_fileKey = fileKey; }
|
||||
void SetFilename(std::string const & filename) { m_filename = filename; }
|
||||
void SetCallback(ResultCallback const & callback) { m_callback = callback; }
|
||||
|
||||
void Upload() const;
|
||||
|
||||
private:
|
||||
std::string m_method = "POST";
|
||||
std::string m_url;
|
||||
std::map<std::string, std::string> m_params;
|
||||
std::map<std::string, std::string> m_headers;
|
||||
std::string m_fileKey = "file";
|
||||
std::string m_filename;
|
||||
ResultCallback m_callback;
|
||||
};
|
||||
} // namespace platform
|
12
platform/http_uploader_apple.mm
Normal file
12
platform/http_uploader_apple.mm
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "platform/http_uploader.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace platform
|
||||
{
|
||||
void HttpUploader::Upload() const
|
||||
{
|
||||
// Dummy implementation.
|
||||
CHECK(m_callback, ());
|
||||
}
|
||||
} // namespace platform
|
12
platform/http_uploader_dummy.cpp
Normal file
12
platform/http_uploader_dummy.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "platform/http_uploader.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace platform
|
||||
{
|
||||
void HttpUploader::Upload() const
|
||||
{
|
||||
// Dummy implementation.
|
||||
CHECK(m_callback, ());
|
||||
}
|
||||
} // namespace platform
|
|
@ -15,6 +15,8 @@
|
|||
34C624BE1DABCCD100510300 /* socket.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34C624BC1DABCCD100510300 /* socket.hpp */; };
|
||||
3D30587D1D8320E4004AC712 /* http_client.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D30587B1D8320E4004AC712 /* http_client.hpp */; };
|
||||
3D30587F1D880910004AC712 /* http_client_apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D30587E1D880910004AC712 /* http_client_apple.mm */; };
|
||||
3D318A062021DD8B007B2607 /* http_uploader_apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D318A042021DD8A007B2607 /* http_uploader_apple.mm */; };
|
||||
3D318A072021DD8B007B2607 /* http_uploader.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D318A052021DD8B007B2607 /* http_uploader.hpp */; };
|
||||
3D78156E1F3A14090068B6AC /* gui_thread_apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D78156B1F3A14090068B6AC /* gui_thread_apple.mm */; };
|
||||
3D78156F1F3A14090068B6AC /* gui_thread.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D78156C1F3A14090068B6AC /* gui_thread.hpp */; };
|
||||
3D78157D1F3D8A0A0068B6AC /* safe_callback.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D78157C1F3D8A0A0068B6AC /* safe_callback.hpp */; };
|
||||
|
@ -121,6 +123,8 @@
|
|||
34F558341DBF273C00A4FC11 /* common-release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "common-release.xcconfig"; path = "../common-release.xcconfig"; sourceTree = "<group>"; };
|
||||
3D30587B1D8320E4004AC712 /* http_client.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = http_client.hpp; sourceTree = "<group>"; };
|
||||
3D30587E1D880910004AC712 /* http_client_apple.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = http_client_apple.mm; sourceTree = "<group>"; };
|
||||
3D318A042021DD8A007B2607 /* http_uploader_apple.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = http_uploader_apple.mm; sourceTree = "<group>"; };
|
||||
3D318A052021DD8B007B2607 /* http_uploader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = http_uploader.hpp; sourceTree = "<group>"; };
|
||||
3D78156B1F3A14090068B6AC /* gui_thread_apple.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = gui_thread_apple.mm; sourceTree = "<group>"; };
|
||||
3D78156C1F3A14090068B6AC /* gui_thread.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gui_thread.hpp; sourceTree = "<group>"; };
|
||||
3D78157C1F3D8A0A0068B6AC /* safe_callback.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = safe_callback.hpp; sourceTree = "<group>"; };
|
||||
|
@ -336,6 +340,8 @@
|
|||
6753437A1A3F5CF500A0A8C3 /* platform */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D318A042021DD8A007B2607 /* http_uploader_apple.mm */,
|
||||
3D318A052021DD8B007B2607 /* http_uploader.hpp */,
|
||||
451E329F1F73A8B000964C9F /* secure_storage.hpp */,
|
||||
451E329D1F73A8B000964C9F /* secure_storage_ios.mm */,
|
||||
451E329E1F73A8B000964C9F /* secure_storage_qt.cpp */,
|
||||
|
@ -475,6 +481,7 @@
|
|||
3D30587D1D8320E4004AC712 /* http_client.hpp in Headers */,
|
||||
56EB1EDD1C6B6E6C0022D831 /* file_logging.hpp in Headers */,
|
||||
F6DF735B1EC9EAE700D8BA0B /* string_storage_base.hpp in Headers */,
|
||||
3D318A072021DD8B007B2607 /* http_uploader.hpp in Headers */,
|
||||
6741250D1B4C00CC00A3E828 /* local_country_file_utils.hpp in Headers */,
|
||||
675343DA1A3F5D5A00A0A8C3 /* wifi_info.hpp in Headers */,
|
||||
671C62071AE9014C00076BD0 /* measurement_utils.hpp in Headers */,
|
||||
|
@ -620,6 +627,7 @@
|
|||
56EB1EDE1C6B6E6C0022D831 /* mwm_traits.cpp in Sources */,
|
||||
3D30587F1D880910004AC712 /* http_client_apple.mm in Sources */,
|
||||
F6DF73581EC9EAE700D8BA0B /* string_storage_base.cpp in Sources */,
|
||||
3D318A062021DD8B007B2607 /* http_uploader_apple.mm in Sources */,
|
||||
3D78156E1F3A14090068B6AC /* gui_thread_apple.mm in Sources */,
|
||||
67247FFD1C60BD6500EDE56A /* writable_dir_changer.cpp in Sources */,
|
||||
34513AFB1DCB37C100471BDA /* marketing_service.cpp in Sources */,
|
||||
|
|
Loading…
Add table
Reference in a new issue