summaryrefslogtreecommitdiff
path: root/platform/android/src/storage/default_file_source_peer.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-16 21:17:04 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-01-17 11:32:14 +0100
commitea273d4e75f51a6cb7a6fc7573c7722e34e730f1 (patch)
treef57a4acd50f77444f74db821b248e88f150a6b9f /platform/android/src/storage/default_file_source_peer.hpp
parent7983e3a67c557a0fcf118984404ea1756416b521 (diff)
downloadqtlocation-mapboxgl-ea273d4e75f51a6cb7a6fc7573c7722e34e730f1.tar.gz
[android] expose DefaultFileSource via jni.hpp
Instantiate only one DefaultFileSource in the global Mapbox singleton, instead of one per Map object
Diffstat (limited to 'platform/android/src/storage/default_file_source_peer.hpp')
-rw-r--r--platform/android/src/storage/default_file_source_peer.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/platform/android/src/storage/default_file_source_peer.hpp b/platform/android/src/storage/default_file_source_peer.hpp
new file mode 100644
index 0000000000..c0f60447b3
--- /dev/null
+++ b/platform/android/src/storage/default_file_source_peer.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <jni/jni.hpp>
+
+#include <memory>
+
+namespace mbgl {
+
+class DefaultFileSource;
+
+namespace android {
+
+class DefaultFileSourcePeer {
+public:
+ static constexpr auto Name() { return "com/mapbox/mapboxsdk/storage/DefaultFileSource"; }
+ static jni::Class<DefaultFileSourcePeer> javaClass;
+ static void registerNative(jni::JNIEnv&);
+
+ DefaultFileSourcePeer(jni::JNIEnv&,
+ jni::String cachePath,
+ jni::String assetRoot,
+ jni::jlong maximumCacheSize);
+ ~DefaultFileSourcePeer();
+
+ void setAPIBaseURL(jni::JNIEnv&, jni::String);
+ jni::String getAPIBaseURL(jni::JNIEnv&);
+
+ void setAccessToken(jni::JNIEnv&, jni::String);
+ jni::String getAccessToken(jni::JNIEnv&);
+
+ DefaultFileSource& getFileSource() {
+ return *native;
+ }
+
+private:
+ const std::unique_ptr<DefaultFileSource> native;
+};
+
+} // namespace android
+} // namespace mbgl