mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-11 17:24:27 +00:00
utilize single jail.signal event for all signals from jail
This commit is contained in:
parent
43a5d91ca2
commit
e961801429
@ -15,5 +15,5 @@ android {
|
||||
dependencies {
|
||||
compile 'com.facebook.react:react-native:+'
|
||||
compile 'com.instabug.library:instabug:3+'
|
||||
compile(group: 'status-im', name: 'status-go', version: 'bugfix-updated-cht-#185-gd84d10d', ext: 'aar')
|
||||
compile(group: 'status-im', name: 'status-go', version: 'signal-event-g38dba07', ext: 'aar')
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
<artifactItem>
|
||||
<groupId>status-im</groupId>
|
||||
<artifactId>status-go-ios-simulator</artifactId>
|
||||
<version>bugfix-updated-cht-#185-gd84d10d</version>
|
||||
<version>signal-event-g38dba07</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
|
46
package-lock.json
generated
46
package-lock.json
generated
@ -431,12 +431,56 @@
|
||||
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
|
||||
"integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=",
|
||||
"requires": {
|
||||
"babel-core": "6.26.0",
|
||||
"babel-runtime": "6.26.0",
|
||||
"core-js": "2.5.1",
|
||||
"home-or-tmp": "2.0.0",
|
||||
"lodash": "4.17.4",
|
||||
"mkdirp": "0.5.1",
|
||||
"source-map-support": "0.4.17"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-core": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",
|
||||
"integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=",
|
||||
"requires": {
|
||||
"babel-code-frame": "6.26.0",
|
||||
"babel-generator": "6.26.0",
|
||||
"babel-helpers": "6.24.1",
|
||||
"babel-messages": "6.23.0",
|
||||
"babel-register": "6.26.0",
|
||||
"babel-runtime": "6.26.0",
|
||||
"babel-template": "6.26.0",
|
||||
"babel-traverse": "6.26.0",
|
||||
"babel-types": "6.26.0",
|
||||
"babylon": "6.18.0",
|
||||
"convert-source-map": "1.5.0",
|
||||
"debug": "2.6.8",
|
||||
"json5": "0.5.1",
|
||||
"lodash": "4.17.4",
|
||||
"minimatch": "3.0.4",
|
||||
"path-is-absolute": "1.0.1",
|
||||
"private": "0.1.7",
|
||||
"slash": "1.0.0",
|
||||
"source-map": "0.5.7"
|
||||
}
|
||||
},
|
||||
"babel-generator": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz",
|
||||
"integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=",
|
||||
"requires": {
|
||||
"babel-messages": "6.23.0",
|
||||
"babel-runtime": "6.26.0",
|
||||
"babel-types": "6.26.0",
|
||||
"detect-indent": "4.0.0",
|
||||
"jsesc": "1.3.0",
|
||||
"lodash": "4.17.4",
|
||||
"source-map": "0.5.7",
|
||||
"trim-right": "1.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6028,7 +6072,7 @@
|
||||
}
|
||||
},
|
||||
"react-native-webview-bridge": {
|
||||
"version": "git+https://github.com/status-im/react-native-webview-bridge.git#0b501d3d9041066753ea0f30bce864b5bbd8788e",
|
||||
"version": "git+https://github.com/status-im/react-native-webview-bridge.git#8e784ffcfba5e5781c99d933a4573eec0fb23e1e",
|
||||
"requires": {
|
||||
"invariant": "2.2.0",
|
||||
"keymirror": "0.1.1"
|
||||
|
@ -79,7 +79,7 @@
|
||||
"react-native-tcp": "^3.2.1",
|
||||
"react-native-udp": "^2.0.0",
|
||||
"react-native-vector-icons": "^4.0.1",
|
||||
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#status-go-bugfix-updated-cht",
|
||||
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#upgrade-status-go-signal",
|
||||
"readable-stream": "1.0.33",
|
||||
"realm": "^0.14.3",
|
||||
"stream-browserify": "^1.0.0",
|
||||
|
@ -279,7 +279,7 @@ var status = {
|
||||
separator: separator
|
||||
},
|
||||
showSuggestions: function (view) {
|
||||
statusSignals.showSuggestions(JSON.stringify(view));
|
||||
status.sendSignal("show-suggestions", view);
|
||||
},
|
||||
setDefaultDb: function (db) {
|
||||
addContext("default-db", db);
|
||||
@ -291,7 +291,7 @@ var status = {
|
||||
if(typeof message !== "string") {
|
||||
message = JSON.stringify(message);
|
||||
}
|
||||
statusSignals.sendMessage(message);
|
||||
status.sendSignal("send-message", message);
|
||||
},
|
||||
addLogMessage: function (type, message) {
|
||||
var message = {
|
||||
@ -310,6 +310,14 @@ var status = {
|
||||
subscriptions: subscriptions,
|
||||
handler: handler
|
||||
};
|
||||
},
|
||||
sendSignal: function (eventName, data) {
|
||||
var event = {
|
||||
event: eventName,
|
||||
data: data
|
||||
};
|
||||
|
||||
statusSignals.sendSignal(JSON.stringify(event));
|
||||
}
|
||||
};
|
||||
|
||||
@ -349,6 +357,8 @@ console = (function (old) {
|
||||
};
|
||||
}(console));
|
||||
|
||||
var localStorage = {};
|
||||
|
||||
localStorage.setItem = function(key, value) {
|
||||
if(value === null) {
|
||||
delete localStorageData[key];
|
||||
@ -356,7 +366,7 @@ localStorage.setItem = function(key, value) {
|
||||
localStorageData[key] = value;
|
||||
}
|
||||
|
||||
localStorage.set(JSON.stringify(localStorageData));
|
||||
status.sendSignal("local-storage", JSON.stringify(localStorageData));
|
||||
};
|
||||
|
||||
localStorage.getItem = function (key) {
|
||||
|
@ -272,19 +272,19 @@
|
||||
|
||||
(register-handler :send-message-from-jail
|
||||
(u/side-effect!
|
||||
(fn [_ [_ {:keys [chat_id message]}]]
|
||||
(fn [_ [_ {:keys [chat-id message]}]]
|
||||
(let [parsed-message (types/json->clj message)]
|
||||
(handle-message-from-bot {:message parsed-message
|
||||
:chat-id chat_id})))))
|
||||
:chat-id chat-id})))))
|
||||
|
||||
(register-handler :show-suggestions-from-jail
|
||||
(u/side-effect!
|
||||
(fn [_ [_ {:keys [chat_id markup]}]]
|
||||
(fn [_ [_ {:keys [chat-id markup]}]]
|
||||
(let [markup' (types/json->clj markup)
|
||||
result (assoc-in {} [:result :returned :markup] markup')]
|
||||
(dispatch [:suggestions-handler
|
||||
{:result result
|
||||
:chat-id chat_id}])))))
|
||||
:chat-id chat-id}])))))
|
||||
|
||||
(register-handler ::send-message!
|
||||
(u/side-effect!
|
||||
|
@ -99,6 +99,6 @@
|
||||
|
||||
(reg-handler :set-local-storage
|
||||
(handlers/side-effect!
|
||||
(fn [_ [{:keys [data chat_id]}]]
|
||||
(local-storage/set-data {:chat-id chat_id
|
||||
(fn [_ [{:keys [data chat-id]}]]
|
||||
(local-storage/set-data {:chat-id chat-id
|
||||
:data data}))))
|
||||
|
@ -210,6 +210,18 @@
|
||||
(fn [_ _]
|
||||
{::get-fcm-token-fx nil}))
|
||||
|
||||
(defn handle-jail-signal [{:keys[chat_id data]}]
|
||||
(let [{:keys [event data]} (types/json->clj data)]
|
||||
(case event
|
||||
"local-storage" (dispatch [:set-local-storage {:chat-id chat_id
|
||||
:data data}])
|
||||
"show-suggestions" (dispatch [:show-suggestions-from-jail {:chat-id chat_id
|
||||
:markup data}])
|
||||
"send-message" (dispatch [:send-message-from-jail {:chat-id chat_id
|
||||
:message data}])
|
||||
|
||||
(log/debug "Unknown jail signal " type))))
|
||||
|
||||
(register-handler-fx
|
||||
:signal-event
|
||||
(fn [_ [_ event-str]]
|
||||
@ -221,11 +233,9 @@
|
||||
"transaction.failed" (dispatch [:transaction-failed event])
|
||||
"node.started" (dispatch [:status-node-started])
|
||||
"module.initialized" (dispatch [:status-module-initialized])
|
||||
"local_storage.set" (dispatch [:set-local-storage event])
|
||||
"request_geo_permissions" (dispatch [:request-permissions [:geolocation]
|
||||
#(dispatch [:webview-geo-permissions-granted])])
|
||||
"jail.send_message" (dispatch [:send-message-from-jail event])
|
||||
"jail.show_suggestions" (dispatch [:show-suggestions-from-jail event])
|
||||
"jail.signal" (handle-jail-signal event)
|
||||
(log/debug "Event " type " not handled")))))
|
||||
|
||||
(register-handler-fx
|
||||
|
Loading…
x
Reference in New Issue
Block a user