Support for commands.js file inside DApps

This commit is contained in:
alwx 2017-02-28 15:51:31 +03:00 committed by Roman Volosovskyi
parent d6f43d3248
commit eb15c0a4eb
2 changed files with 13 additions and 15 deletions

View File

@ -31,6 +31,7 @@ var TopLevel = {
"create" : function () {},
"createAccount" : function () {},
"data" : function () {},
"DataSource" : function () {},
"Date" : function () {},
"DEBUG" : function () {},
"decay" : function () {},
@ -97,6 +98,7 @@ var TopLevel = {
"layout" : function () {},
"length" : function () {},
"Linking" : function () {},
"ListView" : function () {},
"locale" : function () {},
"lockToPortrait" : function () {},
"log" : function () {},

View File

@ -28,24 +28,20 @@
(defn fetch-commands!
[_ [{:keys [whisper-identity dapp? dapp-url]}]]
(when true
;-let [url (get-in db [:chats identity :dapp-url])]
(cond
(= console-chat-id whisper-identity)
(dispatch [::validate-hash whisper-identity js-res/console-js])
(cond
(= console-chat-id whisper-identity)
(dispatch [::validate-hash whisper-identity js-res/console-js])
(= wallet-chat-id whisper-identity)
(dispatch [::validate-hash whisper-identity js-res/wallet-js])
(= wallet-chat-id whisper-identity)
(dispatch [::validate-hash whisper-identity js-res/wallet-js])
(and dapp? dapp-url)
(dispatch [::validate-hash whisper-identity js-res/dapp-js])
(and dapp? dapp-url)
(http-get (s/join "/" [dapp-url commands-js])
#(dispatch [::validate-hash whisper-identity %])
#(dispatch [::validate-hash whisper-identity js-res/dapp-js]))
:else
(dispatch [::validate-hash whisper-identity js-res/commands-js])
#_(http-get (s/join "/" [url commands-js])
#(dispatch [::validate-hash identity %])
#(dispatch [::loading-failed! identity ::file-was-not-found])))))
:else
(dispatch [::validate-hash whisper-identity js-res/commands-js])))
(defn dispatch-loaded!
[db [identity file]]