fix: composer opacity (#15929)

This commit is contained in:
Omar Basem 2023-05-17 19:43:42 +04:00 committed by GitHub
parent 03f501ca7b
commit b264d25b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 25 deletions

View File

@ -64,7 +64,7 @@
[:f> f-send-button state animations window-height images? btn-opacity z-index])) [:f> f-send-button state animations window-height images? btn-opacity z-index]))
(defn audio-button (defn audio-button
[{:keys [record-reset-fn]} [{:keys [record-reset-fn input-ref]}
{:keys [record-permission? recording? gesture-enabled? focused?]} {:keys [record-permission? recording? gesture-enabled? focused?]}
{:keys [container-opacity]}] {:keys [container-opacity]}]
(let [audio (rf/sub [:chats/sending-audio])] (let [audio (rf/sub [:chats/sending-audio])]
@ -86,17 +86,22 @@
(reset! recording? false) (reset! recording? false)
(reset! gesture-enabled? true) (reset! gesture-enabled? true)
(rf/dispatch [:chat/send-audio file-path duration]) (rf/dispatch [:chat/send-audio file-path duration])
(when-not @focused? (if-not @focused?
(reanimated/animate container-opacity (reanimated/animate container-opacity
constants/empty-opacity)) constants/empty-opacity)
(js/setTimeout #(when @input-ref (.focus ^js @input-ref))
300))
(rf/dispatch [:chat.ui/set-input-audio nil])) (rf/dispatch [:chat.ui/set-input-audio nil]))
:on-cancel (fn [] :on-cancel (fn []
(when @recording? (when @recording?
(reset! recording? false) (reset! recording? false)
(reset! gesture-enabled? true) (reset! gesture-enabled? true)
(when-not @focused? (if-not @focused?
(reanimated/animate container-opacity (reanimated/animate container-opacity
constants/empty-opacity)) constants/empty-opacity)
(js/setTimeout #(when @input-ref
(.focus ^js @input-ref))
300))
(rf/dispatch [:chat.ui/set-input-audio nil]))) (rf/dispatch [:chat.ui/set-input-audio nil])))
:on-check-audio-permissions (fn [] :on-check-audio-permissions (fn []
(permissions/permission-granted? (permissions/permission-granted?

View File

@ -36,10 +36,11 @@
(defn blur (defn blur
[{:keys [text-value focused? lock-selection? cursor-position saved-cursor-position gradient-z-index [{:keys [text-value focused? lock-selection? cursor-position saved-cursor-position gradient-z-index
maximized?]} maximized? recording?]}
{:keys [height saved-height last-height gradient-opacity container-opacity opacity background-y]} {:keys [height saved-height last-height gradient-opacity container-opacity opacity background-y]}
{:keys [content-height max-height window-height]} {:keys [content-height max-height window-height]}
{:keys [images reply]}] {:keys [images reply]}]
(when-not @recording?
(let [lines (utils/calc-lines (- @content-height constants/extra-content-offset)) (let [lines (utils/calc-lines (- @content-height constants/extra-content-offset))
min-height (utils/get-min-height lines) min-height (utils/get-min-height lines)
reopen-height (utils/calc-reopen-height text-value min-height content-height saved-height)] reopen-height (utils/calc-reopen-height text-value min-height content-height saved-height)]
@ -58,7 +59,7 @@
(reset! gradient-z-index (if (= (reanimated/get-shared-value gradient-opacity) 1) -1 0)) (reset! gradient-z-index (if (= (reanimated/get-shared-value gradient-opacity) 1) -1 0))
(when (not= reopen-height max-height) (when (not= reopen-height max-height)
(reset! maximized? false) (reset! maximized? false)
(rf/dispatch [:chat.ui/set-input-maximized false])))) (rf/dispatch [:chat.ui/set-input-maximized false])))))
(defn content-size-change (defn content-size-change
[event [event