diff --git a/ReactAndroid/src/main/jni/xreact/jni/OnLoad.cpp b/ReactAndroid/src/main/jni/xreact/jni/OnLoad.cpp index 7be58ad9f..b275df571 100644 --- a/ReactAndroid/src/main/jni/xreact/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/jni/xreact/jni/OnLoad.cpp @@ -34,7 +34,7 @@ namespace react { namespace { -static std::string getApplicationDir(const char* methodName) { +static std::string getApplicationCacheDir(void) { // Get the Application Context object auto getApplicationClass = findClassLocal( "com/facebook/react/common/ApplicationHolder"); @@ -46,7 +46,7 @@ static std::string getApplicationDir(const char* methodName) { // Get getCacheDir() from the context auto getDirMethod = findClassLocal("android/app/Application") - ->getMethod(methodName, + ->getMethod("getCacheDir", "()Ljava/io/File;" ); auto dirObj = getDirMethod(application); @@ -57,14 +57,6 @@ static std::string getApplicationDir(const char* methodName) { return getAbsolutePathMethod(dirObj)->toStdString(); } -static std::string getApplicationCacheDir() { - return getApplicationDir("getCacheDir"); -} - -static std::string getApplicationPersistentDir() { - return getApplicationDir("getFilesDir"); -} - static JSValueRef nativePerformanceNow( JSContextRef ctx, JSObjectRef function, @@ -95,7 +87,6 @@ class JSCJavaScriptExecutorHolder : public HybridClass initHybrid(alias_ref, ReadableNativeArray* jscConfigArray) { // See JSCJavaScriptExecutor.Factory() for the other side of this hack. folly::dynamic jscConfigMap = jscConfigArray->consume()[0]; - jscConfigMap["PersistentDirectory"] = getApplicationPersistentDir(); return makeCxxInstance( std::make_shared(getApplicationCacheDir(), std::move(jscConfigMap))); }