Upgrade status-go and turn chaos mode on

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Andrea Maria Piana 2019-03-22 14:57:27 +01:00 committed by Jakub Sokołowski
parent 26b97ddf43
commit 29c168dfa1
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
8 changed files with 59 additions and 5 deletions

View File

@ -1 +1 @@
0.23.0-beta.8
0.23.0-beta.8-chaos

View File

@ -1027,6 +1027,26 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
StatusThreadPoolExecutor.getInstance().execute(r);
}
@ReactMethod
public void chaosModeUpdate(final boolean on, final Callback callback) {
Log.d(TAG, "chaosModeUpdate");
if (!checkAvailability()) {
callback.invoke(false);
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.chaosModeUpdate(on);
callback.invoke(res);
}
};
StatusThreadPoolExecutor.getInstance().execute(r);
}
@Override
public @Nullable
Map<String, Object> getConstants() {

View File

@ -435,3 +435,13 @@ void RCTStatus::updateMailservers(QString enodes, double callbackId) {
d->bridge->invokePromiseCallback(callbackId, QVariantList{result});
}, enodes, callbackId);
}
void RCTStatus::chaosModeUpdate(bool on, double callbackId) {
Q_D(RCTStatus);
qCDebug(RCTSTATUS) << "::chaosModeUpdate call - callbackId:" << callbackId;
QtConcurrent::run([&](bool on, double callbackId) {
const char* result = ChaosModeUpdate(on);
logStatusGoResult("::chaosModeUpdate ChaosModeUpdate", result);
d->bridge->invokePromiseCallback(callbackId, QVariantList{result});
}, on, callbackId);
}

View File

@ -51,6 +51,7 @@ public:
Q_INVOKABLE void enableInstallation(QString installationId, double callbackId);
Q_INVOKABLE void disableInstallation(QString installationId, double callbackId);
Q_INVOKABLE void updateMailservers(QString enodes, double callbackId);
Q_INVOKABLE void chaosModeUpdate(bool on, double callbackId);
Q_INVOKABLE void setAdjustResize();
Q_INVOKABLE void setAdjustPan();

View File

@ -254,6 +254,16 @@ RCT_EXPORT_METHOD(updateMailservers:(NSString *)enodes
#endif
}
//////////////////////////////////////////////////////////////////// chaosModeUpdate
RCT_EXPORT_METHOD(chaosModeUpdate:(BOOL)on
callback:(RCTResponseSenderBlock)callback) {
NSString* result = StatusgoChaosModeUpdate(on);
callback(@[result]);
#if DEBUG
NSLog(@"ChaosModeUpdate() method called");
#endif
}
//////////////////////////////////////////////////////////////////// recoverAccount
RCT_EXPORT_METHOD(recoverAccount:(NSString *)passphrase
password:(NSString *)password

View File

@ -3,12 +3,18 @@
[status-im.accounts.update.core :as accounts.update]
[status-im.i18n :as i18n]
[status-im.ui.screens.navigation :as navigation]
[status-im.native-module.core :as native-module]
[status-im.ui.screens.wallet.settings.models :as wallet.settings.models]
[status-im.utils.config :as config]
[status-im.utils.utils :as utils]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as platform]))
(re-frame/reg-fx
::chaos-mode-changed
(fn [on]
(native-module/chaos-mode-update on (constantly nil))))
(fx/defn show-mainnet-is-default-alert [{:keys [db]}]
(let [shown? (get-in db [:account/account :mainnet-warning-shown?])]
(when (and platform/mobile?
@ -62,10 +68,11 @@
(fx/defn switch-chaos-mode [{:keys [db] :as cofx} chaos-mode?]
(let [settings (get-in db [:account/account :settings])]
(accounts.update/update-settings
cofx
(assoc settings :chaos-mode? chaos-mode?)
{})))
(fx/merge cofx
{::chaos-mode-changed chaos-mode?}
(accounts.update/update-settings
(assoc settings :chaos-mode? chaos-mode?)
{}))))
(fx/defn enable-notifications [cofx desktop-notifications?]
(accounts.update/account-update cofx

View File

@ -96,3 +96,5 @@
(def update-mailservers native-module/update-mailservers)
(def rooted-device? native-module/rooted-device?)
(def chaos-mode-update native-module/chaos-mode-update)

View File

@ -149,6 +149,10 @@
(when status
(.updateMailservers status enodes on-result)))
(defn chaos-mode-update [on on-result]
(when status
(.chaosModeUpdate status on on-result)))
(defn rooted-device? [callback]
(cond
;; we assume that iOS is safe by default