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,11 +90,11 @@
|
||||||
:arguments {:to :string
|
:arguments {:to :string
|
||||||
:method :string
|
:method :string
|
||||||
:params? :vector
|
:params? :vector
|
||||||
:on-result? :event}}}
|
:on-result :event}}}
|
||||||
:hooks {:wallet.settings {:properties {:title :string
|
:hooks {:wallet.settings {:properties {:label :string
|
||||||
:view :view
|
:view :view
|
||||||
:on-click? :event}}
|
:on-click? :event}}
|
||||||
:commands {:properties {:description? :string
|
:chat.command {:properties {:description? :string
|
||||||
:scope #{:personal-chats :public-chats}
|
:scope #{:personal-chats :public-chats}
|
||||||
:short-preview :view
|
:short-preview :view
|
||||||
:preview :view
|
:preview :view
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
::invalid-if-block
|
::invalid-if-block
|
||||||
::invalid-when-block
|
::invalid-when-block
|
||||||
::unsupported-test-type
|
::unsupported-test-type
|
||||||
::invalid-local-event})
|
::invalid-local-event
|
||||||
|
::unresolved-properties})
|
||||||
|
|
||||||
(spec/def ::value any?)
|
(spec/def ::value any?)
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,6 @@
|
||||||
(spec/explain-data ::element o)
|
(spec/explain-data ::element o)
|
||||||
(spec/explain-data ::form o))]
|
(spec/explain-data ::form o))]
|
||||||
(cond
|
(cond
|
||||||
;; TODO Validate views, not hiccup
|
|
||||||
(not (nil? explain))
|
(not (nil? explain))
|
||||||
{:errors [(errors/error ::errors/invalid-view o {:explain-data explain})]}
|
{:errors [(errors/error ::errors/invalid-view o {:explain-data explain})]}
|
||||||
|
|
||||||
|
@ -116,13 +115,26 @@
|
||||||
(seq errors) (errors/accumulate-errors errors)))
|
(seq errors) (errors/accumulate-errors errors)))
|
||||||
:else {:errors [(errors/error ::errors/unknown-component o)]})))
|
: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]
|
(defn parse [ctx ext o]
|
||||||
(if (list? o) ;; TODO introduce a block? fn
|
(if (list? o) ;; TODO introduce a block? fn
|
||||||
(let [{:keys [data errors] :as m} (blocks/parse ctx ext o)]
|
(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
|
(errors/merge-errors
|
||||||
(when data
|
d
|
||||||
(parse ctx ext data))
|
(concat errors (when (seq props)
|
||||||
errors))
|
{:errors [(errors/error ::errors/unresolved-properties props)]}))))
|
||||||
|
{:errors errors}))
|
||||||
(parse-hiccup-element ctx ext o)))
|
(parse-hiccup-element ctx ext o)))
|
||||||
|
|
||||||
(defn- hiccup-with-properties [h properties]
|
(defn- hiccup-with-properties [h properties]
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
codeMirror.setValue(content);
|
codeMirror.setValue(content);
|
||||||
history.replaceState({hash: hash}, null, document.location.href.split('?')[0] + "?hash=" + hash);
|
history.replaceState({hash: hash}, null, document.location.href.split('?')[0] + "?hash=" + hash);
|
||||||
|
displayQR(hash);
|
||||||
} else {
|
} else {
|
||||||
codeMirror.setValue("Failed to load the extension");
|
codeMirror.setValue("Failed to load the extension");
|
||||||
history.replaceState({hash: null}, null, document.location.href.split('?')[0]);
|
history.replaceState({hash: null}, null, document.location.href.split('?')[0]);
|
||||||
|
|
Loading…
Reference in New Issue