Rename utils.navigation to events-helper and add docstring to clarify namespace use case (#21093)

This commit is contained in:
Parvesh Monu 2024-08-21 14:26:48 +05:30 committed by GitHub
parent 7b34a4fb1b
commit 32ddf81a5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 16 additions and 16 deletions

View File

@ -3,14 +3,14 @@
[quo.core :as quo]
[react-native.core :as rn]
[status-im.common.data-confirmation-sheet.style :as style]
[status-im.common.events-helper :as events-helper]
[utils.i18n :as i18n]
[utils.navigation :as navigation]
[utils.re-frame :as rf]))
(defn on-choice-callback
[syncing-on-mobile-network?]
(rf/dispatch [:network/set-syncing-on-mobile-network syncing-on-mobile-network?])
(navigation/hide-bottom-sheet))
(events-helper/hide-bottom-sheet))
(def on-wifi-only (partial on-choice-callback false))
(def on-mobile-and-wifi (partial on-choice-callback true))
@ -19,7 +19,7 @@
[]
(let [settings-drawer? (= (rf/sub [:view-id]) :screen/settings.syncing)
syncing-on-mobile-network? (rf/sub [:profile/syncing-on-mobile-network?])]
(rn/use-mount navigation/dismiss-keyboard)
(rn/use-mount events-helper/dismiss-keyboard)
[:<>
[quo/text
{:weight :semi-bold

View File

@ -1,6 +1,6 @@
(ns utils.navigation
"Prefer to declare in this namespace only reusable navigation functions that
aren't better suited in a particular bounded context."
(ns status-im.common.events-helper
"Provides highly reusable dispatch functions to ensure consistency and avoid duplication in managing various events,
including navigation and other actions that affect application behavior."
(:require [utils.re-frame :as rf]))
(defn navigate-back

View File

@ -2,8 +2,8 @@
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im.common.events-helper :as events-helper]
[utils.i18n :as i18n]
[utils.navigation :as navigation]
[utils.re-frame :as rf]))
(defn- open-blocked-users
@ -21,7 +21,7 @@
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press navigation/navigate-back}]
:on-press events-helper/navigate-back}]
[quo/page-top {:title (i18n/label :t/messages)}]
[quo/category
{:label (i18n/label :t/contacts)

View File

@ -2,8 +2,8 @@
(:require
[quo.core :as quo]
[status-im.common.data-confirmation-sheet.view :as data-confirmation-sheet]
[status-im.common.events-helper :as events-helper]
[utils.i18n :as i18n]
[utils.navigation :as navigation]
[utils.re-frame :as rf]))
(defn- open-paired-devices-list
@ -26,7 +26,7 @@
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press navigation/navigate-back}]
:on-press events-helper/navigate-back}]
[quo/page-top {:title (i18n/label :t/syncing)}]
[quo/category
{:data [{:title (i18n/label :t/sync-and-backup)

View File

@ -5,11 +5,11 @@
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[status-im.common.events-helper :as events-helper]
[status-im.contexts.settings.privacy-and-security.profile-picture.view :as profile-picture.view]
[status-im.contexts.settings.privacy-and-security.style :as style]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.navigation :as navigation]
[utils.re-frame :as rf]))
(defn- setting-preview-privacy
@ -68,7 +68,7 @@
{:key :header
:background :blur
:icon-name :i/arrow-left
:on-press navigation/navigate-back}]
:on-press events-helper/navigate-back}]
[quo/standard-title
{:title (i18n/label :t/privacy-and-security)
:container-style style/title-container

View File

@ -4,13 +4,13 @@
[quo.foundations.resources :as resources]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[status-im.common.events-helper :as events-helper]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.common.standard-authentication.core :as standard-auth]
[status-im.contexts.wallet.common.utils.external-links :as external-links]
[status-im.contexts.wallet.swap.set-spending-cap.style :as style]
[utils.address :as address-utils]
[utils.i18n :as i18n]
[utils.navigation :as navigation]
[utils.re-frame :as rf]))
(defn- swap-title
@ -209,7 +209,7 @@
{:footer-container-padding 0
:header [quo/page-nav
{:icon-name :i/close
:on-press navigation/navigate-back
:on-press events-helper/navigate-back
:margin-top 8
:background :blur
:accessibility-label :top-bar}]

View File

@ -2,11 +2,11 @@
(:require [quo.core :as quo]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.common.events-helper :as events-helper]
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.swap.setup-swap.style :as style]
[utils.i18n :as i18n]
[utils.navigation :as navigation]
[utils.re-frame :as rf]))
(defn- data-item
@ -65,7 +65,7 @@
(set-pay-value #(subs % 0 (dec (count %)))))]
[rn/view {:style style/container}
[account-switcher/view
{:on-press navigation/navigate-back
{:on-press events-helper/navigate-back
:icon-name :i/arrow-left
:margin-top (safe-area/get-top)
:switcher-type :select-account}]