Use gomobile binaries for iOS and Android.

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
Adam Babik 2018-11-28 10:34:50 +01:00 committed by Igor Mandrigin
parent 852afa23cb
commit c47fc34127
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
10 changed files with 110 additions and 177 deletions

View File

@ -77,7 +77,7 @@ $(STATUS_GO_DRO_ARCH):
if [ $$? -ne 0 ]; then \
echo "Failed to download from DigitalOcean Bucket, checking GitHub..."; \
curl --fail --silent --location \
"$(GITHUB_URL)/$(STATUS_GO_VER)/status-go-android.aar" \
"$(GITHUB_URL)/download/$(STATUS_GO_VER)/status-go-android.aar" \
--output "$(STATUS_GO_DRO_ARCH)"; \
if [ $$? -ne 0 ]; then \
echo "Failed to download from GitHub!"; \

View File

@ -1 +1 @@
0.20.0-beta.0
0.21.0g-beta.2

View File

@ -59,7 +59,7 @@
"react-native-svg": "6.5.2",
"react-native-tcp": "git+https://github.com/status-im/react-native-tcp.git#v3.3.0-1-status",
"react-native-udp": "git+https://github.com/status-im/react-native-udp.git#2.3.1-1",
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#0.33.16-3-status",
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#0.33.16-4",
"react-navigation": "^2.12.1",
"realm": "2.21.0",
"rn-snoopy": "git+https://github.com/status-im/rn-snoopy.git#v2.0.2-status",

View File

@ -6059,9 +6059,9 @@ react-native-tab-view@^1.0.0:
ip-regex "^1.0.3"
util "^0.10.3"
"react-native-webview-bridge@git+https://github.com/status-im/react-native-webview-bridge.git#0.33.16-3-status":
"react-native-webview-bridge@git+https://github.com/status-im/react-native-webview-bridge.git#0.33.16-4":
version "0.33.16"
resolved "git+https://github.com/status-im/react-native-webview-bridge.git#2e1735a1d512ad7505e55b055e36b80bfe780ba6"
resolved "git+https://github.com/status-im/react-native-webview-bridge.git#db39ab2719dd0e0d33324643820619f3e75960b4"
dependencies:
invariant "2.2.0"
keymirror "0.1.1"

View File

@ -24,7 +24,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.github.status_im.status_go.Statusgo;
import statusgo.SignalHandler;
import statusgo.Statusgo;
import org.json.JSONException;
import org.json.JSONObject;
@ -48,7 +50,7 @@ import java.util.zip.ZipOutputStream;
import javax.annotation.Nullable;
class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventListener, StatusNodeEventHandler {
class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventListener, SignalHandler {
private static final String TAG = "StatusModule";
private static final String logsZipFileName = "Status-debug-logs.zip";
@ -74,7 +76,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
@Override
public void onHostResume() { // Activity `onResume`
module = this;
StatusService.INSTANCE.setSignalEventListener(this);
Statusgo.setMobileSignalHandler(this);
}
@Override
@ -97,9 +99,8 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
}
@Override
public void handleEvent(String jsonEvent) {
Log.d(TAG, "[handleEvent] event: " + jsonEvent);
public void handleSignal(String jsonEvent) {
Log.d(TAG, "Signal event: " + jsonEvent);
WritableMap params = Arguments.createMap();
params.putString("jsonEvent", jsonEvent);
this.getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("gethEvent", params);
@ -242,7 +243,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
prettyPrintConfig(updatedJsonConfigString);
String res = Statusgo.StartNode(updatedJsonConfigString);
String res = Statusgo.startNode(updatedJsonConfigString);
if (res.startsWith("{\"error\":\"\"")) {
Log.d(TAG, "StartNode result: " + res);
Log.d(TAG, "Geth node started");
@ -361,7 +362,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
@Override
public void run() {
Log.d(TAG, "stopNode");
String res = Statusgo.StopNode();
String res = Statusgo.stopNode();
}
};
@ -379,7 +380,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String result = Statusgo.Login(address, password);
String result = Statusgo.login(address, password);
callback.invoke(result);
}
@ -404,7 +405,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String result = Statusgo.VerifyAccountPassword(newKeystoreDir, address, password);
String result = Statusgo.verifyAccountPassword(newKeystoreDir, address, password);
callback.invoke(result);
}
@ -424,7 +425,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String result = Statusgo.LoginWithKeycard(whisperPrivateKey, encryptionPublicKey);
String result = Statusgo.loginWithKeycard(whisperPrivateKey, encryptionPublicKey);
callback.invoke(result);
}
@ -444,7 +445,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.CreateAccount(password);
String res = Statusgo.createAccount(password);
callback.invoke(res);
}
@ -464,8 +465,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.SendDataNotification(dataPayloadJSON, tokensJSON);
String res = Statusgo.sendDataNotification(dataPayloadJSON, tokensJSON);
callback.invoke(res);
}
};
@ -634,7 +634,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.AddPeer(enode);
String res = Statusgo.addPeer(enode);
callback.invoke(res);
}
@ -654,7 +654,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.RecoverAccount(password, passphrase);
String res = Statusgo.recoverAccount(password, passphrase);
callback.invoke(res);
}
@ -678,7 +678,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.SendTransaction(txArgsJSON, password);
String res = Statusgo.sendTransaction(txArgsJSON, password);
callback.invoke(res);
}
};
@ -697,7 +697,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.SignMessage(rpcParams);
String res = Statusgo.signMessage(rpcParams);
callback.invoke(res);
}
};
@ -795,7 +795,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.CallRPC(payload);
String res = Statusgo.callRPC(payload);
callback.invoke(res);
}
};
@ -808,7 +808,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.CallPrivateRPC(payload);
String res = Statusgo.callPrivateRPC(payload);
callback.invoke(res);
}
};
@ -824,13 +824,13 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
@ReactMethod
public void connectionChange(final String type, final boolean isExpensive) {
Log.d(TAG, "ConnectionChange: " + type + ", is expensive " + isExpensive);
Statusgo.ConnectionChange(type, isExpensive ? 1 : 0);
Statusgo.connectionChange(type, isExpensive ? 1 : 0);
}
@ReactMethod
public void appStateChange(final String type) {
Log.d(TAG, "AppStateChange: " + type);
Statusgo.AppStateChange(type);
Statusgo.appStateChange(type);
}
private static String uniqueID = null;
@ -867,7 +867,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String result = Statusgo.ExtractGroupMembershipSignatures(signaturePairs);
String result = Statusgo.extractGroupMembershipSignatures(signaturePairs);
callback.invoke(result);
}
@ -887,7 +887,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String result = Statusgo.SignGroupMembership(content);
String result = Statusgo.signGroupMembership(content);
callback.invoke(result);
}
@ -907,7 +907,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String result = Statusgo.EnableInstallation(installationId);
String result = Statusgo.enableInstallation(installationId);
callback.invoke(result);
}
@ -927,7 +927,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String result = Statusgo.DisableInstallation(installationId);
String result = Statusgo.disableInstallation(installationId);
callback.invoke(result);
}
@ -947,7 +947,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.UpdateMailservers(enodes);
String res = Statusgo.updateMailservers(enodes);
callback.invoke(res);
}

View File

@ -1,5 +0,0 @@
package im.status.ethereum.module;
public interface StatusNodeEventHandler {
void handleEvent(String eventJson);
}

View File

@ -5,12 +5,12 @@ import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.github.status_im.status_go.Statusgo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import im.status.ethereum.function.Function;
import statusgo.Statusgo;
public class StatusPackage implements ReactPackage {
@ -22,12 +22,8 @@ public class StatusPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
System.loadLibrary("statusgoraw");
System.loadLibrary("statusgo");
modules.add(new StatusModule(reactContext, this.rootedDevice));
return modules;
NativeModule statusModule = new StatusModule(reactContext, this.rootedDevice);
return Collections.singletonList(statusModule);
}
@Override
@ -39,7 +35,7 @@ public class StatusPackage implements ReactPackage {
return new Function<String, String>() {
@Override
public String apply(String payload) {
return Statusgo.CallRPC(payload);
return Statusgo.callRPC(payload);
}
};
}

View File

@ -1,63 +0,0 @@
package im.status.ethereum.module;
import android.app.Service;
import android.content.Intent;
import android.os.*;
import android.support.annotation.Nullable;
import android.util.Log;
import java.util.concurrent.CountDownLatch;
import java.lang.ref.WeakReference;
/**
* StatusService has nothing to do with Android services anymore.
* The name "StatusService" is kept to keep backward compatibility with status-go.
* Hopefully, it will be replaced when GoMobile
*/
public class StatusService {
static final StatusService INSTANCE = new StatusService();
private static final String TAG = "StatusService";
/**
* signalEvent is called by Statusgo JNI module to pass events from the node.
* @param jsonEvent
*/
public static void signalEvent(String jsonEvent) {
Log.d(TAG, "[signalEvent] event: " + jsonEvent);
StatusNodeEventHandler listener = StatusService.INSTANCE.getSignalEventListener();
if (listener == null) {
Log.w(TAG, "[signalEvent] no listener is set (module is missing?) ignoring event: " + jsonEvent);
return;
}
Log.d(TAG, "[signalEvent] passing event to the listener: " + jsonEvent);
listener.handleEvent(jsonEvent);
}
private StatusNodeEventHandler signalEventListener;
void setSignalEventListener(StatusNodeEventHandler listener) {
Log.d(TAG, "[setSignalEventListener], setting listener to: " + this.safeClassName(listener));
this.signalEventListener = listener;
}
private String safeClassName(Object object) {
if (object == null) {
return "null";
}
if (object.getClass() == null) {
return "<unknown object>";
}
return object.getClass().getCanonicalName();
}
private StatusNodeEventHandler getSignalEventListener() {
return this.signalEventListener;
}
}

View File

@ -1,10 +1,8 @@
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
#import "Statusgo/Statusgo.h"
#import "RCTLog.h"
@interface Status : NSObject <RCTBridgeModule>
+ (void)signalEvent:(const char *)signal;
+ (void)jailEvent:(NSString *)chatId
data:(NSString *)data;
+ (BOOL)JSCEnabled;
@interface Status : NSObject <RCTBridgeModule, StatusgoSignalHandler>
- (void)handleSignal:(NSString *)signal;
@end

View File

@ -2,7 +2,7 @@
#import "ReactNativeConfig.h"
#import "React/RCTBridge.h"
#import "React/RCTEventDispatcher.h"
#import <Statusgo/Statusgo.h>
#import "Statusgo/Statusgo.h"
@interface NSDictionary (BVJSONString)
-(NSString*) bv_jsonStringWithPrettyPrint:(BOOL) prettyPrint;
@ -45,9 +45,18 @@
}
@end
static bool isStatusInitialized;
static RCTBridge *bridge;
@implementation Status{
@implementation Status
- (instancetype)init {
self = [super init];
if (!self) {
return nil;
}
// Subscribing to the signals from Status-Go
StatusgoSetMobileSignalHandler(self);
return self;
}
-(RCTBridge *)bridge
@ -60,6 +69,25 @@ static RCTBridge *bridge;
bridge = newBridge;
}
- (void)handleSignal:(NSString *)signal
{
if(!signal){
#if DEBUG
NSLog(@"SignalEvent nil");
#endif
return;
}
#if DEBUG
NSLog(@"[handleSignal] Received an event from Status-Go: %@", signal);
#endif
[bridge.eventDispatcher sendAppEventWithName:@"gethEvent"
body:@{@"jsonEvent": signal}];
return;
}
RCT_EXPORT_MODULE();
////////////////////////////////////////////////////////////////////
@ -69,6 +97,7 @@ RCT_EXPORT_METHOD(startNode:(NSString *)configString) {
#if DEBUG
NSLog(@"StartNode() method called");
#endif
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error = nil;
NSURL *rootUrl =[[fileManager
@ -134,8 +163,8 @@ RCT_EXPORT_METHOD(startNode:(NSString *)configString) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^(void)
{
char *res = StartNode((char *) [resultingConfig UTF8String]);
NSLog(@"StartNode result %@", [NSString stringWithUTF8String: res]);
NSString *res = StatusgoStartNode(resultingConfig);
NSLog(@"StartNode result %@", res);
});
}
@ -165,8 +194,8 @@ RCT_EXPORT_METHOD(stopNode) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^(void)
{
char *res = StopNode();
NSLog(@"StopNode result %@", [NSString stringWithUTF8String: res]);
NSString *res = StatusgoStopNode();
NSLog(@"StopNode result %@", res);
});
}
@ -178,8 +207,8 @@ RCT_EXPORT_METHOD(createAccount:(NSString *)password
#if DEBUG
NSLog(@"CreateAccount() method called");
#endif
char * result = CreateAccount((char *) [password UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoCreateAccount(password);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -188,8 +217,8 @@ RCT_EXPORT_METHOD(createAccount:(NSString *)password
RCT_EXPORT_METHOD(sendDataNotification:(NSString *)dataPayloadJSON
tokensJSON:(NSString *)tokensJSON
callback:(RCTResponseSenderBlock)callback) {
char * result = SendDataNotification((char *) [dataPayloadJSON UTF8String], (char *) [tokensJSON UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString* result = StatusgoSendDataNotification(dataPayloadJSON, tokensJSON);
callback(@[result]);
#if DEBUG
NSLog(@"SendDataNotification() method called");
#endif
@ -208,8 +237,8 @@ RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson) {
//////////////////////////////////////////////////////////////////// addPeer
RCT_EXPORT_METHOD(addPeer:(NSString *)enode
callback:(RCTResponseSenderBlock)callback) {
char * result = AddPeer((char *) [enode UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoAddPeer(enode);
callback(@[result]);
#if DEBUG
NSLog(@"AddPeer() method called");
#endif
@ -218,8 +247,8 @@ RCT_EXPORT_METHOD(addPeer:(NSString *)enode
//////////////////////////////////////////////////////////////////// updateMailservers
RCT_EXPORT_METHOD(updateMailservers:(NSString *)enodes
callback:(RCTResponseSenderBlock)callback) {
char * result = UpdateMailservers((char *) [enodes UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString* result = StatusgoUpdateMailservers(enodes);
callback(@[result]);
#if DEBUG
NSLog(@"UpdateMailservers() method called");
#endif
@ -232,8 +261,8 @@ RCT_EXPORT_METHOD(recoverAccount:(NSString *)passphrase
#if DEBUG
NSLog(@"RecoverAccount() method called");
#endif
char * result = RecoverAccount((char *) [password UTF8String], (char *) [passphrase UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoRecoverAccount(password, passphrase);
callback(@[result]);
}
//////////////////////////////////////////////////////////////////// login
@ -243,8 +272,8 @@ RCT_EXPORT_METHOD(login:(NSString *)address
#if DEBUG
NSLog(@"Login() method called");
#endif
char * result = Login((char *) [address UTF8String], (char *) [password UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoLogin(address, password);
callback(@[result]);
}
//////////////////////////////////////////////////////////////////// login
@ -260,10 +289,8 @@ RCT_EXPORT_METHOD(verify:(NSString *)address
lastObject];
NSURL *absKeystoreUrl = [rootUrl URLByAppendingPathComponent:@"keystore"];
char * result = VerifyAccountPassword((char *) [absKeystoreUrl.path UTF8String],
(char *) [address UTF8String],
(char *) [password UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoVerifyAccountPassword(absKeystoreUrl.path, address, password);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -275,8 +302,8 @@ RCT_EXPORT_METHOD(sendTransaction:(NSString *)txArgsJSON
#if DEBUG
NSLog(@"SendTransaction() method called");
#endif
char * result = SendTransaction((char *) [txArgsJSON UTF8String], (char *) [password UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoSendTransaction(txArgsJSON, password);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -287,8 +314,8 @@ RCT_EXPORT_METHOD(signMessage:(NSString *)message
#if DEBUG
NSLog(@"SignMessage() method called");
#endif
char * result = SignMessage((char *) [message UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoSignMessage(message);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -299,8 +326,8 @@ RCT_EXPORT_METHOD(signGroupMembership:(NSString *)content
#if DEBUG
NSLog(@"SignGroupMembership() method called");
#endif
char * result = SignGroupMembership((char *) [content UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoSignGroupMembership(content);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -311,8 +338,8 @@ RCT_EXPORT_METHOD(extractGroupMembershipSignatures:(NSString *)content
#if DEBUG
NSLog(@"ExtractGroupMembershipSignatures() method called");
#endif
char * result = ExtractGroupMembershipSignatures((char *) [content UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoExtractGroupMembershipSignatures(content);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -323,8 +350,8 @@ RCT_EXPORT_METHOD(enableInstallation:(NSString *)content
#if DEBUG
NSLog(@"EnableInstallation() method called");
#endif
char * result = EnableInstallation((char *) [content UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoEnableInstallation(content);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -335,8 +362,8 @@ RCT_EXPORT_METHOD(disableInstallation:(NSString *)content
#if DEBUG
NSLog(@"DisableInstallation() method called");
#endif
char * result = DisableInstallation((char *) [content UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoDisableInstallation(content);
callback(@[result]);
}
////////////////////////////////////////////////////////////////////
@ -383,9 +410,9 @@ RCT_EXPORT_METHOD(clearStorageAPIs) {
RCT_EXPORT_METHOD(callRPC:(NSString *)payload
callback:(RCTResponseSenderBlock)callback) {
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
char * result = CallRPC((char *) [payload UTF8String]);
dispatch_async( dispatch_get_main_queue(), ^{
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoCallRPC(payload);
dispatch_async(dispatch_get_main_queue(), ^{
callback(@[result]);
});
});
}
@ -393,9 +420,9 @@ RCT_EXPORT_METHOD(callRPC:(NSString *)payload
RCT_EXPORT_METHOD(callPrivateRPC:(NSString *)payload
callback:(RCTResponseSenderBlock)callback) {
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
char * result = CallPrivateRPC((char *) [payload UTF8String]);
dispatch_async( dispatch_get_main_queue(), ^{
callback(@[[NSString stringWithUTF8String: result]]);
NSString *result = StatusgoCallPrivateRPC(payload);
dispatch_async(dispatch_get_main_queue(), ^{
callback(@[result]);
});
});
}
@ -410,14 +437,14 @@ RCT_EXPORT_METHOD(connectionChange:(NSString *)type
#if DEBUG
NSLog(@"ConnectionChange() method called");
#endif
ConnectionChange((char *) [type UTF8String], isExpensive? 1 : 0);
StatusgoConnectionChange(type, isExpensive ? 1 : 0);
}
RCT_EXPORT_METHOD(appStateChange:(NSString *)type) {
#if DEBUG
NSLog(@"AppStateChange() method called");
#endif
AppStateChange((char *) [type UTF8String]);
StatusgoAppStateChange(type);
}
RCT_EXPORT_METHOD(getDeviceUUID:(RCTResponseSenderBlock)callback) {
@ -429,26 +456,6 @@ RCT_EXPORT_METHOD(getDeviceUUID:(RCTResponseSenderBlock)callback) {
callback(@[Identifier]);
}
+ (void)signalEvent:(const char *) signal
{
if(!signal){
#if DEBUG
NSLog(@"SignalEvent nil");
#endif
return;
}
NSString *sig = [NSString stringWithUTF8String:signal];
#if DEBUG
NSLog(@"SignalEvent");
NSLog(sig);
#endif
[bridge.eventDispatcher sendAppEventWithName:@"gethEvent"
body:@{@"jsonEvent": sig}];
return;
}
- (bool) is24Hour
{
NSString *format = [NSDateFormatter dateFormatFromTemplate:@"j" options:0 locale:[NSLocale currentLocale]];