-
Notifications
You must be signed in to change notification settings - Fork 979
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#6382]: Makes extensions dev-mode aware
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
- Loading branch information
Showing
9 changed files
with
79 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
(ns status-im.ui.screens.extensions.add.events | ||
(:require [re-frame.core :as re-frame] | ||
(:require [pluto.registry :as registry] | ||
[re-frame.core :as re-frame] | ||
[status-im.extensions.core :as extensions] | ||
[status-im.ui.screens.navigation :as navigation] | ||
[status-im.utils.handlers :as handlers] | ||
[status-im.utils.fx :as fx])) | ||
|
||
(re-frame/reg-fx | ||
:extension/load | ||
(fn [[url follow-up-event]] | ||
(extensions/load-from url #(re-frame/dispatch [follow-up-event (-> % extensions/read-extension extensions/parse)])))) | ||
:extensions/load | ||
(fn [{:keys [extensions follow-up]}] | ||
(doseq [{:keys [url active?]} extensions] | ||
(extensions/load-from url #(re-frame/dispatch [follow-up (-> % extensions/read-extension extensions/parse) active?]))))) | ||
|
||
(handlers/register-handler-fx | ||
:extension/stage | ||
:extensions/stage | ||
(fn [{:keys [db] :as cofx} [_ extension-data]] | ||
(fx/merge cofx | ||
{:db (assoc db :staged-extension extension-data)} | ||
(navigation/navigate-to-cofx :show-extension nil)))) | ||
|
||
(handlers/register-handler-fx | ||
:extension/add | ||
(fn [cofx [_ data active?]] | ||
(extensions/add cofx data active?))) | ||
:extensions/add | ||
(fn [cofx [_ {:keys [data]} active?]] | ||
(extensions/add cofx data active?))) | ||
|
||
(handlers/register-handler-fx | ||
:extensions/deactivate-all | ||
(fn [cofx [_ extensions]] | ||
(apply fx/merge cofx (map (fn [{:keys [name]}] | ||
(partial registry/deactivate name)) | ||
extensions)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters