Use new status-go and rename NotifyUsers

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Pedro Pombeiro 2019-01-17 23:46:48 +01:00 committed by Andrea Maria Piana
parent 2b2c44c9a5
commit d3f1b37c12
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
15 changed files with 53 additions and 37 deletions

View File

@ -1 +1 @@
0.19.0-beta.1
0.19.0-beta.9

View File

@ -2,7 +2,7 @@ pipeline {
agent {
docker {
label 'linux'
image 'statusteam/status-build-android:1.0.0'
image 'statusteam/status-build-android:1.0.1'
args (
"-v /home/jenkins/tmp:/var/tmp:rw "+
"-v /home/jenkins/status-im.keystore:/tmp/status-im.keystore:ro"

View File

@ -12,7 +12,8 @@ COPY sdk-tools-linux-${ANDROID_SDK_VERSION}.zip /tmp/sdk-tools-linux.zip
RUN unzip -q /tmp/sdk-tools-linux.zip -d /usr/lib/android-sdk \
&& mkdir ~/.android && touch ~/.android/repositories.cfg \
&& yes | /usr/lib/android-sdk/tools/bin/sdkmanager --licenses > /dev/null \
&& for PKG in ${SDK_PACKAGES}; do /usr/lib/android-sdk/tools/bin/sdkmanager --install "${PKG}"; done \
&& for PKG in ${SDK_PACKAGES}; do \
yes | /usr/lib/android-sdk/tools/bin/sdkmanager --install "${PKG}" > /dev/null; done \
&& chmod 777 -R /usr/lib/android-sdk
# cleanup SDK
RUN cd /usr/lib/android-sdk \

View File

@ -12,7 +12,7 @@ ANDROID_SDK_URL = https://dl.google.com/android/repository/sdk-tools-linux-$(AND
ANDROID_SDK_ARCHIVE = sdk-tools-linux-$(ANDROID_SDK_VERSION).zip
# WARNING: Remember to change the tag when updating the image
IMAGE_TAG = 1.0.0
IMAGE_TAG = 1.0.1
IMAGE_NAME = statusteam/status-build-android:$(IMAGE_TAG)
build: $(ANDROID_NDK_ARCHIVE) $(ANDROID_SDK_ARCHIVE)

View File

@ -17,6 +17,7 @@ target 'StatusIm' do
pod 'react-native-background-timer', :path => '../node_modules/react-native-background-timer'
pod 'RNKeychain', :path => '../node_modules/react-native-keychain'
pod 'react-native-camera', path: '../node_modules/react-native-camera'
pod 'SQLCipher', '~>3.0'
target 'StatusImTests' do
inherit! :search_paths

View File

@ -70,6 +70,11 @@ PODS:
- yoga (= 0.56.0.React)
- RNKeychain (3.0.0-rc.3):
- React
- SQLCipher (3.4.2):
- SQLCipher/standard (= 3.4.2)
- SQLCipher/common (3.4.2)
- SQLCipher/standard (3.4.2):
- SQLCipher/common
- yoga (0.56.0.React)
DEPENDENCIES:
@ -79,6 +84,7 @@ DEPENDENCIES:
- react-native-background-timer (from `../node_modules/react-native-background-timer`)
- react-native-camera (from `../node_modules/react-native-camera`)
- RNKeychain (from `../node_modules/react-native-keychain`)
- SQLCipher (~> 3.0)
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
@ -92,6 +98,7 @@ SPEC REPOS:
- GoogleUtilities
- nanopb
- Protobuf
- SQLCipher
EXTERNAL SOURCES:
React:
@ -119,8 +126,9 @@ SPEC CHECKSUMS:
react-native-background-timer: bb7a98c8e97fc7c290de2d423dd09ddb73dcbcbb
react-native-camera: 68ad5143d2d0636236d46c7de8d2a6455ca52a36
RNKeychain: 627c6095cef215dd3d9804a9a9cf45ab96aa3997
SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990
yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85
PODFILE CHECKSUM: 7636f960a0dbec2dd55b8b20e244befa3fdb4438
PODFILE CHECKSUM: 7a7b07318fa8b5a77d7f71190a3536cf574273ed
COCOAPODS: 1.5.3

View File

@ -459,8 +459,8 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
}
@ReactMethod
public void notifyUsers(final String dataPayloadJSON, final String tokensJSON, final Callback callback) {
Log.d(TAG, "notifyUsers");
public void sendDataNotification(final String dataPayloadJSON, final String tokensJSON, final Callback callback) {
Log.d(TAG, "sendDataNotification");
if (!checkAvailability()) {
callback.invoke(false);
return;
@ -469,7 +469,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.NotifyUsers(dataPayloadJSON, tokensJSON);
String res = Statusgo.SendDataNotification(dataPayloadJSON, tokensJSON);
callback.invoke(res);
}

View File

@ -90,6 +90,7 @@ void RCTStatus::startNode(QString configString) {
}
QVariantMap configJSON = jsonDoc.toVariant().toMap();
QVariantMap shhextConfig = configJSON["ShhextConfig"].toMap();
qCDebug(RCTSTATUS) << "::startNode configString: " << configJSON;
int networkId = configJSON["NetworkId"].toInt();
@ -107,10 +108,12 @@ void RCTStatus::startNode(QString configString) {
d_gethLogFilePath = dataDir.absoluteFilePath("geth.log");
configJSON["DataDir"] = absDataDirPath;
configJSON["BackupDisabledDataDir"] = absDataDirPath;
configJSON["KeyStoreDir"] = rootDir.absoluteFilePath("keystore");
configJSON["LogFile"] = d_gethLogFilePath;
shhextConfig["BackupDisabledDataDir"] = absDataDirPath;
configJSON["ShhExtConfig"] = shhextConfig;
const QJsonDocument& updatedJsonDoc = QJsonDocument::fromVariant(configJSON);
qCInfo(RCTSTATUS) << "::startNode updated configString: " << updatedJsonDoc.toVariant().toMap();
const char* result = StartNode(QString(updatedJsonDoc.toJson(QJsonDocument::Compact)).toUtf8().data());
@ -136,12 +139,12 @@ void RCTStatus::createAccount(QString password, double callbackId) {
}
void RCTStatus::notifyUsers(QString dataPayloadJSON, QString tokensJSON, double callbackId) {
void RCTStatus::sendDataNotification(QString dataPayloadJSON, QString tokensJSON, double callbackId) {
Q_D(RCTStatus);
qCDebug(RCTSTATUS) << "::notifyUsers call - callbackId:" << callbackId;
qCDebug(RCTSTATUS) << "::sendDataNotification call - callbackId:" << callbackId;
QtConcurrent::run([&](QString dataPayloadJSON, QString tokensJSON, double callbackId) {
const char* result = NotifyUsers(dataPayloadJSON.toUtf8().data(), tokensJSON.toUtf8().data());
logStatusGoResult("::notifyUsers Notify", result);
const char* result = SendDataNotification(dataPayloadJSON.toUtf8().data(), tokensJSON.toUtf8().data());
logStatusGoResult("::sendDataNotification SendDataNotification", result);
d->bridge->invokePromiseCallback(callbackId, QVariantList{result});
}, dataPayloadJSON, tokensJSON, callbackId);
}

View File

@ -38,7 +38,7 @@ public:
Q_INVOKABLE void startNode(QString configString);
Q_INVOKABLE void stopNode();
Q_INVOKABLE void createAccount(QString password, double callbackId);
Q_INVOKABLE void notifyUsers(QString dataPayloadJSON, QString tokensJSON, double callbackId);
Q_INVOKABLE void sendDataNotification(QString dataPayloadJSON, QString tokensJSON, double callbackId);
Q_INVOKABLE void sendLogs(QString dbJSON);
Q_INVOKABLE void addPeer(QString enode, double callbackId);
Q_INVOKABLE void recoverAccount(QString passphrase, QString password, double callbackId);

View File

@ -183,15 +183,15 @@ RCT_EXPORT_METHOD(createAccount:(NSString *)password
}
////////////////////////////////////////////////////////////////////
#pragma mark - NotifyUsers method
//////////////////////////////////////////////////////////////////// notifyUsers
RCT_EXPORT_METHOD(notifyUsers:(NSString *)dataPayloadJSON
#pragma mark - SendDataNotification method
//////////////////////////////////////////////////////////////////// sendDataNotification
RCT_EXPORT_METHOD(sendDataNotification:(NSString *)dataPayloadJSON
tokensJSON:(NSString *)tokensJSON
callback:(RCTResponseSenderBlock)callback) {
char * result = NotifyUsers((char *) [dataPayloadJSON UTF8String], (char *) [tokensJSON UTF8String]);
char * result = SendDataNotification((char *) [dataPayloadJSON UTF8String], (char *) [tokensJSON UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
#if DEBUG
NSLog(@"NotifyUsers() method called");
NSLog(@"SendDataNotification() method called");
#endif
}

View File

@ -479,5 +479,5 @@
;; NOTE: react-native-firebase doesn't have a good implementation of sendMessage
;; (supporting e.g. priority or content_available properties),
;; therefore we must use an implementation in status-go.
(status/notify-users {:data-payload data-payload-json :tokens tokens-json}
#(log/debug "send-notification cb result: " %)))))
(status/send-data-notification {:data-payload data-payload-json :tokens tokens-json}
#(log/debug "send-data-notification cb result: " %)))))

View File

@ -51,8 +51,8 @@
(defn module-initialized! []
(native-module/module-initialized!))
(defn notify-users [m callback]
(native-module/notify-users m callback))
(defn send-data-notification [m callback]
(native-module/send-data-notification m callback))
(defn send-logs [dbJson]
(native-module/send-logs dbJson))

View File

@ -84,9 +84,9 @@
true)
false))))))
(defn notify-users [{:keys [data-payload tokens] :as m} on-result]
(defn send-data-notification [{:keys [data-payload tokens] :as m} on-result]
(when status
(call-module #(.notifyUsers status data-payload tokens on-result))))
(call-module #(.sendDataNotification status data-payload tokens on-result))))
(defn send-logs [dbJson]
(when status

View File

@ -57,8 +57,7 @@
(let [initial-props @(re-frame/subscribe [:initial-props])
status-node-port (get initial-props :STATUS_NODE_PORT)]
(cond-> (assoc config
:Name "StatusIM"
:BackupDisabledDataDir (utils.platform/no-backup-directory))
:Name "StatusIM")
config/dev-build?
(assoc :ListenAddr ":30304"
:DataDir (str (:DataDir config) "_dev"))
@ -111,15 +110,16 @@
:LightClient true
:MinimumPoW 0.001
:EnableNTPSync true}
:RequireTopics (get-topics network)
:InstallationID installation-id
:MailServerConfirmations config/mailserver-confirmations-enabled?
:PFSEnabled (or config/pfs-encryption-enabled?
;; We don't check dev-mode? here as
;; otherwise we would have to restart the node
;; when the user enables it
config/group-chats-enabled?
(config/pairing-enabled? true)))
:ShhextConfig {:BackupDisabledDataDir (utils.platform/no-backup-directory)
:InstallationID installation-id
:MailServerConfirmations config/mailserver-confirmations-enabled?
:PFSEnabled (or config/pfs-encryption-enabled?
;; We don't check dev-mode? here as
;; otherwise we would have to restart the node
;; when the user enables it
config/group-chats-enabled?
(config/pairing-enabled? true))}
:RequireTopics (get-topics network))
(and
config/bootnodes-settings-enabled?
@ -135,6 +135,8 @@
[db network]
(-> (get-in (:networks/networks db) [network :config])
(get-base-node-config)
(assoc :ShhextConfig {:BackupDisabledDataDir (utils.platform/no-backup-directory)})
(assoc :PFSEnabled false
:NoDiscovery true)
(add-log-level config/log-level-status-go)))

View File

@ -7,7 +7,8 @@
(-> config
:node/start
(js/JSON.parse)
(js->clj :keywordize-keys true)))
(js->clj :keywordize-keys true)
:ShhextConfig))
(deftest start-test
(let [address "a"