summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-10-17 11:06:40 -0700
committerChris Loer <chris.loer@mapbox.com>2018-10-17 12:53:24 -0700
commit44f79031b78ac25052fac51e423fb014a3243c81 (patch)
tree11034b73a22dbaaa4bfef9d329ba95a8710bd082 /platform/android
parentaab55cfbcdbcdea3610beb5f02d276d2e417cedb (diff)
downloadqtlocation-mapboxgl-44f79031b78ac25052fac51e423fb014a3243c81.tar.gz
[android] Include "must-revalidate" in putResourceWithURL
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java4
-rw-r--r--platform/android/src/offline/offline_manager.cpp4
-rw-r--r--platform/android/src/offline/offline_manager.hpp3
3 files changed, 8 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java
index cf6233a805..a6926d1c9f 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java
@@ -480,7 +480,9 @@ public class OfflineManager {
* @param modified Optional "modified" response header, in seconds since 1970, or 0 if not set
* @param expires Optional "expires" response header, in seconds since 1970, or 0 if not set
* @param etag Optional "entity tag" response header
+ * @param mustRevalidate Indicates whether response can be used after it's stale
*/
@Keep
- public native void putResourceWithUrl(String url, byte[] data, long modified, long expires, String etag);
+ public native void putResourceWithUrl(String url, byte[] data, long modified, long expires,
+ String etag, boolean mustRevalidate);
}
diff --git a/platform/android/src/offline/offline_manager.cpp b/platform/android/src/offline/offline_manager.cpp
index 07e10d4c81..968c33b644 100644
--- a/platform/android/src/offline/offline_manager.cpp
+++ b/platform/android/src/offline/offline_manager.cpp
@@ -207,13 +207,15 @@ void OfflineManager::putResourceWithUrl(jni::JNIEnv& env,
const jni::Array<jni::jbyte>& arr,
jlong modified,
jlong expires,
- const jni::String& eTag_) {
+ const jni::String& eTag_,
+ jboolean mustRevalidate) {
auto url = jni::Make<std::string>(env, url_);
auto data = std::make_shared<std::string>(arr.Length(env), char());
jni::GetArrayRegion(env, *arr, 0, data->size(), reinterpret_cast<jbyte*>(&(*data)[0]));
mbgl::Resource resource(mbgl::Resource::Kind::Unknown, url);
mbgl::Response response;
response.data = data;
+ response.mustRevalidate = mustRevalidate;
if (eTag_) {
response.etag = jni::Make<std::string>(env, eTag_);
}
diff --git a/platform/android/src/offline/offline_manager.hpp b/platform/android/src/offline/offline_manager.hpp
index 52c9ab70a0..f8d57b88da 100644
--- a/platform/android/src/offline/offline_manager.hpp
+++ b/platform/android/src/offline/offline_manager.hpp
@@ -80,7 +80,8 @@ public:
const jni::Array<jni::jbyte>& data,
jlong modified,
jlong expires,
- const jni::String& eTag);
+ const jni::String& eTag,
+ jboolean mustRevalidate);
private: