diff --git a/.env b/.env index 20fdd53690..e0408dadb2 100644 --- a/.env +++ b/.env @@ -24,4 +24,5 @@ QR_READ_TEST_MENU=1 ENABLE_ROOT_ALERT=1 ENABLE_REFERRAL_INVITE=1 ENABLE_QUO_PREVIEW=1 +MAX_IMAGES_BATCH=5 APN_TOPIC=im.status.ethereum.pr diff --git a/.env.e2e b/.env.e2e index ea2482e0e0..7658cf856a 100644 --- a/.env.e2e +++ b/.env.e2e @@ -23,4 +23,5 @@ KEYCARD_TEST_MENU=1 QR_READ_TEST_MENU=1 ENABLE_ROOT_ALERT=0 ENABLE_REFERRAL_INVITE=1 +MAX_IMAGES_BATCH=5 APN_TOPIC=im.status.ethereum.pr diff --git a/.env.jenkins b/.env.jenkins index aece007766..d512e26490 100644 --- a/.env.jenkins +++ b/.env.jenkins @@ -24,4 +24,5 @@ ENABLE_REFERRAL_INVITE=1 DISABLE_WALLET_ON_MOBILE_NETWORK=1 APN_TOPIC=im.status.ethereum.pr BLANK_PREVIEW=0 -GOOGLE_FREE=0 \ No newline at end of file +MAX_IMAGES_BATCH=5 +GOOGLE_FREE=0 diff --git a/.env.nightly b/.env.nightly index 0a07b2c26b..62b08d1343 100644 --- a/.env.nightly +++ b/.env.nightly @@ -18,4 +18,5 @@ PARTITIONED_TOPIC=0 CONTRACT_NODES=1 ENABLE_ROOT_ALERT=1 ENABLE_REFERRAL_INVITE=0 -BLANK_PREVIEW=0 \ No newline at end of file +MAX_IMAGES_BATCH=5 +BLANK_PREVIEW=0 diff --git a/.env.release b/.env.release index 5570e201f5..be3001d2dd 100644 --- a/.env.release +++ b/.env.release @@ -16,4 +16,5 @@ SNOOPY=0 RPC_NETWORKS_ONLY=1 PARTITIONED_TOPIC=0 ENABLE_ROOT_ALERT=1 +MAX_IMAGES_BATCH=1 ENABLE_REFERRAL_INVITE=0 diff --git a/src/status_im/chat/models/images.cljs b/src/status_im/chat/models/images.cljs index f1d692baf5..c74b84c0c9 100644 --- a/src/status_im/chat/models/images.cljs +++ b/src/status_im/chat/models/images.cljs @@ -3,6 +3,7 @@ [status-im.utils.fx :as fx] ["@react-native-community/cameraroll" :as CameraRoll] [status-im.utils.types :as types] + [status-im.utils.config :as config] [status-im.ui.components.permissions :as permissions] [status-im.ui.components.react :as react] [status-im.utils.image-processing :as image-processing] @@ -11,7 +12,6 @@ [status-im.utils.platform :as platform])) (def maximum-image-size-px 2000) -(def max-images-batch 5) (defn- resize-and-call [uri cb] (react/image-get-size @@ -63,7 +63,7 @@ (when (and platform/ios? (pos? (count images))) (re-frame/dispatch [:chat.ui/clear-sending-images])) (doseq [^js result (if platform/ios? - (take max-images-batch images) + (take config/max-images-batch images) [images])] (resize-and-call (.-path result) #(re-frame/dispatch [:chat.ui/image-selected (result->id result) %])))) @@ -132,7 +132,7 @@ [{:keys [db]}] (let [current-chat-id (:current-chat-id db) images (get-in db [:chats current-chat-id :metadata :sending-image])] - (when (< (count images) max-images-batch) + (when (< (count images) config/max-images-batch) {::chat-open-image-picker nil}))) (fx/defn camera-roll-pick @@ -143,7 +143,7 @@ (if (get-in db [:chats current-chat-id :timeline?]) {:db (update-in db [:chats current-chat-id :metadata :sending-image] {uri {:uri uri}}) ::image-selected uri} - (when (and (< (count images) max-images-batch) + (when (and (< (count images) config/max-images-batch) (not (get images uri))) {:db (update-in db [:chats current-chat-id :metadata :sending-image] assoc uri {:uri uri}) ::image-selected uri})))) diff --git a/src/status_im/ui/screens/chat/image/views.cljs b/src/status_im/ui/screens/chat/image/views.cljs index 42a982e3f6..d5560c7989 100644 --- a/src/status_im/ui/screens/chat/image/views.cljs +++ b/src/status_im/ui/screens/chat/image/views.cljs @@ -3,11 +3,11 @@ (:require [status-im.ui.components.react :as react] [status-im.ui.components.icons.vector-icons :as icons] [status-im.ui.components.permissions :as permissions] + [status-im.utils.config :as config] [reagent.core :as reagent] [quo.components.animated.pressable :as pressable] [re-frame.core :as re-frame] [quo.design-system.colors :as colors] - [status-im.chat.models.images :as images] [quo.core :as quo] [status-im.utils.utils :as utils] [status-im.i18n :as i18n])) @@ -51,7 +51,7 @@ (defn image-preview [uri all-selected first? panel-height] (let [wh (/ (- panel-height 8) 2) selected (get all-selected uri) - max-selected (>= (count all-selected) images/max-images-batch)] + max-selected (>= (count all-selected) config/max-images-batch)] [react/touchable-highlight {:on-press #(if selected (re-frame/dispatch [:chat.ui/image-unselected uri]) (re-frame/dispatch [:chat.ui/camera-roll-pick uri])) diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index ef11bffbe5..33d20a1b12 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -29,6 +29,7 @@ (def erc20-contract-warnings-enabled? (enabled? (get-config :ERC20_CONTRACT_WARNINGS))) (def tr-to-talk-enabled? (enabled? (get-config :TRIBUTE_TO_TALK 0))) (def max-message-delivery-attempts (js/parseInt (get-config :MAX_MESSAGE_DELIVERY_ATTEMPTS "6"))) +(def max-images-batch (js/parseInt (get-config :MAX_IMAGES_BATCH "1"))) ;; NOTE: only disabled in releases (def local-notifications? (enabled? (get-config :LOCAL_NOTIFICATIONS "1"))) (def blank-preview? (enabled? (get-config :BLANK_PREVIEW "1")))