mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 13:44:04 +00:00
expose IS_TESTING for Platform module
Summary: Introduced IS_TESTING flag on Platform module for android as well. This is useful for testing environment. Reviewed By: mmmulani Differential Revision: D4429662 fbshipit-source-id: 33711d7fb5666f0bac8aee444b71261f7f12770f
This commit is contained in:
parent
dd8231ad63
commit
06956e83cd
@ -18,6 +18,10 @@ const Platform = {
|
||||
const AndroidConstants = require('NativeModules').AndroidConstants;
|
||||
return AndroidConstants && AndroidConstants.Version;
|
||||
},
|
||||
get isTesting(): boolean {
|
||||
const constants = require('NativeModules').AndroidConstants;
|
||||
return constants && constants.isTesting;
|
||||
},
|
||||
select: (obj: Object) => obj.android,
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,8 @@ import javax.annotation.Nullable;
|
||||
@ReactModule(name = "AndroidConstants")
|
||||
public class AndroidInfoModule extends BaseJavaModule {
|
||||
|
||||
private static final String IS_TESTING = "IS_TESTING";
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AndroidConstants";
|
||||
@ -35,6 +37,7 @@ public class AndroidInfoModule extends BaseJavaModule {
|
||||
HashMap<String, Object> constants = new HashMap<>();
|
||||
constants.put("Version", Build.VERSION.SDK_INT);
|
||||
constants.put("ServerHost", AndroidInfoHelpers.getServerHost());
|
||||
constants.put("isTesting", "true".equals(System.getProperty(IS_TESTING)));
|
||||
return constants;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user