Offline inboxing: integrate AddPeer binding

- Add add-peer call to IReactNativeStatus
- Upgrade status-go
- Bindings for addEnode(enode string) in Java and ObjC
This commit is contained in:
Oskar Thoren 2017-12-05 11:18:30 +01:00
parent 5ef8ea4c0c
commit 6d5251ad20
No known key found for this signature in database
GPG Key ID: 5128AB0637CD85AF
8 changed files with 43 additions and 2 deletions

View File

@ -17,5 +17,5 @@ dependencies {
compile 'com.instabug.library:instabug:3+'
compile 'com.github.ericwlange:AndroidJSCore:3.0.1'
compile 'status-im:function:0.0.1'
compile(group: 'status-im', name: 'status-go', version: 'develop-g6927638', ext: 'aar')
compile(group: 'status-im', name: 'status-go', version: 'develop-g5446a090', ext: 'aar')
}

View File

@ -403,6 +403,27 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
thread.start();
}
@ReactMethod
public void addPeer(final String enode, final Callback callback) {
Log.d(TAG, "addPeer");
if (!checkAvailability()) {
callback.invoke(false);
return;
}
Thread thread = new Thread() {
@Override
public void run() {
String res = Statusgo.Notify(enode);
callback.invoke(res);
}
};
thread.start();
}
@ReactMethod
public void recoverAccount(final String passphrase, final String password, final Callback callback) {
Log.d(TAG, "recoverAccount");

View File

@ -289,6 +289,15 @@ RCT_EXPORT_METHOD(notify:(NSString *)token
#endif
}
//////////////////////////////////////////////////////////////////// addPeer
RCT_EXPORT_METHOD(addPeer:(NSString *)enode
callback:(RCTResponseSenderBlock)callback) {
char * result = AddPeer((char *) [enode UTF8String]);
callback(@[[NSString stringWithUTF8String: result]]);
#if DEBUG
NSLog(@"AddPeer() method called");
#endif
}
//////////////////////////////////////////////////////////////////// recoverAccount
RCT_EXPORT_METHOD(recoverAccount:(NSString *)passphrase

View File

@ -25,7 +25,7 @@
<artifactItem>
<groupId>status-im</groupId>
<artifactId>status-go-ios-simulator</artifactId>
<version>develop-g6927638</version>
<version>develop-g5446a090</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>./</outputDirectory>

View File

@ -87,5 +87,8 @@
(defn notify [token callback]
(module-interface/-notify rns-module token callback))
(defn add-peer [enode callback]
(module-interface/-add-peer rns-module enode callback))
(defn close-application []
(module-interface/-close-application rns-module))

View File

@ -108,6 +108,10 @@
(when status
(call-module #(.notify status token on-result))))
(defn add-peer [enode on-result]
(when status
(call-module #(.addPeer status enode on-result))))
(defn recover-account [passphrase password on-result]
(when status
(call-module #(.recoverAccount status passphrase password on-result))))
@ -252,6 +256,8 @@
(call-web3 payload callback))
(-notify [this token callback]
(notify token callback))
(-add-peer [this enode callback]
(add-peer enode callback))
;; other calls
(-move-to-internal-storage [this callback]

View File

@ -59,4 +59,5 @@
(-should-move-to-internal-storage? [this callback]
(impl/should-move-to-internal-storage? callback))
(-notify [this token callback])
(-add-peer [this enode callback])
(-close-application [this]))

View File

@ -19,5 +19,6 @@
(-module-initialized! [this])
(-should-move-to-internal-storage? [this callback])
(-notify [this token callback])
(-add-peer [this enode callback])
(-close-application [this]))