Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #3891 - getOfflineRegionStatus jni method placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Zugaldia committed Feb 21, 2016
1 parent 7384460 commit be52b65
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions platform/android/src/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2037,16 +2037,22 @@ void JNICALL getOfflineRegionStatus(JNIEnv *env, jobject obj, jobject offlineReg
mbgl::Log::Error(mbgl::Event::JNI, "getOfflineRegionStatus");

// Offline region
// jlong offlineRegionPtr = env->GetLongField(offlineRegion_, offlineRegionPtrId);
// mbgl::OfflineRegion *offlineRegion = reinterpret_cast<mbgl::OfflineRegion *>(offlineRegionPtr);
jlong offlineRegionPtr = env->GetLongField(offlineRegion_, offlineRegionPtrId);
mbgl::OfflineRegion *offlineRegion = reinterpret_cast<mbgl::OfflineRegion *>(offlineRegionPtr);

// File source
// jobject jmanager = env->GetObjectField(offlineRegion_, offlineRegionOfflineManagerId);
// jlong defaultFileSourcePtr = env->GetLongField(jmanager, offlineManagerClassPtrId);
// mbgl::DefaultFileSource *defaultFileSource = reinterpret_cast<mbgl::DefaultFileSource *>(defaultFileSourcePtr);
jobject jmanager = env->GetObjectField(offlineRegion_, offlineRegionOfflineManagerId);
jlong defaultFileSourcePtr = env->GetLongField(jmanager, offlineManagerClassPtrId);
mbgl::DefaultFileSource *defaultFileSource = reinterpret_cast<mbgl::DefaultFileSource *>(defaultFileSourcePtr);

// Set new state
// defaultFileSource->getOfflineRegionStatus(*offlineRegion, std::function<void (std::exception_ptr, optional<OfflineRegionStatus>)>);
defaultFileSource->getOfflineRegionStatus(*offlineRegion, [](std::exception_ptr error, mbgl::optional<mbgl::OfflineRegionStatus> status) {
if (error) {
mbgl::Log::Error(mbgl::Event::JNI, "Get region status failed.");
} else {
mbgl::Log::Error(mbgl::Event::JNI, "Region status returned.");
}
});
}

void JNICALL deleteOfflineRegion(JNIEnv *env, jobject obj, jobject offlineRegion_, jobject deleteCallback) {
Expand Down

0 comments on commit be52b65

Please sign in to comment.