Implemented synchronous update for GeoJSON source (#3968)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Alex Cristici
2025-12-03 01:02:29 +02:00
committed by GitHub
parent f25a4581fe
commit 29d70ef0bb
32 changed files with 408 additions and 116 deletions

View File

@@ -242,6 +242,10 @@ void GeoJSONSource::setCollectionSync(jni::JNIEnv& env, const jni::Object<JNITyp
setAsync(converterFn);
}
jboolean GeoJSONSource::isUpdateSynchronous(jni::JNIEnv&) {
return source.as<style::GeoJSONSource>()->isUpdateSynchronous();
}
void GeoJSONSource::registerNative(jni::JNIEnv& env) {
// Lookup the class
static auto& javaClass = jni::Class<GeoJSONSource>::Singleton(env);
@@ -269,7 +273,8 @@ void GeoJSONSource::registerNative(jni::JNIEnv& env) {
METHOD(&GeoJSONSource::querySourceFeatures, "querySourceFeatures"),
METHOD(&GeoJSONSource::getClusterChildren, "nativeGetClusterChildren"),
METHOD(&GeoJSONSource::getClusterLeaves, "nativeGetClusterLeaves"),
METHOD(&GeoJSONSource::getClusterExpansionZoom, "nativeGetClusterExpansionZoom"));
METHOD(&GeoJSONSource::getClusterExpansionZoom, "nativeGetClusterExpansionZoom"),
METHOD(&GeoJSONSource::isUpdateSynchronous, "nativeIsUpdateSynchronous"));
}
void FeatureConverter::convertJson(std::shared_ptr<std::string> json, ActorRef<GeoJSONDataCallback> callback) {

View File

@@ -89,6 +89,8 @@ private:
template <class JNIType>
void setCollectionSync(jni::JNIEnv&, const jni::Object<JNIType>&);
jboolean isUpdateSynchronous(jni::JNIEnv&);
}; // class GeoJSONSource
} // namespace android