Rename utils.navigation to events-helper and add docstring to clarify namespace use case (#21093)
This commit is contained in:
parent
7b34a4fb1b
commit
32ddf81a5e
|
@ -3,14 +3,14 @@
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[status-im.common.data-confirmation-sheet.style :as style]
|
[status-im.common.data-confirmation-sheet.style :as style]
|
||||||
|
[status-im.common.events-helper :as events-helper]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.navigation :as navigation]
|
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn on-choice-callback
|
(defn on-choice-callback
|
||||||
[syncing-on-mobile-network?]
|
[syncing-on-mobile-network?]
|
||||||
(rf/dispatch [:network/set-syncing-on-mobile-network 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-wifi-only (partial on-choice-callback false))
|
||||||
(def on-mobile-and-wifi (partial on-choice-callback true))
|
(def on-mobile-and-wifi (partial on-choice-callback true))
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
[]
|
[]
|
||||||
(let [settings-drawer? (= (rf/sub [:view-id]) :screen/settings.syncing)
|
(let [settings-drawer? (= (rf/sub [:view-id]) :screen/settings.syncing)
|
||||||
syncing-on-mobile-network? (rf/sub [:profile/syncing-on-mobile-network?])]
|
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
|
[quo/text
|
||||||
{:weight :semi-bold
|
{:weight :semi-bold
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns utils.navigation
|
(ns status-im.common.events-helper
|
||||||
"Prefer to declare in this namespace only reusable navigation functions that
|
"Provides highly reusable dispatch functions to ensure consistency and avoid duplication in managing various events,
|
||||||
aren't better suited in a particular bounded context."
|
including navigation and other actions that affect application behavior."
|
||||||
(:require [utils.re-frame :as rf]))
|
(:require [utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn navigate-back
|
(defn navigate-back
|
|
@ -2,8 +2,8 @@
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
|
[status-im.common.events-helper :as events-helper]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.navigation :as navigation]
|
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- open-blocked-users
|
(defn- open-blocked-users
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
[quo/page-nav
|
[quo/page-nav
|
||||||
{:background :blur
|
{:background :blur
|
||||||
:icon-name :i/arrow-left
|
: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/page-top {:title (i18n/label :t/messages)}]
|
||||||
[quo/category
|
[quo/category
|
||||||
{:label (i18n/label :t/contacts)
|
{:label (i18n/label :t/contacts)
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[status-im.common.data-confirmation-sheet.view :as data-confirmation-sheet]
|
[status-im.common.data-confirmation-sheet.view :as data-confirmation-sheet]
|
||||||
|
[status-im.common.events-helper :as events-helper]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.navigation :as navigation]
|
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- open-paired-devices-list
|
(defn- open-paired-devices-list
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
[quo/page-nav
|
[quo/page-nav
|
||||||
{:background :blur
|
{:background :blur
|
||||||
:icon-name :i/arrow-left
|
: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/page-top {:title (i18n/label :t/syncing)}]
|
||||||
[quo/category
|
[quo/category
|
||||||
{:data [{:title (i18n/label :t/sync-and-backup)
|
{:data [{:title (i18n/label :t/sync-and-backup)
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[react-native.platform :as platform]
|
[react-native.platform :as platform]
|
||||||
[react-native.safe-area :as safe-area]
|
[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.profile-picture.view :as profile-picture.view]
|
||||||
[status-im.contexts.settings.privacy-and-security.style :as style]
|
[status-im.contexts.settings.privacy-and-security.style :as style]
|
||||||
[status-im.feature-flags :as ff]
|
[status-im.feature-flags :as ff]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.navigation :as navigation]
|
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- setting-preview-privacy
|
(defn- setting-preview-privacy
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
{:key :header
|
{:key :header
|
||||||
:background :blur
|
:background :blur
|
||||||
:icon-name :i/arrow-left
|
:icon-name :i/arrow-left
|
||||||
:on-press navigation/navigate-back}]
|
:on-press events-helper/navigate-back}]
|
||||||
[quo/standard-title
|
[quo/standard-title
|
||||||
{:title (i18n/label :t/privacy-and-security)
|
{:title (i18n/label :t/privacy-and-security)
|
||||||
:container-style style/title-container
|
:container-style style/title-container
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
[quo.foundations.resources :as resources]
|
[quo.foundations.resources :as resources]
|
||||||
[quo.theme :as quo.theme]
|
[quo.theme :as quo.theme]
|
||||||
[react-native.core :as rn]
|
[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.floating-button-page.view :as floating-button-page]
|
||||||
[status-im.common.standard-authentication.core :as standard-auth]
|
[status-im.common.standard-authentication.core :as standard-auth]
|
||||||
[status-im.contexts.wallet.common.utils.external-links :as external-links]
|
[status-im.contexts.wallet.common.utils.external-links :as external-links]
|
||||||
[status-im.contexts.wallet.swap.set-spending-cap.style :as style]
|
[status-im.contexts.wallet.swap.set-spending-cap.style :as style]
|
||||||
[utils.address :as address-utils]
|
[utils.address :as address-utils]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.navigation :as navigation]
|
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- swap-title
|
(defn- swap-title
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
{:footer-container-padding 0
|
{:footer-container-padding 0
|
||||||
:header [quo/page-nav
|
:header [quo/page-nav
|
||||||
{:icon-name :i/close
|
{:icon-name :i/close
|
||||||
:on-press navigation/navigate-back
|
:on-press events-helper/navigate-back
|
||||||
:margin-top 8
|
:margin-top 8
|
||||||
:background :blur
|
:background :blur
|
||||||
:accessibility-label :top-bar}]
|
:accessibility-label :top-bar}]
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
(:require [quo.core :as quo]
|
(:require [quo.core :as quo]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[react-native.safe-area :as safe-area]
|
[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.account-switcher.view :as account-switcher]
|
||||||
[status-im.contexts.wallet.common.utils :as utils]
|
[status-im.contexts.wallet.common.utils :as utils]
|
||||||
[status-im.contexts.wallet.swap.setup-swap.style :as style]
|
[status-im.contexts.wallet.swap.setup-swap.style :as style]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.navigation :as navigation]
|
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- data-item
|
(defn- data-item
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
(set-pay-value #(subs % 0 (dec (count %)))))]
|
(set-pay-value #(subs % 0 (dec (count %)))))]
|
||||||
[rn/view {:style style/container}
|
[rn/view {:style style/container}
|
||||||
[account-switcher/view
|
[account-switcher/view
|
||||||
{:on-press navigation/navigate-back
|
{:on-press events-helper/navigate-back
|
||||||
:icon-name :i/arrow-left
|
:icon-name :i/arrow-left
|
||||||
:margin-top (safe-area/get-top)
|
:margin-top (safe-area/get-top)
|
||||||
:switcher-type :select-account}]
|
:switcher-type :select-account}]
|
||||||
|
|
Loading…
Reference in New Issue