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); 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 @Override
public @Nullable public @Nullable
Map<String, Object> getConstants() { Map<String, Object> getConstants() {

View File

@ -435,3 +435,13 @@ void RCTStatus::updateMailservers(QString enodes, double callbackId) {
d->bridge->invokePromiseCallback(callbackId, QVariantList{result}); d->bridge->invokePromiseCallback(callbackId, QVariantList{result});
}, enodes, callbackId); }, 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 enableInstallation(QString installationId, double callbackId);
Q_INVOKABLE void disableInstallation(QString installationId, double callbackId); Q_INVOKABLE void disableInstallation(QString installationId, double callbackId);
Q_INVOKABLE void updateMailservers(QString enodes, 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 setAdjustResize();
Q_INVOKABLE void setAdjustPan(); Q_INVOKABLE void setAdjustPan();

View File

@ -254,6 +254,16 @@ RCT_EXPORT_METHOD(updateMailservers:(NSString *)enodes
#endif #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 //////////////////////////////////////////////////////////////////// recoverAccount
RCT_EXPORT_METHOD(recoverAccount:(NSString *)passphrase RCT_EXPORT_METHOD(recoverAccount:(NSString *)passphrase
password:(NSString *)password password:(NSString *)password

View File

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

View File

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

View File

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