Copy on stack status-go signal data

This commit is contained in:
Max Risuhin 2018-08-16 22:51:48 +03:00
parent 672e8255c4
commit 2b6d6722b7
No known key found for this signature in database
GPG Key ID: BF733F5ACA0B4448
3 changed files with 16 additions and 16 deletions

View File

@ -37,7 +37,7 @@ ExternalProject_Add(StatusGo_ep
PREFIX ${StatusGo_PREFIX} PREFIX ${StatusGo_PREFIX}
SOURCE_DIR ${StatusGo_SOURCE_DIR} SOURCE_DIR ${StatusGo_SOURCE_DIR}
GIT_REPOSITORY https://github.com/status-im/status-go.git GIT_REPOSITORY https://github.com/status-im/status-go.git
GIT_TAG 03bf6e37 GIT_TAG develop-ga6d69eba
BUILD_BYPRODUCTS ${StatusGo_STATIC_LIB} BUILD_BYPRODUCTS ${StatusGo_STATIC_LIB}
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${CONFIGURE_SCRIPT} ${GO_ROOT_PATH} ${StatusGo_ROOT} ${StatusGo_SOURCE_DIR} CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${CONFIGURE_SCRIPT} ${GO_ROOT_PATH} ${StatusGo_ROOT} ${StatusGo_SOURCE_DIR}
BUILD_COMMAND "" BUILD_COMMAND ""

View File

@ -40,8 +40,8 @@ RCTStatus* RCTStatusPrivate::rctStatus = nullptr;
RCTStatus::RCTStatus(QObject* parent) : QObject(parent), d_ptr(new RCTStatusPrivate) { RCTStatus::RCTStatus(QObject* parent) : QObject(parent), d_ptr(new RCTStatusPrivate) {
RCTStatusPrivate::rctStatus = this; RCTStatusPrivate::rctStatus = this;
SetSignalEventCallback((void*)&RCTStatus::jailSignalEventCallback); SetSignalEventCallback((void*)&RCTStatus::statusGoEventCallback);
connect(this, &RCTStatus::jailSignalEvent, this, &RCTStatus::onJailSignalEvent); connect(this, &RCTStatus::statusGoEvent, this, &RCTStatus::onStatusGoEvent);
} }
RCTStatus::~RCTStatus() {} RCTStatus::~RCTStatus() {}
@ -241,17 +241,17 @@ bool RCTStatus::JSCEnabled() {
return false; return false;
} }
void RCTStatus::jailSignalEventCallback(const char* signal) { void RCTStatus::statusGoEventCallback(const char* event) {
qDebug() << "call of RCTStatus::jailSignalEventCallback ... signal: " << signal; qDebug() << "call of RCTStatus::statusGoEventCallback ... event: " << event;
RCTStatusPrivate::rctStatus->emitSignalEvent(signal); RCTStatusPrivate::rctStatus->emitStatusGoEvent(event);
} }
void RCTStatus::emitSignalEvent(const char* signal) { void RCTStatus::emitStatusGoEvent(QString event) {
qDebug() << "call of RCTStatus::emitSignalEvent ... signal: " << signal; qDebug() << "call of RCTStatus::emitStatusGoEvent ... event: " << event;
Q_EMIT jailSignalEvent(signal); Q_EMIT statusGoEvent(event);
} }
void RCTStatus::onJailSignalEvent(const char* signal) { void RCTStatus::onStatusGoEvent(QString event) {
qDebug() << "call of RCTStatus::onJailSignalEvent ... signal: " << signal; qDebug() << "call of RCTStatus::onStatusGoEvent ... event: " << event.toUtf8().data();
RCTStatusPrivate::bridge->eventDispatcher()->sendDeviceEvent("gethEvent", QVariantMap{{"jsonEvent", signal}}); RCTStatusPrivate::bridge->eventDispatcher()->sendDeviceEvent("gethEvent", QVariantMap{{"jsonEvent", event.toUtf8().data()}});
} }

View File

@ -56,15 +56,15 @@ public:
Q_INVOKABLE void getDeviceUUID(double callbackId); Q_INVOKABLE void getDeviceUUID(double callbackId);
Q_INVOKABLE static bool JSCEnabled(); Q_INVOKABLE static bool JSCEnabled();
Q_INVOKABLE static void jailSignalEventCallback(const char* signal); Q_INVOKABLE static void statusGoEventCallback(const char* event);
void emitSignalEvent(const char* signal); void emitStatusGoEvent(QString event);
Q_SIGNALS: Q_SIGNALS:
void jailSignalEvent(const char* signal); void statusGoEvent(QString event);
private Q_SLOTS: private Q_SLOTS:
void onJailSignalEvent(const char* signal); void onStatusGoEvent(QString event);
private: private:
QScopedPointer<RCTStatusPrivate> d_ptr; QScopedPointer<RCTStatusPrivate> d_ptr;