remove unused replace-view function

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2018-09-26 20:00:43 +02:00
parent 21cc106ed3
commit ba86b84f25
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
7 changed files with 6 additions and 32 deletions

View File

@ -115,7 +115,7 @@
(fx/merge cofx
(models/add-public-chat topic)
(models/navigate-to-chat topic {:modal? modal?
:navigation-replace? true})
:navigation-reset? true})
(public-chat/join-public-chat topic)))
(handlers/register-handler-fx

View File

@ -172,14 +172,14 @@
(fx/defn navigate-to-chat
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
[cofx chat-id {:keys [modal? navigation-replace?]}]
[cofx chat-id {:keys [modal? navigation-reset?]}]
(cond
modal?
(fx/merge cofx
(navigation/navigate-to-cofx :chat-modal {})
(preload-chat-data chat-id))
navigation-replace?
navigation-reset?
(fx/merge cofx
(navigation/navigate-reset {:index 1
:actions [{:routeName :home}

View File

@ -15,7 +15,7 @@
(defn- render-row [row _ _]
[contact-view/contact-view {:contact row
:on-press #(re-frame/dispatch [:start-chat (:whisper-identity %) {:navigation-replace? true}])
:on-press #(re-frame/dispatch [:start-chat (:whisper-identity %) {:navigation-reset? true}])
:show-forward? true}])
(views/defview new-chat []

View File

@ -15,7 +15,7 @@
[cofx whisper-id]
(fx/merge cofx
(models.contact/add-contact whisper-id)
(chat.models/start-chat whisper-id {:navigation-replace? true})))
(chat.models/start-chat whisper-id {:navigation-reset? true})))
(re-frame/reg-cofx
:get-default-contacts

View File

@ -30,10 +30,6 @@
{:db (push-view db view-id)
::navigate-to-clean view-id}))
(fx/defn replace-view
[_ view-id]
{::navigate-replace view-id})
(fx/defn navigate-forget
[{:keys [db]} view-id]
{:db (assoc db :view-id view-id)})
@ -96,12 +92,6 @@
(log/debug :navigate-back)
(navigation/navigate-back)))
(re-frame/reg-fx
::navigate-replace
(fn [view-id]
(log/debug :navigate-replace view-id)
(navigation/navigate-replace view-id)))
(re-frame/reg-fx
::navigate-reset
(fn [config]
@ -130,12 +120,6 @@
(fn [{:keys [db]} [_ modal-view]]
{:db (assoc db :modal modal-view)}))
(handlers/register-handler-fx
:navigation-replace
navigation-interceptors
(fn [cofx [_ view-id]]
(replace-view cofx view-id)))
(fx/defn navigate-back
[{{:keys [navigation-stack view-id] :as db} :db}]
(assoc

View File

@ -24,7 +24,7 @@
(defn send-transaction [chat-id {:keys [db] :as cofx}]
(let [send-command (get-in db [:id->command ["send" #{:personal-chats}]])]
(fx/merge cofx
(chat-models/start-chat chat-id {:navigation-replace? true})
(chat-models/start-chat chat-id {:navigation-reset? true})
(commands-input/select-chat-input-command send-command nil))))
(defn- valid-name? [name]

View File

@ -30,16 +30,6 @@
navigation-actions
#js {:routeName (name route)}))))
;; 'Navigation/REPLACE'
;; https://github.com/react-navigation/react-navigation/blob/master/src/routers/StackActions.js#L5
(defn navigate-replace [route]
(when (can-be-called?)
(.dispatch
@navigator-ref
(.replace
stack-actions
#js {:routeName (name route)}))))
(defn- navigate [params]
(when (can-be-called?)
(.navigate navigation-actions (clj->js params))))