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 (fx/merge cofx
(models/add-public-chat topic) (models/add-public-chat topic)
(models/navigate-to-chat topic {:modal? modal? (models/navigate-to-chat topic {:modal? modal?
:navigation-replace? true}) :navigation-reset? true})
(public-chat/join-public-chat topic))) (public-chat/join-public-chat topic)))
(handlers/register-handler-fx (handlers/register-handler-fx

View File

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

View File

@ -15,7 +15,7 @@
(defn- render-row [row _ _] (defn- render-row [row _ _]
[contact-view/contact-view {:contact 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}]) :show-forward? true}])
(views/defview new-chat [] (views/defview new-chat []

View File

@ -15,7 +15,7 @@
[cofx whisper-id] [cofx whisper-id]
(fx/merge cofx (fx/merge cofx
(models.contact/add-contact whisper-id) (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 (re-frame/reg-cofx
:get-default-contacts :get-default-contacts

View File

@ -30,10 +30,6 @@
{:db (push-view db view-id) {:db (push-view db view-id)
::navigate-to-clean view-id})) ::navigate-to-clean view-id}))
(fx/defn replace-view
[_ view-id]
{::navigate-replace view-id})
(fx/defn navigate-forget (fx/defn navigate-forget
[{:keys [db]} view-id] [{:keys [db]} view-id]
{:db (assoc db :view-id view-id)}) {:db (assoc db :view-id view-id)})
@ -96,12 +92,6 @@
(log/debug :navigate-back) (log/debug :navigate-back)
(navigation/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 (re-frame/reg-fx
::navigate-reset ::navigate-reset
(fn [config] (fn [config]
@ -130,12 +120,6 @@
(fn [{:keys [db]} [_ modal-view]] (fn [{:keys [db]} [_ modal-view]]
{:db (assoc db :modal 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 (fx/defn navigate-back
[{{:keys [navigation-stack view-id] :as db} :db}] [{{:keys [navigation-stack view-id] :as db} :db}]
(assoc (assoc

View File

@ -24,7 +24,7 @@
(defn send-transaction [chat-id {:keys [db] :as cofx}] (defn send-transaction [chat-id {:keys [db] :as cofx}]
(let [send-command (get-in db [:id->command ["send" #{:personal-chats}]])] (let [send-command (get-in db [:id->command ["send" #{:personal-chats}]])]
(fx/merge cofx (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)))) (commands-input/select-chat-input-command send-command nil))))
(defn- valid-name? [name] (defn- valid-name? [name]

View File

@ -30,16 +30,6 @@
navigation-actions navigation-actions
#js {:routeName (name route)})))) #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] (defn- navigate [params]
(when (can-be-called?) (when (can-be-called?)
(.navigate navigation-actions (clj->js params)))) (.navigate navigation-actions (clj->js params))))