chore: wire up `startSearchForLocalPairingPeers` (#16803)
This commit initialises the status-go method `startSearchForLocalPairingPeers` which in turn will produce logs that are important for peer discovery while local pairing and will produce logs important to detect local pairing crashes.
This commit is contained in:
parent
a8303dbe50
commit
1c405d3ed9
|
@ -823,6 +823,11 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
executeRunnableStatusGoMethod(() -> Statusgo.hashMessage(message), callback);
|
executeRunnableStatusGoMethod(() -> Statusgo.hashMessage(message), callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void startSearchForLocalPairingPeers(final Callback callback) throws JSONException {
|
||||||
|
executeRunnableStatusGoMethod(() -> Statusgo.startSearchForLocalPairingPeers(), callback);
|
||||||
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void getConnectionStringForBootstrappingAnotherDevice(final String configJSON, final Callback callback) throws JSONException {
|
public void getConnectionStringForBootstrappingAnotherDevice(final String configJSON, final Callback callback) throws JSONException {
|
||||||
final JSONObject jsonConfig = new JSONObject(configJSON);
|
final JSONObject jsonConfig = new JSONObject(configJSON);
|
||||||
|
@ -1172,19 +1177,19 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
executeRunnableStatusGoMethod(() -> Statusgo.deleteImportedKey(address, password, keyStoreDir), callback);
|
executeRunnableStatusGoMethod(() -> Statusgo.deleteImportedKey(address, password, keyStoreDir), callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||||
public String keystoreDir() {
|
public String keystoreDir() {
|
||||||
final String absRootDirPath = this.getNoBackupDirectory();
|
final String absRootDirPath = this.getNoBackupDirectory();
|
||||||
return pathCombine(absRootDirPath, "keystore");
|
return pathCombine(absRootDirPath, "keystore");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||||
public String backupDisabledDataDir() {
|
public String backupDisabledDataDir() {
|
||||||
return this.getNoBackupDirectory();
|
return this.getNoBackupDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||||
public String logFileDirectory() {
|
public String logFileDirectory() {
|
||||||
return getPublicStorageDirectory().getAbsolutePath();
|
return getPublicStorageDirectory().getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,6 +312,11 @@ RCT_EXPORT_METHOD(localPairingPreflightOutboundCheck:(RCTResponseSenderBlock)cal
|
||||||
callback(@[result]);
|
callback(@[result]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_METHOD(startSearchForLocalPairingPeers:callback:(RCTResponseSenderBlock)callback) {
|
||||||
|
NSString *result = StatusgoStartSearchForLocalPairingPeers();
|
||||||
|
callback(@[result]);
|
||||||
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(getConnectionStringForBootstrappingAnotherDevice:(NSString *)configJSON
|
RCT_EXPORT_METHOD(getConnectionStringForBootstrappingAnotherDevice:(NSString *)configJSON
|
||||||
callback:(RCTResponseSenderBlock)callback) {
|
callback:(RCTResponseSenderBlock)callback) {
|
||||||
|
|
||||||
|
|
|
@ -258,6 +258,13 @@
|
||||||
(log/debug "[native-module] hash-message")
|
(log/debug "[native-module] hash-message")
|
||||||
(.hashMessage ^js (status) message callback))
|
(.hashMessage ^js (status) message callback))
|
||||||
|
|
||||||
|
(defn start-searching-for-local-pairing-peers
|
||||||
|
"starts a UDP multicast beacon that both listens for and broadcasts to LAN peers"
|
||||||
|
[callback]
|
||||||
|
(log/info "[native-module] Start Searching for Local Pairing Peers"
|
||||||
|
{:fn :start-searching-for-local-pairing-peers})
|
||||||
|
(.startSearchForLocalPairingPeers ^js (status) callback))
|
||||||
|
|
||||||
(defn local-pairing-preflight-outbound-check
|
(defn local-pairing-preflight-outbound-check
|
||||||
"Checks whether the device has allows connecting to the local server"
|
"Checks whether the device has allows connecting to the local server"
|
||||||
[callback]
|
[callback]
|
||||||
|
|
|
@ -210,7 +210,9 @@
|
||||||
(js/setTimeout #(-> (.getInitialURL ^js react/linking)
|
(js/setTimeout #(-> (.getInitialURL ^js react/linking)
|
||||||
(.then dispatch-url))
|
(.then dispatch-url))
|
||||||
200)
|
200)
|
||||||
(.addEventListener ^js react/linking "url" url-event-listener))
|
(.addEventListener ^js react/linking "url" url-event-listener)
|
||||||
|
(native-module/start-searching-for-local-pairing-peers
|
||||||
|
#(log/info "[local-pairing] errors from local-pairing-preflight-outbound-check ->" %)))
|
||||||
|
|
||||||
(defn finalize
|
(defn finalize
|
||||||
"Remove event listener for url"
|
"Remove event listener for url"
|
||||||
|
|
Loading…
Reference in New Issue