mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-13 18:25:45 +00:00
This commit is contained in:
parent
65e3b209f2
commit
2932bbea85
@ -188,4 +188,8 @@
|
||||
|
||||
(defn topic-from-url
|
||||
[url]
|
||||
(string/lower-case (apply str (map filter-letters-numbers-and-replace-dot-on-dash (url-host url)))))
|
||||
(string/lower-case (apply str (map filter-letters-numbers-and-replace-dot-on-dash (url-host url)))))
|
||||
|
||||
(defn replace-port
|
||||
[url new-port]
|
||||
(string/replace url #"(:\d+)" (str ":" new-port)))
|
||||
|
@ -10,7 +10,8 @@
|
||||
[status-im2.contexts.chat.lightbox.animations :as anim]
|
||||
[status-im2.contexts.chat.lightbox.zoomable-image.constants :as c]
|
||||
[status-im2.contexts.chat.lightbox.zoomable-image.style :as style]
|
||||
[status-im2.contexts.chat.lightbox.zoomable-image.utils :as utils]))
|
||||
[status-im2.contexts.chat.lightbox.zoomable-image.utils :as utils]
|
||||
[status-im.utils.http :as http]))
|
||||
|
||||
(defn tap-gesture
|
||||
[on-tap]
|
||||
@ -223,7 +224,7 @@
|
||||
@set-full-height?
|
||||
(= curr-orientation orientation/portrait))}
|
||||
[reanimated/fast-image
|
||||
{:source {:uri (:image content)}
|
||||
{:source {:uri (http/replace-port (:image content) (rf/sub [:mediaserver/port]))}
|
||||
:native-ID (when focused? :shared-element)
|
||||
:style (style/image dimensions animations (:border-value render-data))}]]]))
|
||||
|
||||
|
@ -7,7 +7,8 @@
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.chat.messages.content.image.view :as image]
|
||||
[status-im2.contexts.chat.messages.content.text.view :as text]
|
||||
[utils.re-frame :as rf]))
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.http :as http]))
|
||||
|
||||
(def rectangular-style-count 3)
|
||||
|
||||
@ -54,7 +55,8 @@
|
||||
:index index}])}
|
||||
[fast-image/fast-image
|
||||
{:style (style/image dimensions index portrait? images-count)
|
||||
:source {:uri (:image (:content item))}
|
||||
:source {:uri (http/replace-port (:image (:content item))
|
||||
(rf/sub [:mediaserver/port]))}
|
||||
:native-ID (when (and (= shared-element-id (:message-id item))
|
||||
(< index constants/max-album-photos))
|
||||
:shared-element)}]
|
||||
|
@ -78,16 +78,15 @@
|
||||
|
||||
(defn play-pause-player
|
||||
[{:keys [player-key player-state progress message-id audio-duration-ms seeking-audio?
|
||||
user-interaction?]
|
||||
user-interaction? mediaserver-port]
|
||||
:as params}]
|
||||
(let [mediaserver-port (rf/sub [:mediaserver/port])
|
||||
audio-uri (str media-server-uri-prefix
|
||||
mediaserver-port
|
||||
audio-path
|
||||
uri-param
|
||||
message-id)
|
||||
player (@active-players player-key)
|
||||
playing? (= @player-state :playing)]
|
||||
(let [audio-uri (str media-server-uri-prefix
|
||||
mediaserver-port
|
||||
audio-path
|
||||
uri-param
|
||||
message-id)
|
||||
player (@active-players player-key)
|
||||
playing? (= @player-state :playing)]
|
||||
(when-not playing?
|
||||
(reset! current-player-key player-key))
|
||||
(if (and player
|
||||
@ -134,18 +133,19 @@
|
||||
(defn f-audio-message
|
||||
[player-state progress seeking-audio? {:keys [audio-duration-ms message-id]}
|
||||
{:keys [in-pinned-view?]}]
|
||||
(let [player-key (get-player-key message-id in-pinned-view?)
|
||||
player (@active-players player-key)
|
||||
duration (if (and player (not (#{:preparing :not-loaded :error} @player-state)))
|
||||
(audio/get-player-duration player)
|
||||
audio-duration-ms)
|
||||
time-secs (quot
|
||||
(if (or @seeking-audio? (#{:playing :seeking} @player-state))
|
||||
(if (<= @progress 1) (* duration @progress) @progress)
|
||||
duration)
|
||||
1000)
|
||||
paused? (= (audio/get-state player) audio/PAUSED)
|
||||
app-state (rf/sub [:app-state])]
|
||||
(let [player-key (get-player-key message-id in-pinned-view?)
|
||||
player (@active-players player-key)
|
||||
duration (if (and player (not (#{:preparing :not-loaded :error} @player-state)))
|
||||
(audio/get-player-duration player)
|
||||
audio-duration-ms)
|
||||
time-secs (quot
|
||||
(if (or @seeking-audio? (#{:playing :seeking} @player-state))
|
||||
(if (<= @progress 1) (* duration @progress) @progress)
|
||||
duration)
|
||||
1000)
|
||||
paused? (= (audio/get-state player) audio/PAUSED)
|
||||
app-state (rf/sub [:app-state])
|
||||
mediaserver-port (rf/sub [:mediaserver/port])]
|
||||
(rn/use-effect (fn [] #(destroy-player player-key)))
|
||||
(rn/use-effect
|
||||
(fn []
|
||||
@ -163,8 +163,9 @@
|
||||
:message-id message-id
|
||||
:audio-duration-ms duration
|
||||
:seeking-audio? seeking-audio?
|
||||
:user-interaction? false})))
|
||||
[@current-player-key app-state])
|
||||
:user-interaction? false
|
||||
:mediaserver-port mediaserver-port})))
|
||||
[@current-player-key app-state mediaserver-port])
|
||||
(if (= @player-state :error)
|
||||
[quo/text
|
||||
{:style style/error-label
|
||||
@ -183,7 +184,8 @@
|
||||
:message-id message-id
|
||||
:audio-duration-ms duration
|
||||
:seeking-audio? seeking-audio?
|
||||
:user-interaction? true})
|
||||
:user-interaction? true
|
||||
:mediaserver-port mediaserver-port})
|
||||
:style (style/play-pause-container)}
|
||||
[quo/icon
|
||||
(cond
|
||||
|
@ -5,7 +5,8 @@
|
||||
[react-native.safe-area :as safe-area]
|
||||
[status-im2.constants :as constants]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im2.contexts.chat.messages.content.text.view :as text]))
|
||||
[status-im2.contexts.chat.messages.content.text.view :as text]
|
||||
[status-im.utils.http :as http]))
|
||||
|
||||
(defn calculate-dimensions
|
||||
[width height]
|
||||
@ -17,7 +18,8 @@
|
||||
[index {:keys [content image-width image-height message-id] :as message} on-long-press]
|
||||
(let [insets (safe-area/get-insets)
|
||||
dimensions (calculate-dimensions (or image-width 1000) (or image-height 1000))
|
||||
shared-element-id (rf/sub [:shared-element-id])]
|
||||
shared-element-id (rf/sub [:shared-element-id])
|
||||
image-local-url (http/replace-port (:image content) (rf/sub [:mediaserver/port]))]
|
||||
[:<>
|
||||
(when (= index 0)
|
||||
[rn/view {:style {:margin-bottom 10}} [text/text-content message]])
|
||||
@ -31,7 +33,7 @@
|
||||
:index 0
|
||||
:insets insets}])}
|
||||
[fast-image/fast-image
|
||||
{:source {:uri (:image content)}
|
||||
{:source {:uri image-local-url}
|
||||
:style (merge dimensions {:border-radius 12})
|
||||
:native-ID (when (= shared-element-id message-id) :shared-element)
|
||||
:accessibility-label :image-message}]]]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user