mirror of https://github.com/status-im/pluto.git
Display QR code on first page load
This commit is contained in:
parent
91ad6ae3ba
commit
d07f95658a
|
@ -90,20 +90,20 @@
|
|||
:arguments {:to :string
|
||||
:method :string
|
||||
:params? :vector
|
||||
:on-result? :event}}}
|
||||
:hooks {:wallet.settings {:properties {:title :string
|
||||
:on-result :event}}}
|
||||
:hooks {:wallet.settings {:properties {:label :string
|
||||
:view :view
|
||||
:on-click? :event}}
|
||||
:commands {:properties {:description? :string
|
||||
:scope #{:personal-chats :public-chats}
|
||||
:short-preview :view
|
||||
:preview :view
|
||||
:parameters? [{:id :keyword
|
||||
:type {:one-of #{:text :phone :password :number}}
|
||||
:placeholder :string
|
||||
:suggestions? :view}]
|
||||
:on-send? :event
|
||||
:on-receive? :event}}}}})
|
||||
:chat.command {:properties {:description? :string
|
||||
:scope #{:personal-chats :public-chats}
|
||||
:short-preview :view
|
||||
:preview :view
|
||||
:parameters? [{:id :keyword
|
||||
:type {:one-of #{:text :phone :password :number}}
|
||||
:placeholder :string
|
||||
:suggestions? :view}]
|
||||
:on-send? :event
|
||||
:on-receive? :event}}}}})
|
||||
|
||||
(defn ^:export parse [m]
|
||||
(reader/parse ctx (:data m)))
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
::invalid-if-block
|
||||
::invalid-when-block
|
||||
::unsupported-test-type
|
||||
::invalid-local-event})
|
||||
::invalid-local-event
|
||||
::unresolved-properties})
|
||||
|
||||
(spec/def ::value any?)
|
||||
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
(spec/explain-data ::element o)
|
||||
(spec/explain-data ::form o))]
|
||||
(cond
|
||||
;; TODO Validate views, not hiccup
|
||||
(not (nil? explain))
|
||||
{:errors [(errors/error ::errors/invalid-view o {:explain-data explain})]}
|
||||
|
||||
|
@ -116,13 +115,26 @@
|
|||
(seq errors) (errors/accumulate-errors errors)))
|
||||
:else {:errors [(errors/error ::errors/unknown-component o)]})))
|
||||
|
||||
(defn unresolved-properties [acc o]
|
||||
(cond
|
||||
(symbol? o) (conj acc o)
|
||||
(vector? o)
|
||||
(let [[component properties & children] o]
|
||||
(reduce #(apply conj %1 (unresolved-properties acc %2)) acc children))
|
||||
:else acc))
|
||||
|
||||
(defn parse [ctx ext o]
|
||||
(if (list? o) ;; TODO introduce a block? fn
|
||||
(let [{:keys [data errors] :as m} (blocks/parse ctx ext o)]
|
||||
(errors/merge-errors
|
||||
(when data
|
||||
(parse ctx ext data))
|
||||
errors))
|
||||
(let [{:keys [data errors] :as m} (blocks/parse ctx ext o)
|
||||
]
|
||||
(if data
|
||||
(let [d (parse ctx ext data)
|
||||
props (reduce unresolved-properties #{} d)]
|
||||
(errors/merge-errors
|
||||
d
|
||||
(concat errors (when (seq props)
|
||||
{:errors [(errors/error ::errors/unresolved-properties props)]}))))
|
||||
{:errors errors}))
|
||||
(parse-hiccup-element ctx ext o)))
|
||||
|
||||
(defn- hiccup-with-properties [h properties]
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
if (content != null) {
|
||||
codeMirror.setValue(content);
|
||||
history.replaceState({hash: hash}, null, document.location.href.split('?')[0] + "?hash=" + hash);
|
||||
displayQR(hash);
|
||||
} else {
|
||||
codeMirror.setValue("Failed to load the extension");
|
||||
history.replaceState({hash: null}, null, document.location.href.split('?')[0]);
|
||||
|
|
Loading…
Reference in New Issue