Allow for env variables for configuring delete-message undo time limit for toasts (#19653)

* tweak: allow for env variable to configure undo-time-limit when deleting a message in chat

* tweak: add env variable undo timeout for deleting messages for everyone

* tweak: extend timeout duration for undo toast when deleting a message for a user

* tweak: extend timeout duration for undo toast when deleting a message for everyone
This commit is contained in:
Sean Hagstrom 2024-04-17 15:12:27 +02:00 committed by GitHub
parent 570c62e30e
commit 8600c1d3a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 2 deletions

View File

@ -35,3 +35,5 @@ LOCAL_PAIRING_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=1 FAST_CREATE_COMMUNITY_ENABLED=1
TEST_NETWORKS_ENABLED=1 TEST_NETWORKS_ENABLED=1
SHOW_NOT_IMPLEMENTED_FEATURES=1 SHOW_NOT_IMPLEMENTED_FEATURES=1
DELETE_MESSAGE_FOR_ME_UNDO_TIME_LIMIT=10000
DELETE_MESSAGE_UNDO_TIME_LIMIT=10000

View File

@ -2,6 +2,7 @@
(:require (:require
[clojure.string :as string] [clojure.string :as string]
[react-native.config :as react-native-config] [react-native.config :as react-native-config]
[status-im.constants :as constants]
[utils.ens.core :as utils.ens] [utils.ens.core :as utils.ens]
[utils.ethereum.chain :as chain])) [utils.ethereum.chain :as chain]))
@ -70,6 +71,18 @@
; currently not supported in status-go ; currently not supported in status-go
(def enable-remove-profile-picture? false) (def enable-remove-profile-picture? false)
(defn env-variable->int
[env-var-name default-value]
(js/parseInt (get-config env-var-name default-value)))
(def delete-message-for-me-undo-time-limit-ms
(env-variable->int :DELETE_MESSAGE_FOR_ME_UNDO_TIME_LIMIT
constants/delete-message-for-me-undo-time-limit-ms))
(def delete-message-undo-time-limit-ms
(env-variable->int :DELETE_MESSAGE_UNDO_TIME_LIMIT
constants/delete-message-undo-time-limit-ms))
(def verify-transaction-chain-id (js/parseInt (get-config :VERIFY_TRANSACTION_CHAIN_ID "1"))) (def verify-transaction-chain-id (js/parseInt (get-config :VERIFY_TRANSACTION_CHAIN_ID "1")))
(def verify-transaction-url (def verify-transaction-url
(if (= :mainnet (chain/chain-id->chain-keyword verify-transaction-chain-id)) (if (= :mainnet (chain/chain-id->chain-keyword verify-transaction-chain-id))

View File

@ -7,6 +7,7 @@
[react-native.gesture :as gesture] [react-native.gesture :as gesture]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.common.contact-list-item.view :as contact-list-item] [status-im.common.contact-list-item.view :as contact-list-item]
[status-im.config :as config]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.chat.messenger.composer.reply.view :as reply] [status-im.contexts.chat.messenger.composer.reply.view :as reply]
[status-im.contexts.chat.messenger.messages.drawers.style :as style] [status-im.contexts.chat.messenger.messages.drawers.style :as style]
@ -140,7 +141,7 @@
(rf/dispatch (rf/dispatch
[:hide-bottom-sheet]) [:hide-bottom-sheet])
(rf/dispatch [:chat.ui/delete-message-for-me message-data (rf/dispatch [:chat.ui/delete-message-for-me message-data
constants/delete-message-for-me-undo-time-limit-ms])) config/delete-message-for-me-undo-time-limit-ms]))
:label (i18n/label :t/delete-for-me) :label (i18n/label :t/delete-for-me)
:icon :i/delete :icon :i/delete
@ -155,7 +156,7 @@
:on-press (fn [] :on-press (fn []
(rf/dispatch [:hide-bottom-sheet]) (rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:chat.ui/delete-message message-data (rf/dispatch [:chat.ui/delete-message message-data
constants/delete-message-undo-time-limit-ms])) config/delete-message-undo-time-limit-ms]))
:label (i18n/label :t/delete-for-everyone) :label (i18n/label :t/delete-for-everyone)
:icon :i/delete :icon :i/delete
:id :delete-for-all}]))) :id :delete-for-all}])))