add ETHEREUM_DEV_CLUSTER flag
This commit is contained in:
parent
71a3cda5d5
commit
f4082951b7
1
.env
1
.env
|
@ -3,3 +3,4 @@ NOTIFICATIONS_WIP_ENABLED=1
|
|||
DEBUG_LOGS_ENABLED=1
|
||||
STUB_STATUS_GO=0
|
||||
NETWORK_SWITCHING=1
|
||||
ETHEREUM_DEV_CLUSTER=1
|
||||
|
|
|
@ -3,3 +3,4 @@ NOTIFICATIONS_WIP_ENABLED=1
|
|||
DEBUG_LOGS_ENABLED=1
|
||||
STUB_STATUS_GO=0
|
||||
NETWORK_SWITCHING=1
|
||||
ETHEREUM_DEV_CLUSTER=1
|
||||
|
|
|
@ -2,4 +2,5 @@ TESTFAIRY_ENABLED=0
|
|||
NOTIFICATIONS_WIP_ENABLED=1
|
||||
DEBUG_LOGS_ENABLED=0
|
||||
STUB_STATUS_GO=0
|
||||
NETWORK_SWITCHING=0
|
||||
NETWORK_SWITCHING=0
|
||||
ETHEREUM_DEV_CLUSTER=0
|
||||
|
|
|
@ -44,7 +44,12 @@ public class MainApplication extends MultiDexApplication implements ReactApplica
|
|||
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
StatusPackage statusPackage = new StatusPackage(BuildConfig.DEBUG);
|
||||
boolean devCluster = false;
|
||||
if (BuildConfig.ETHEREUM_DEV_CLUSTER == "1") {
|
||||
devCluster = true;
|
||||
}
|
||||
|
||||
StatusPackage statusPackage = new StatusPackage(BuildConfig.DEBUG, devCluster);
|
||||
Function<String, String> callRPC = statusPackage.getCallRPC();
|
||||
List<ReactPackage> packages = new ArrayList<ReactPackage>(Arrays.asList(
|
||||
new MainReactPackage(),
|
||||
|
|
|
@ -38,13 +38,15 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
|||
private ServiceConnector status = null;
|
||||
private ExecutorService executor = null;
|
||||
private boolean debug;
|
||||
private boolean devCluster;
|
||||
|
||||
StatusModule(ReactApplicationContext reactContext, boolean debug) {
|
||||
StatusModule(ReactApplicationContext reactContext, boolean debug, boolean devCluster) {
|
||||
super(reactContext);
|
||||
if (executor == null) {
|
||||
executor = Executors.newCachedThreadPool();
|
||||
}
|
||||
this.debug = debug;
|
||||
this.devCluster = devCluster;
|
||||
reactContext.addLifecycleEventListener(this);
|
||||
}
|
||||
|
||||
|
@ -160,7 +162,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
|||
}
|
||||
|
||||
int dev = 0;
|
||||
if (this.debug) {
|
||||
if (this.devCluster) {
|
||||
dev = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,11 @@ import im.status.ethereum.function.Function;
|
|||
public class StatusPackage implements ReactPackage {
|
||||
|
||||
private boolean debug;
|
||||
private boolean devCluster;
|
||||
|
||||
public StatusPackage (boolean debug) {
|
||||
public StatusPackage (boolean debug, boolean devCluster) {
|
||||
this.debug = debug;
|
||||
this.devCluster = devCluster;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +27,7 @@ public class StatusPackage implements ReactPackage {
|
|||
List<NativeModule> modules = new ArrayList<>();
|
||||
System.loadLibrary("statusgoraw");
|
||||
System.loadLibrary("statusgo");
|
||||
modules.add(new StatusModule(reactContext, this.debug));
|
||||
modules.add(new StatusModule(reactContext, this.debug, this.devCluster));
|
||||
|
||||
return modules;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#import "RCTStatus.h"
|
||||
#import "ReactNativeConfig.h"
|
||||
#import "React/RCTBridge.h"
|
||||
#import "React/RCTEventDispatcher.h"
|
||||
#import <Statusgo/Statusgo.h>
|
||||
|
@ -152,11 +153,11 @@ RCT_EXPORT_METHOD(startNode:(NSString *)configString) {
|
|||
NSString *dataDir = [configJSON objectForKey:@"DataDir"];
|
||||
NSString *upstreamURL = [configJSON valueForKeyPath:@"UpstreamConfig.URL"];
|
||||
NSString *networkDir = [rootUrl.path stringByAppendingString:dataDir];
|
||||
#ifdef DEBUG
|
||||
int dev = 1;
|
||||
#else
|
||||
NSString *devCluster = [ReactNativeConfig envFor:@"ETHEREUM_DEV_CLUSTER"];
|
||||
int dev = 0;
|
||||
#endif
|
||||
if([devCluster isEqualToString:@"1"]){
|
||||
dev = 1;
|
||||
}
|
||||
char *configChars = GenerateConfig((char *)[networkDir UTF8String], networkId, dev);
|
||||
NSString *config = [NSString stringWithUTF8String: configChars];
|
||||
configData = [config dataUsingEncoding:NSUTF8StringEncoding];
|
||||
|
|
|
@ -243,6 +243,7 @@
|
|||
"$(inherited)",
|
||||
"$(SRCROOT)/../../../../node_modules/React/**",
|
||||
"$(SRCROOT)/../../../../node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../../../../node_modules/react-native-config/ios/ReactNativeConfig",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
|
@ -271,6 +272,7 @@
|
|||
"$(inherited)",
|
||||
"$(SRCROOT)/../../../../node_modules/React/**",
|
||||
"$(SRCROOT)/../../../../node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../../../../node_modules/react-native-config/ios/ReactNativeConfig",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
|
|
Loading…
Reference in New Issue