Fix all type hint warnings (#14810)
This commit is contained in:
parent
14c9a7c6ac
commit
9a60fc1600
|
@ -25,7 +25,7 @@
|
|||
:component tag/tab
|
||||
:size 32/24
|
||||
:on-press fn
|
||||
:blurred? true/false
|
||||
:blurred? true/false
|
||||
:labelled? true/false
|
||||
:disabled? true/false
|
||||
:scroll-on-press? true
|
||||
|
@ -36,7 +36,7 @@
|
|||
:data [{:id :label \"\" :resource \"url\"}
|
||||
{:id :label \"\" :resource \"url\"}]}
|
||||
Opts:
|
||||
- `component` this is to determine which component is to be rendered since the
|
||||
- `component` this is to determine which component is to be rendered since the
|
||||
logic in this view is shared between tab and tag component
|
||||
- `blurred` boolean: use to determine border color if the background is blurred
|
||||
- `type` can be icon or emoji with or without a tag label
|
||||
|
@ -142,7 +142,7 @@
|
|||
:on-press (fn [id]
|
||||
(reset! active-tab-id id)
|
||||
(when scroll-on-press?
|
||||
(.scrollToIndex @flat-list-ref
|
||||
(.scrollToIndex ^js @flat-list-ref
|
||||
#js
|
||||
{:animated true
|
||||
:index index
|
||||
|
|
|
@ -46,15 +46,16 @@
|
|||
[player on-prepared on-error]
|
||||
(when (and player (.-canPrepare ^js player))
|
||||
(.prepare ^js player
|
||||
#(if %
|
||||
(on-error {:error (.-err %) :message (.-message %)})
|
||||
(on-prepared)))))
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-prepared))))))
|
||||
|
||||
(defn prepare-recorder
|
||||
[recorder on-prepared on-error]
|
||||
(when (and recorder (.-canPrepare ^js recorder))
|
||||
(.prepare ^js recorder
|
||||
(fn [err _]
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-prepared))))))
|
||||
|
@ -66,42 +67,47 @@
|
|||
(.-canRecord ^js recorder)
|
||||
(.-canPrepare ^js recorder)))
|
||||
(.record ^js recorder
|
||||
#(if %
|
||||
(on-error {:error (.-err %) :message (.-message %)})
|
||||
(on-start)))))
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-start))))))
|
||||
|
||||
(defn stop-recording
|
||||
[recorder on-stop on-error]
|
||||
(if (and recorder (#{RECORDING PAUSED} (get-state recorder)))
|
||||
(.stop ^js recorder
|
||||
#(if %
|
||||
(on-error {:error (.-err %) :message (.-message %)})
|
||||
(on-stop)))
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-stop))))
|
||||
(on-stop)))
|
||||
|
||||
(defn pause-recording
|
||||
[recorder on-pause on-error]
|
||||
(when (and recorder (.-isRecording ^js recorder))
|
||||
(.pause ^js recorder
|
||||
#(if %
|
||||
(on-error {:error (.-err %) :message (.-message %)})
|
||||
(on-pause)))))
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-pause))))))
|
||||
|
||||
(defn start-playing
|
||||
[player on-start on-error]
|
||||
(when (and player (.-canPlay ^js player))
|
||||
(.play ^js player
|
||||
#(if %
|
||||
(on-error {:error (.-err %) :message (.-message %)})
|
||||
(on-start)))))
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-start))))))
|
||||
|
||||
(defn stop-playing
|
||||
[player on-stop on-error]
|
||||
(if (and player (.-isPlaying ^js player))
|
||||
(.stop ^js player
|
||||
#(if %
|
||||
(on-error {:error (.-err %) :message (.-message %)})
|
||||
(on-stop)))
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-stop))))
|
||||
(on-stop)))
|
||||
|
||||
(defn get-recorder-file-path
|
||||
|
@ -123,7 +129,7 @@
|
|||
[player on-play on-pause on-error]
|
||||
(when (and player (.-canPlay ^js player))
|
||||
(.playPause ^js player
|
||||
(fn [error pause?]
|
||||
(fn [^js error pause?]
|
||||
(if error
|
||||
(on-error {:error (.-err error) :message (.-message error)})
|
||||
(if pause?
|
||||
|
@ -135,9 +141,10 @@
|
|||
(when (and player (.-canPlay ^js player))
|
||||
(.seek ^js player
|
||||
value
|
||||
#(if %
|
||||
(on-error {:error (.-err %) :message (.-message %)})
|
||||
(on-seek)))))
|
||||
(fn [^js err]
|
||||
(if err
|
||||
(on-error {:error (.-err err) :message (.-message err)})
|
||||
(on-seek))))))
|
||||
|
||||
(defn can-play?
|
||||
[player]
|
||||
|
@ -155,4 +162,4 @@
|
|||
(stop-playing player
|
||||
#(when (and player (not= (get-state player) IDLE))
|
||||
(.destroy ^js player))
|
||||
#()))
|
||||
#()))
|
||||
|
|
|
@ -70,9 +70,10 @@
|
|||
(assoc-in [:contacts/contacts public-key] contact))}
|
||||
(contacts-store/block
|
||||
public-key
|
||||
#(do (re-frame/dispatch [::contact-blocked contact (.-chats %)])
|
||||
(re-frame/dispatch [:sanitize-messages-and-process-response %])
|
||||
(re-frame/dispatch [:hide-popover])))
|
||||
(fn [^js block-contact]
|
||||
(re-frame/dispatch [::contact-blocked contact (.-chats block-contact)])
|
||||
(re-frame/dispatch [:sanitize-messages-and-process-response block-contact])
|
||||
(re-frame/dispatch [:hide-popover])))
|
||||
;; reset navigation to avoid going back to non existing one to one chat
|
||||
(if from-one-to-one-chat?
|
||||
(navigation/pop-to-root-tab :chat-stack)
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
(:refer-clojure :exclude [remove])
|
||||
(:require [clojure.spec.alpha :as spec]
|
||||
[clojure.string :as string]
|
||||
[i18n.i18n :as i18n]
|
||||
[oops.core :as oops]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.chat.models :as models.chat]
|
||||
[status-im.constants :as constants]
|
||||
[utils.re-frame :as rf]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im2.contexts.activity-center.events :as activity-center]
|
||||
[status-im2.navigation.events :as navigation]))
|
||||
[status-im2.navigation.events :as navigation]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(rf/defn navigate-chat-updated
|
||||
{:events [:navigate-chat-updated]}
|
||||
|
@ -30,7 +31,11 @@
|
|||
[_ response do-not-navigate?]
|
||||
{:dispatch-n [[:sanitize-messages-and-process-response response]
|
||||
(when-not do-not-navigate?
|
||||
[:navigate-chat-updated (.-id (aget (.-chats response) 0))])]})
|
||||
[:navigate-chat-updated
|
||||
(-> response
|
||||
(oops/oget :chats)
|
||||
first
|
||||
(oops/oget :id))])]})
|
||||
|
||||
(rf/defn remove-member
|
||||
"Format group update message and sign membership"
|
||||
|
|
|
@ -235,11 +235,11 @@
|
|||
|
||||
(defn sort-js-messages!
|
||||
"sort messages, so we can start process latest first,in that case we only need to process frist 20 and drop others"
|
||||
[response-js messages]
|
||||
[^js response-js messages]
|
||||
(if (seq messages)
|
||||
(set! (.-messages response-js)
|
||||
(.sort (to-array messages)
|
||||
(fn [a b]
|
||||
(fn [^js a ^js b]
|
||||
(- (.-clock b) (.-clock a)))))
|
||||
(js-delete response-js "messages")))
|
||||
|
||||
|
@ -334,7 +334,7 @@
|
|||
|
||||
(rf/defn transport-message-sent
|
||||
{:events [:transport/message-sent]}
|
||||
[cofx response-js]
|
||||
[cofx ^js response-js]
|
||||
(let [set-hash-fxs (map (fn [{:keys [localChatId id messageType]}]
|
||||
(set-message-envelope-hash localChatId id messageType))
|
||||
(types/js->clj (.-messages response-js)))]
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
update? (atom nil)
|
||||
current-obj (reagent/atom nil)]
|
||||
(reagent/create-class
|
||||
{:UNSAFE_componentWillMount (fn [args]
|
||||
{:UNSAFE_componentWillMount (fn [^js args]
|
||||
(let [[_ obj _ _] (.-argv (.-props args))]
|
||||
(when @clear-timeout (js/clearTimeout @clear-timeout))
|
||||
(when (or (not= obj @current-obj) @update?)
|
||||
|
|
|
@ -404,7 +404,7 @@
|
|||
|
||||
(defn image-set-size
|
||||
[dimensions]
|
||||
(fn [evt]
|
||||
(fn [^js evt]
|
||||
(let [width (.-width (.-nativeEvent evt))
|
||||
height (.-height (.-nativeEvent evt))]
|
||||
(if (< width height)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
(defn image-set-size
|
||||
[width]
|
||||
(fn [evt]
|
||||
(fn [^js evt]
|
||||
(reset! width (/ (.-width (.-nativeEvent evt))
|
||||
(/ (.-height (.-nativeEvent evt)) image-max-dimension)))))
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@
|
|||
(update-selection text-input-handle start end)
|
||||
(reset! selection-event nil))))
|
||||
on-selection
|
||||
(fn [event]
|
||||
(fn [^js event]
|
||||
(let [native-event (.-nativeEvent event)
|
||||
native-event (transforms/js->clj native-event)
|
||||
{:keys [eventType content selectionStart selectionEnd]} native-event
|
||||
|
|
|
@ -253,7 +253,7 @@
|
|||
|
||||
(defn image-set-size
|
||||
[dimensions]
|
||||
(fn [evt]
|
||||
(fn [^js evt]
|
||||
(let [width (.-width (.-nativeEvent evt))
|
||||
height (.-height (.-nativeEvent evt))]
|
||||
(if (< width height)
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
(catch :default _ nil))))
|
||||
|
||||
(defn greater-than-or-equals
|
||||
[bn1 bn2]
|
||||
[^js bn1 ^js bn2]
|
||||
(.greaterThanOrEqualTo bn1 bn2))
|
||||
|
||||
(defn greater-than
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
{:show-wallet-connect-sheet nil})
|
||||
|
||||
(defn subscribe-to-events
|
||||
[wallet-connect-client]
|
||||
[^js wallet-connect-client]
|
||||
(.on wallet-connect-client
|
||||
(wallet-connect/session-request-event)
|
||||
#(re-frame/dispatch [:wallet-connect/request %]))
|
||||
|
@ -209,7 +209,7 @@
|
|||
|
||||
(rf/defn wallet-connect-client-initate
|
||||
{:events [:wallet-connect/client-init]}
|
||||
[{:keys [db] :as cofx} client]
|
||||
[{:keys [db] :as cofx} ^js client]
|
||||
{:db (assoc db
|
||||
:wallet-connect/client client
|
||||
:wallet-connect/sessions (types/js->clj (.-values (.-session
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
(fn [^js connectors]
|
||||
(log/debug "Kill wc sessions")
|
||||
(doseq [connector connectors]
|
||||
(.killSession connector))))
|
||||
(.killSession ^js connector))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:wc-1-approve-request
|
||||
|
|
Loading…
Reference in New Issue