Skip to content

Commit

Permalink
Allow for env variables for configuring delete-message undo time limi…
Browse files Browse the repository at this point in the history
…t 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
  • Loading branch information
seanstrom authored Apr 17, 2024
1 parent 570c62e commit 8600c1d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ LOCAL_PAIRING_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=1
TEST_NETWORKS_ENABLED=1
SHOW_NOT_IMPLEMENTED_FEATURES=1
DELETE_MESSAGE_FOR_ME_UNDO_TIME_LIMIT=10000
DELETE_MESSAGE_UNDO_TIME_LIMIT=10000
13 changes: 13 additions & 0 deletions src/status_im/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:require
[clojure.string :as string]
[react-native.config :as react-native-config]
[status-im.constants :as constants]
[utils.ens.core :as utils.ens]
[utils.ethereum.chain :as chain]))

Expand Down Expand Up @@ -70,6 +71,18 @@
; currently not supported in status-go
(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-url
(if (= :mainnet (chain/chain-id->chain-keyword verify-transaction-chain-id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[react-native.gesture :as gesture]
[reagent.core :as reagent]
[status-im.common.contact-list-item.view :as contact-list-item]
[status-im.config :as config]
[status-im.constants :as constants]
[status-im.contexts.chat.messenger.composer.reply.view :as reply]
[status-im.contexts.chat.messenger.messages.drawers.style :as style]
Expand Down Expand Up @@ -140,7 +141,7 @@
(rf/dispatch
[:hide-bottom-sheet])
(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)
:icon :i/delete
Expand All @@ -155,7 +156,7 @@
:on-press (fn []
(rf/dispatch [:hide-bottom-sheet])
(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)
:icon :i/delete
:id :delete-for-all}])))
Expand Down

0 comments on commit 8600c1d

Please sign in to comment.