Reverted commit D3334273
Reviewed By: astreet Differential Revision: D3334273 fbshipit-source-id: a3849604ea89db74900850c294685e7da9aeeacc
This commit is contained in:
parent
757ab0b936
commit
705daabbb1
|
@ -15,7 +15,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.testing.ReactInstanceSpecForTest;
|
||||
import com.facebook.react.testing.ReactAppInstrumentationTestCase;
|
||||
|
||||
|
@ -46,8 +45,6 @@ public abstract class AbstractScrollViewTestCase extends ReactAppInstrumentation
|
|||
}
|
||||
|
||||
// See ScrollViewListenerModule.js
|
||||
// Matches ScrollViewListenerModule.js
|
||||
@ReactModule(name = "ScrollListener")
|
||||
protected static class ScrollListenerModule extends BaseJavaModule {
|
||||
|
||||
private final ArrayList<Double> mXOffsets = new ArrayList<Double>();
|
||||
|
@ -57,6 +54,12 @@ public abstract class AbstractScrollViewTestCase extends ReactAppInstrumentation
|
|||
private boolean mScrollBeginDragCalled;
|
||||
private boolean mScrollEndDragCalled;
|
||||
|
||||
// Matches ScrollViewListenerModule.js
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ScrollListener";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void onScroll(double x, double y) {
|
||||
mXOffsets.add(x);
|
||||
|
|
|
@ -12,7 +12,6 @@ import javax.annotation.Nullable;
|
|||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
@ -20,13 +19,17 @@ import static junit.framework.Assert.assertTrue;
|
|||
/**
|
||||
* NativeModule for tests that allows assertions from JS to propagate to Java.
|
||||
*/
|
||||
@ReactModule(name = "Assert")
|
||||
public class AssertModule extends BaseJavaModule {
|
||||
|
||||
private boolean mGotSuccess;
|
||||
private boolean mGotFailure;
|
||||
private @Nullable String mFirstFailureStackTrace;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Assert";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void fail(String stackTrace) {
|
||||
if (!mGotFailure) {
|
||||
|
|
|
@ -14,12 +14,10 @@ import com.facebook.react.bridge.Callback;
|
|||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Dummy implementation of storage module, used for testing
|
||||
*/
|
||||
@ReactModule(name = "AsyncSQLiteDBStorage")
|
||||
public final class FakeAsyncLocalStorage extends BaseJavaModule {
|
||||
|
||||
private static WritableMap errorMessage;
|
||||
|
@ -28,6 +26,11 @@ public final class FakeAsyncLocalStorage extends BaseJavaModule {
|
|||
errorMessage.putString("message", "Fake Async Local Storage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AsyncSQLiteDBStorage";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiGet(final ReadableArray keys, final Callback callback) {
|
||||
callback.invoke(errorMessage, null);
|
||||
|
|
|
@ -15,18 +15,21 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Native module provides single method {@link #record} which records its single int argument
|
||||
* in calls array
|
||||
*/
|
||||
@ReactModule(name = "Recording")
|
||||
public class IntRecordingModule extends BaseJavaModule {
|
||||
|
||||
private final List<Integer> mCalls = new ArrayList<>();
|
||||
private final CountDownLatch mCountDownLatch = new CountDownLatch(1);
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Recording";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void record(int i) {
|
||||
mCalls.add(i);
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* This class is used to verify that some JS integration tests have completed successfully.
|
||||
|
@ -24,7 +23,6 @@ import com.facebook.react.bridge.annotations.ReactModule;
|
|||
* to wait for the test to run, and {#link JSIntegrationTestChecker#isTestDone()} to check if it
|
||||
* completed successfully.
|
||||
*/
|
||||
@ReactModule(name = "TestModule")
|
||||
public class JSIntegrationTestChecker extends BaseJavaModule {
|
||||
|
||||
private final CountDownLatch mLatch;
|
||||
|
@ -33,6 +31,11 @@ public class JSIntegrationTestChecker extends BaseJavaModule {
|
|||
mLatch = new CountDownLatch(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "TestModule";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void markTestCompleted() {
|
||||
mLatch.countDown();
|
||||
|
|
|
@ -19,14 +19,12 @@ import com.facebook.react.bridge.ReadableArray;
|
|||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||
|
||||
/**
|
||||
* Mock Networking module that records last request received by {@link #sendRequest} method and
|
||||
* returns reponse code and body that should be set with {@link #setResponse}
|
||||
*/
|
||||
@ReactModule(name = "RCTNetworking")
|
||||
public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
|
||||
|
||||
public int mRequestCount = 0;
|
||||
|
@ -65,6 +63,11 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
|
|||
mRequestListener = requestListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getName() {
|
||||
return "RCTNetworking";
|
||||
}
|
||||
|
||||
private void fireReactCallback(
|
||||
Callback callback,
|
||||
int status,
|
||||
|
|
|
@ -13,17 +13,20 @@ import java.util.List;
|
|||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Native module provides single method {@link #record} which records its single string argument
|
||||
* in calls array
|
||||
*/
|
||||
@ReactModule(name = "Recording")
|
||||
public class StringRecordingModule extends BaseJavaModule {
|
||||
|
||||
private final List<String> mCalls = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Recording";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void record(String text) {
|
||||
mCalls.add(text);
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.facebook.react.bridge.UnexpectedNativeTypeException;
|
|||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoModule;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
|
@ -669,13 +668,17 @@ public class CatalystNativeJSToJavaParametersTestCase extends ReactIntegrationTe
|
|||
}
|
||||
}
|
||||
|
||||
@ReactModule(name = "Recording")
|
||||
private class RecordingTestModule extends BaseJavaModule {
|
||||
|
||||
private final List<Object[]> mBasicTypesCalls = new ArrayList<Object[]>();
|
||||
private final List<ReadableArray> mArrayCalls = new ArrayList<ReadableArray>();
|
||||
private final List<ReadableMap> mMapCalls = new ArrayList<ReadableMap>();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Recording";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void receiveBasicTypes(String s, double d, boolean b, String nullableString) {
|
||||
mBasicTypesCalls.add(new Object[]{s, d, b, nullableString});
|
||||
|
|
|
@ -12,13 +12,12 @@ import android.os.Bundle;
|
|||
import android.test.ActivityInstrumentationTestCase2;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactInstanceSpecForTest;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactAppTestActivity;
|
||||
import com.facebook.react.testing.ReactInstanceSpecForTest;
|
||||
|
||||
/**
|
||||
* Simple test case for passing initial props to the root React application.
|
||||
|
@ -28,11 +27,15 @@ public class InitialPropsTestCase extends
|
|||
|
||||
public static final String DEFAULT_JS_BUNDLE = "AndroidTestBundle.js";
|
||||
|
||||
@ReactModule(name = "InitialPropsRecordingModule")
|
||||
private static class RecordingModule extends BaseJavaModule {
|
||||
private int mCount = 0;
|
||||
private ReadableMap mProps;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "InitialPropsRecordingModule";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void recordProps(ReadableMap props) {
|
||||
mProps = props;
|
||||
|
|
|
@ -20,9 +20,7 @@ import com.facebook.react.bridge.JavaScriptModule;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
@ReactModule(name = "JSCHeapCapture")
|
||||
public class JSCHeapCapture extends ReactContextBaseJavaModule {
|
||||
public interface HeapCapture extends JavaScriptModule {
|
||||
void captureHeap(String path);
|
||||
|
@ -134,6 +132,11 @@ public class JSCHeapCapture extends ReactContextBaseJavaModule {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "JSCHeapCapture";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
|
|
|
@ -16,10 +16,8 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
|
||||
|
||||
@ReactModule(name = "AppState")
|
||||
public class AppStateModule extends ReactContextBaseJavaModule
|
||||
implements LifecycleEventListener {
|
||||
|
||||
|
@ -32,6 +30,11 @@ public class AppStateModule extends ReactContextBaseJavaModule
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AppState";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
getReactApplicationContext().addLifecycleEventListener(this);
|
||||
|
|
|
@ -50,7 +50,6 @@ import com.facebook.react.bridge.WritableArray;
|
|||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeArray;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
// TODO #6015104: rename to something less iOSish
|
||||
|
@ -58,7 +57,6 @@ import com.facebook.react.common.ReactConstants;
|
|||
* {@link NativeModule} that allows JS to interact with the photos on the device (i.e.
|
||||
* {@link MediaStore.Images}).
|
||||
*/
|
||||
@ReactModule(name = "RKCameraRollManager")
|
||||
public class CameraRollManager extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final String ERROR_UNABLE_TO_LOAD = "E_UNABLE_TO_LOAD";
|
||||
|
@ -100,6 +98,11 @@ public class CameraRollManager extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RKCameraRollManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
return Collections.emptyMap();
|
||||
|
@ -437,4 +440,5 @@ public class CameraRollManager extends ReactContextBaseJavaModule {
|
|||
node.putMap("location", location);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,13 +46,11 @@ import com.facebook.react.bridge.ReactMethod;
|
|||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
/**
|
||||
* Native module that provides image cropping functionality.
|
||||
*/
|
||||
@ReactModule(name = "RKImageEditingManager")
|
||||
public class ImageEditingManager extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final List<String> LOCAL_URI_PREFIXES = Arrays.asList(
|
||||
|
@ -91,11 +89,17 @@ public class ImageEditingManager extends ReactContextBaseJavaModule {
|
|||
ExifInterface.TAG_WHITE_BALANCE
|
||||
};
|
||||
|
||||
|
||||
public ImageEditingManager(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
new CleanTask(getReactApplicationContext()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RKImageEditingManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
return Collections.emptyMap();
|
||||
|
@ -278,6 +282,7 @@ public class ImageEditingManager extends ReactContextBaseJavaModule {
|
|||
}
|
||||
|
||||
mSuccess.invoke(Uri.fromFile(tempFile).toString());
|
||||
|
||||
} catch (Exception e) {
|
||||
mError.invoke(e.getMessage());
|
||||
}
|
||||
|
|
|
@ -27,9 +27,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
@ReactModule(name = "ImageStoreManager")
|
||||
public class ImageStoreManager extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final int BUFFER_SIZE = 8192;
|
||||
|
@ -38,6 +36,11 @@ public class ImageStoreManager extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ImageStoreManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the base64 representation for an image. The "tag" comes from iOS naming.
|
||||
*
|
||||
|
|
|
@ -14,29 +14,41 @@ import android.content.ClipboardManager;
|
|||
import android.content.ClipData;
|
||||
import android.os.Build;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A module that allows JS to get/set clipboard contents.
|
||||
*/
|
||||
@ReactModule(name = "Clipboard")
|
||||
public class ClipboardModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public ClipboardModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Clipboard";
|
||||
}
|
||||
|
||||
private ClipboardManager getClipboardService() {
|
||||
return (ClipboardManager) getReactApplicationContext().getSystemService(getReactApplicationContext().CLIPBOARD_SERVICE);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getString(Promise promise) {
|
||||
public void getString(Promise promise){
|
||||
try {
|
||||
ClipboardManager clipboard = getClipboardService();
|
||||
ClipData clipData = clipboard.getPrimaryClip();
|
||||
|
@ -48,7 +60,7 @@ public class ClipboardModule extends ReactContextBaseJavaModule {
|
|||
} else {
|
||||
promise.resolve("");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch(Exception e) {
|
||||
promise.reject(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,10 @@ import com.facebook.react.bridge.JavaScriptModule;
|
|||
import com.facebook.react.bridge.SupportsWebWorkers;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Native module that handles device hardware events like hardware back presses.
|
||||
*/
|
||||
@ReactModule(name = "DeviceEventManager")
|
||||
public class DeviceEventManagerModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@SupportsWebWorkers
|
||||
|
@ -77,4 +75,9 @@ public class DeviceEventManagerModule extends ReactContextBaseJavaModule {
|
|||
public void invokeDefaultBackPressHandler() {
|
||||
getReactApplicationContext().runOnUiQueueThread(mInvokeDefaultBackPressRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "DeviceEventManager";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,10 @@ import com.facebook.react.bridge.ReactMethod;
|
|||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableType;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.devsupport.DevSupportManager;
|
||||
import com.facebook.react.common.JavascriptException;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
@ReactModule(name = "RKExceptionsManager")
|
||||
public class ExceptionsManagerModule extends BaseJavaModule {
|
||||
|
||||
static private final Pattern mJsModuleIdPattern = Pattern.compile("(?:^|[/\\\\])(\\d+\\.js)$");
|
||||
|
@ -33,6 +31,11 @@ public class ExceptionsManagerModule extends BaseJavaModule {
|
|||
mDevSupportManager = devSupportManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RKExceptionsManager";
|
||||
}
|
||||
|
||||
// If the file name of a stack frame is numeric (+ ".js"), we assume it's a lazily injected module
|
||||
// coming from a "random access bundle". We are using special source maps for these bundles, so
|
||||
// that we can symbolicate stack traces for multiple injected files with a single source map.
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.devsupport.DevSupportManager;
|
||||
import com.facebook.react.uimanager.ReactChoreographer;
|
||||
|
@ -42,7 +41,6 @@ import javax.annotation.Nullable;
|
|||
/**
|
||||
* Native module for JS timer execution. Timers fire on frame boundaries.
|
||||
*/
|
||||
@ReactModule(name = "RKTiming")
|
||||
public final class Timing extends ReactContextBaseJavaModule implements LifecycleEventListener,
|
||||
OnExecutorUnregisteredListener {
|
||||
|
||||
|
@ -164,7 +162,7 @@ public final class Timing extends ReactContextBaseJavaModule implements Lifecycl
|
|||
long time = SystemClock.currentTimeMillis();
|
||||
long absoluteFrameStartTime = time - frameTimeElapsed;
|
||||
|
||||
if (FRAME_DURATION_MS - (float) frameTimeElapsed < IDLE_CALLBACK_FRAME_DEADLINE_MS) {
|
||||
if (FRAME_DURATION_MS - (float)frameTimeElapsed < IDLE_CALLBACK_FRAME_DEADLINE_MS) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -301,6 +299,11 @@ public final class Timing extends ReactContextBaseJavaModule implements Lifecycl
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RCTTiming";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsWebWorkers() {
|
||||
return true;
|
||||
|
|
|
@ -30,14 +30,12 @@ import com.facebook.react.bridge.ReactMethod;
|
|||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
|
||||
/**
|
||||
* {@link NativeModule} that allows JS to show a native date picker dialog and get called back when
|
||||
* the user selects a date.
|
||||
*/
|
||||
@ReactModule(name = "DatePickerAndroid")
|
||||
public class DatePickerDialogModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@VisibleForTesting
|
||||
|
@ -56,6 +54,11 @@ public class DatePickerDialogModule extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "DatePickerAndroid";
|
||||
}
|
||||
|
||||
private class DatePickerDialogListener implements OnDateSetListener, OnDismissListener {
|
||||
|
||||
private final Promise mPromise;
|
||||
|
@ -126,7 +129,7 @@ public class DatePickerDialogModule extends ReactContextBaseJavaModule {
|
|||
android.support.v4.app.FragmentManager fragmentManager =
|
||||
((android.support.v4.app.FragmentActivity) activity).getSupportFragmentManager();
|
||||
android.support.v4.app.DialogFragment oldFragment =
|
||||
(android.support.v4.app.DialogFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
(android.support.v4.app.DialogFragment)fragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
if (oldFragment != null) {
|
||||
oldFragment.dismiss();
|
||||
}
|
||||
|
@ -141,7 +144,7 @@ public class DatePickerDialogModule extends ReactContextBaseJavaModule {
|
|||
fragment.show(fragmentManager, FRAGMENT_TAG);
|
||||
} else {
|
||||
FragmentManager fragmentManager = activity.getFragmentManager();
|
||||
DialogFragment oldFragment = (DialogFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
DialogFragment oldFragment = (DialogFragment)fragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
if (oldFragment != null) {
|
||||
oldFragment.dismiss();
|
||||
}
|
||||
|
|
|
@ -22,14 +22,12 @@ import com.facebook.react.bridge.JSApplicationCausedNativeException;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
/**
|
||||
* Module that records debug information during transitions (animated navigation events such as
|
||||
* going from one screen to another).
|
||||
*/
|
||||
@ReactModule(name = "AnimationsDebugModule")
|
||||
public class AnimationsDebugModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private @Nullable FpsDebugFrameCallback mFrameCallback;
|
||||
|
@ -42,6 +40,11 @@ public class AnimationsDebugModule extends ReactContextBaseJavaModule {
|
|||
mCatalystSettings = catalystSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AnimationsDebugModule";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void startRecordingFps() {
|
||||
if (mCatalystSettings == null ||
|
||||
|
|
|
@ -14,13 +14,15 @@ import javax.annotation.Nullable;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
|
||||
/**
|
||||
* Module that exposes the URL to the source code map (used for exception stack trace parsing) to JS
|
||||
*/
|
||||
@ReactModule(name = "RCTSourceCode")
|
||||
public class SourceCodeModule extends BaseJavaModule {
|
||||
|
||||
private final String mSourceUrl;
|
||||
|
@ -29,6 +31,11 @@ public class SourceCodeModule extends BaseJavaModule {
|
|||
mSourceUrl = sourceUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RCTSourceCode";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Map<String, Object> getConstants() {
|
||||
HashMap<String, Object> constants = new HashMap<String, Object>();
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle;
|
|||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
|
@ -28,15 +29,15 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
|
||||
@ReactModule(name = "DialogManagerAndroid")
|
||||
public class DialogModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
|
||||
|
||||
/* package */ static final String FRAGMENT_TAG =
|
||||
"com.facebook.catalyst.react.dialog.DialogModule";
|
||||
|
||||
/* package */ static final String NAME = "DialogManagerAndroid";
|
||||
|
||||
/* package */ static final String ACTION_BUTTON_CLICKED = "buttonClicked";
|
||||
/* package */ static final String ACTION_DISMISSED = "dismissed";
|
||||
/* package */ static final String KEY_TITLE = "title";
|
||||
|
@ -60,6 +61,11 @@ public class DialogModule extends ReactContextBaseJavaModule implements Lifecycl
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to allow this module to work with both the standard FragmentManager
|
||||
* and the Support FragmentManager (for apps that need to use it for legacy reasons).
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.facebook.imagepipeline.core.ImagePipelineFactory;
|
|||
import com.facebook.imagepipeline.listener.RequestListener;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.modules.common.ModuleDataCleaner;
|
||||
import com.facebook.react.modules.network.OkHttpClientProvider;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
@ -37,7 +36,6 @@ import okhttp3.OkHttpClient;
|
|||
*
|
||||
* <p>Does not expose any methods to JavaScript code. For initialization and cleanup only.
|
||||
*/
|
||||
@ReactModule(name = "FrescoModule", needsEagerInit = true)
|
||||
public class FrescoModule extends ReactContextBaseJavaModule implements
|
||||
ModuleDataCleaner.Cleanable {
|
||||
|
||||
|
@ -75,6 +73,11 @@ public class FrescoModule extends ReactContextBaseJavaModule implements
|
|||
mConfig = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "FrescoModule";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSensitiveData() {
|
||||
// Clear image cache.
|
||||
|
|
|
@ -11,17 +11,17 @@ package com.facebook.react.modules.i18nmanager;
|
|||
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* {@link NativeModule} that allows JS to set allowRTL and get isRTL status.
|
||||
*/
|
||||
@ReactModule(name = "I18nManager")
|
||||
public class I18nManagerModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private final I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
|
||||
|
@ -30,12 +30,15 @@ public class I18nManagerModule extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "I18nManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
final Map<String, Object> constants = MapBuilder.newHashMap();
|
||||
constants.put(
|
||||
"isRTL",
|
||||
sharedI18nUtilInstance.isRTL(
|
||||
constants.put("isRTL", sharedI18nUtilInstance.isRTL(
|
||||
getReactApplicationContext()
|
||||
));
|
||||
return constants;
|
||||
|
@ -45,13 +48,15 @@ public class I18nManagerModule extends ReactContextBaseJavaModule {
|
|||
public void allowRTL(boolean value) {
|
||||
sharedI18nUtilInstance.allowRTL(
|
||||
getReactApplicationContext(),
|
||||
value);
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void forceRTL(boolean value) {
|
||||
sharedI18nUtilInstance.forceRTL(
|
||||
getReactApplicationContext(),
|
||||
value);
|
||||
value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,9 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
@ReactModule(name = "ImageLoader")
|
||||
public class ImageLoaderModule extends ReactContextBaseJavaModule
|
||||
implements LifecycleEventListener {
|
||||
public class ImageLoaderModule extends ReactContextBaseJavaModule implements
|
||||
LifecycleEventListener {
|
||||
|
||||
private static final String ERROR_INVALID_URI = "E_INVALID_URI";
|
||||
private static final String ERROR_PREFETCH_FAILURE = "E_PREFETCH_FAILURE";
|
||||
|
@ -54,6 +52,11 @@ public class ImageLoaderModule extends ReactContextBaseJavaModule
|
|||
mCallerContext = callerContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ImageLoader";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the width and height of the given image.
|
||||
*
|
||||
|
|
|
@ -19,18 +19,21 @@ import com.facebook.react.bridge.Promise;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Intent module. Launch other activities or open URLs.
|
||||
*/
|
||||
@ReactModule(name = "IntentAndroid")
|
||||
public class IntentModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public IntentModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "IntentAndroid";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the URL the activity was started with
|
||||
*
|
||||
|
|
|
@ -27,14 +27,12 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
|
||||
|
||||
/**
|
||||
* Native module that exposes Geolocation to JS.
|
||||
*/
|
||||
@ReactModule(name = "LocationObserver")
|
||||
public class LocationModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private @Nullable String mWatchedProvider;
|
||||
|
@ -67,6 +65,11 @@ public class LocationModule extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "LocationObserver";
|
||||
}
|
||||
|
||||
private static class LocationOptions {
|
||||
private final long timeout;
|
||||
private final double maximumAge;
|
||||
|
|
|
@ -24,14 +24,12 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
import static com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
|
||||
|
||||
/**
|
||||
* Module that monitors and provides information about the connectivity state of the device.
|
||||
*/
|
||||
@ReactModule(name = "NetInfo")
|
||||
public class NetInfoModule extends ReactContextBaseJavaModule
|
||||
implements LifecycleEventListener {
|
||||
|
||||
|
@ -75,6 +73,11 @@ public class NetInfoModule extends ReactContextBaseJavaModule
|
|||
getReactApplicationContext().addLifecycleEventListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "NetInfo";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getCurrentConnectivity(Promise promise) {
|
||||
if (mNoNetworkPermission) {
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.facebook.react.bridge.ReactMethod;
|
|||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.network.OkHttpCallUtil;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
|
||||
|
||||
|
@ -50,7 +49,6 @@ import okhttp3.ResponseBody;
|
|||
/**
|
||||
* Implements the XMLHttpRequest JavaScript interface.
|
||||
*/
|
||||
@ReactModule(name = "RCTNetworking")
|
||||
public final class NetworkingModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final String CONTENT_ENCODING_HEADER_NAME = "content-encoding";
|
||||
|
@ -137,6 +135,11 @@ public final class NetworkingModule extends ReactContextBaseJavaModule {
|
|||
mCookieJarContainer.setCookieJar(new JavaNetCookieJar(mCookieHandler));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RCTNetworking";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCatalystInstanceDestroy() {
|
||||
mShuttingDown = true;
|
||||
|
|
|
@ -19,14 +19,12 @@ import com.facebook.react.bridge.Callback;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.modules.core.PermissionAwareActivity;
|
||||
import com.facebook.react.modules.core.PermissionListener;
|
||||
|
||||
/**
|
||||
* Module that exposes the Android M Permission system to JS.
|
||||
*/
|
||||
@ReactModule(name = "AndroidPermissions")
|
||||
public class PermissionsModule extends ReactContextBaseJavaModule implements PermissionListener {
|
||||
|
||||
private final SparseArray<Callback> mCallbacks;
|
||||
|
@ -37,6 +35,11 @@ public class PermissionsModule extends ReactContextBaseJavaModule implements Per
|
|||
mCallbacks = new SparseArray<Callback>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AndroidPermissions";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the app has the permission given. successCallback is called with true if the
|
||||
* permission had been granted, false otherwise. See {@link Activity#checkSelfPermission}.
|
||||
|
|
|
@ -11,20 +11,21 @@ package com.facebook.react.modules.share;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
/**
|
||||
* Intent module. Launch other activities or open URLs.
|
||||
*/
|
||||
@ReactModule(name = "ShareModule")
|
||||
public class ShareModule extends ReactContextBaseJavaModule {
|
||||
|
||||
/* package */ static final String ACTION_SHARED = "sharedAction";
|
||||
|
@ -35,6 +36,11 @@ public class ShareModule extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ShareModule";
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a chooser dialog to send text content to other apps.
|
||||
*
|
||||
|
@ -74,9 +80,11 @@ public class ShareModule extends ReactContextBaseJavaModule {
|
|||
WritableMap result = Arguments.createMap();
|
||||
result.putString("action", ACTION_SHARED);
|
||||
promise.resolve(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
promise.reject(ERROR_UNABLE_TO_OPEN_DIALOG, "Failed to open share dialog");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -29,14 +29,12 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
|
||||
/**
|
||||
* {@link NativeModule} that allows changing the appearance of the status bar.
|
||||
*/
|
||||
@ReactModule(name = "StatusBarManager")
|
||||
public class StatusBarModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final String ERROR_NO_ACTIVITY = "E_NO_ACTIVITY";
|
||||
|
@ -49,6 +47,11 @@ public class StatusBarModule extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "StatusBarManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Map<String, Object> getConstants() {
|
||||
final Context context = getReactApplicationContext();
|
||||
|
@ -58,7 +61,8 @@ public class StatusBarModule extends ReactContextBaseJavaModule {
|
|||
0;
|
||||
|
||||
return MapBuilder.<String, Object>of(
|
||||
HEIGHT_KEY, height);
|
||||
HEIGHT_KEY, height
|
||||
);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
|
@ -95,7 +99,8 @@ public class StatusBarModule extends ReactContextBaseJavaModule {
|
|||
}
|
||||
res.resolve(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
res.resolve(null);
|
||||
}
|
||||
|
@ -138,7 +143,8 @@ public class StatusBarModule extends ReactContextBaseJavaModule {
|
|||
ViewCompat.requestApplyInsets(decorView);
|
||||
res.resolve(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,6 +169,7 @@ public class StatusBarModule extends ReactContextBaseJavaModule {
|
|||
|
||||
res.resolve(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.facebook.react.bridge.ReactMethod;
|
|||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.SetBuilder;
|
||||
import com.facebook.react.modules.common.ModuleDataCleaner;
|
||||
|
@ -33,7 +32,6 @@ import static com.facebook.react.modules.storage.ReactDatabaseSupplier.KEY_COLUM
|
|||
import static com.facebook.react.modules.storage.ReactDatabaseSupplier.TABLE_CATALYST;
|
||||
import static com.facebook.react.modules.storage.ReactDatabaseSupplier.VALUE_COLUMN;
|
||||
|
||||
@ReactModule(name = "AsyncSQLiteDBStorage")
|
||||
public final class AsyncStorageModule
|
||||
extends ReactContextBaseJavaModule implements ModuleDataCleaner.Cleanable {
|
||||
|
||||
|
@ -49,6 +47,11 @@ public final class AsyncStorageModule
|
|||
mReactDatabaseSupplier = ReactDatabaseSupplier.getInstance(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AsyncSQLiteDBStorage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
|
|
|
@ -12,7 +12,6 @@ package com.facebook.react.modules.systeminfo;
|
|||
import android.os.Build;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -22,9 +21,13 @@ import javax.annotation.Nullable;
|
|||
/**
|
||||
* Module that exposes Android Constants to JS.
|
||||
*/
|
||||
@ReactModule(name = "AndroidConstants")
|
||||
public class AndroidInfoModule extends BaseJavaModule {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AndroidConstants";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Map<String, Object> getConstants() {
|
||||
HashMap<String, Object> constants = new HashMap<String, Object>();
|
||||
|
|
|
@ -11,6 +11,7 @@ package com.facebook.react.modules.timepicker;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DialogFragment;
|
||||
|
@ -29,14 +30,12 @@ import com.facebook.react.bridge.ReactMethod;
|
|||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
|
||||
/**
|
||||
* {@link NativeModule} that allows JS to show a native time picker dialog and get called back when
|
||||
* the user selects a time.
|
||||
*/
|
||||
@ReactModule(name = "TimePickerAndroid")
|
||||
public class TimePickerDialogModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@VisibleForTesting
|
||||
|
@ -54,6 +53,11 @@ public class TimePickerDialogModule extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "TimePickerAndroid";
|
||||
}
|
||||
|
||||
private class TimePickerDialogListener implements OnTimeSetListener, OnDismissListener {
|
||||
|
||||
private final Promise mPromise;
|
||||
|
@ -102,7 +106,7 @@ public class TimePickerDialogModule extends ReactContextBaseJavaModule {
|
|||
android.support.v4.app.FragmentManager fragmentManager =
|
||||
((android.support.v4.app.FragmentActivity) activity).getSupportFragmentManager();
|
||||
android.support.v4.app.DialogFragment oldFragment =
|
||||
(android.support.v4.app.DialogFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
(android.support.v4.app.DialogFragment)fragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
if (oldFragment != null) {
|
||||
oldFragment.dismiss();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.facebook.react.bridge.NativeModule;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
|
||||
|
@ -25,7 +24,6 @@ import java.util.Map;
|
|||
/**
|
||||
* {@link NativeModule} that allows JS to show an Android Toast.
|
||||
*/
|
||||
@ReactModule(name = "ToastAndroid")
|
||||
public class ToastModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final String DURATION_SHORT_KEY = "SHORT";
|
||||
|
@ -39,6 +37,11 @@ public class ToastModule extends ReactContextBaseJavaModule {
|
|||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ToastAndroid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
final Map<String, Object> constants = MapBuilder.newHashMap();
|
||||
|
|
|
@ -16,15 +16,18 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
@ReactModule(name = "Vibration")
|
||||
public class VibrationModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public VibrationModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Vibration";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void vibrate(int duration) {
|
||||
Vibrator v = (Vibrator) getReactApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.facebook.react.bridge.ReadableMap;
|
|||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.bridge.ReadableType;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||
|
||||
|
@ -48,7 +47,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import okio.Buffer;
|
||||
import okio.ByteString;
|
||||
|
||||
@ReactModule(name = "WebSocketModule")
|
||||
public class WebSocketModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private Map<Integer, WebSocket> mWebSocketConnections = new HashMap<>();
|
||||
|
@ -65,6 +63,11 @@ public class WebSocketModule extends ReactContextBaseJavaModule {
|
|||
.emit(eventName, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "WebSocketModule";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void connect(final String url, @Nullable final ReadableArray protocols, @Nullable final ReadableMap headers, final int id) {
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
|
@ -270,8 +273,10 @@ public class WebSocketModule extends ReactContextBaseJavaModule {
|
|||
}
|
||||
|
||||
return defaultOrigin;
|
||||
} catch (URISyntaxException e) {
|
||||
|
||||
} catch(URISyntaxException e) {
|
||||
throw new IllegalArgumentException("Unable to set " + uri + " as default origin header.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
@ -61,7 +59,6 @@ import com.facebook.systrace.SystraceMessage;
|
|||
* consider implementing a pool
|
||||
* TODO(5483063): Don't dispatch the view hierarchy at the end of a batch if no UI changes occurred
|
||||
*/
|
||||
@ReactModule(name = "RKUIManager")
|
||||
public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
OnBatchCompleteListener, LifecycleEventListener {
|
||||
|
||||
|
@ -98,6 +95,11 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
|||
return mUIImplementation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RKUIManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
return mModuleConstants;
|
||||
|
|
|
@ -20,14 +20,12 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Native module that can asynchronously request the owners hierarchy of a react tag.
|
||||
*
|
||||
* Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text']
|
||||
*/
|
||||
@ReactModule(name = "DebugComponentOwnershipModule")
|
||||
public class DebugComponentOwnershipModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public interface RCTDebugComponentOwnership extends JavaScriptModule {
|
||||
|
@ -94,4 +92,9 @@ public class DebugComponentOwnershipModule extends ReactContextBaseJavaModule {
|
|||
mRequestIdToCallback.put(requestId, callback);
|
||||
Assertions.assertNotNull(mRCTDebugComponentOwnership).getOwnerHierarchy(requestId, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "DebugComponentOwnershipModule";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue