-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(settings): Show current mailserver in legacy settings (#21901)
A regression removed more code than we wanted in #20730 and the result was broken functionality in the Legacy settings. We now show the current mailserver correctly. The data is kept in sync via signals, just as the original code. Fixes #21375
- Loading branch information
Showing
10 changed files
with
64 additions
and
155 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(ns ^{:doc "Mailserver events and API"} legacy.status-im.mailserver.core | ||
(:require | ||
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update] | ||
[taoensso.timbre :as log] | ||
[utils.re-frame :as rf])) | ||
|
||
(rf/defn handle-mailserver-changed | ||
[{:keys [db]} ms] | ||
(when (seq ms) | ||
{:db (assoc db :mailserver/current-id (keyword ms))})) | ||
|
||
(rf/defn handle-mailserver-available | ||
[{:keys [db]} ms] | ||
{:db (assoc db :mailserver/current-id (keyword ms))}) | ||
|
||
(rf/defn toggle-use-mailservers | ||
[_ value] | ||
{:json-rpc/call | ||
[{:method "wakuext_toggleUseMailservers" | ||
:params [value] | ||
:on-success #(log/info "successfully toggled use-mailservers" value) | ||
:on-error #(log/error "failed to toggle use-mailserver" value %)}]}) | ||
|
||
(rf/defn update-use-mailservers | ||
{:events [:mailserver.ui/use-history-switch-pressed]} | ||
[cofx use-mailservers?] | ||
(rf/merge cofx | ||
(multiaccounts.update/optimistic :use-mailservers? use-mailservers?) | ||
(toggle-use-mailservers use-mailservers?))) | ||
|
||
(defn add-mailservers | ||
[db mailservers] | ||
(reduce (fn [db {:keys [fleet id name] :as mailserver}] | ||
(let [updated-mailserver | ||
(-> mailserver | ||
(update :id keyword) | ||
(assoc :name (if (seq name) name id)) | ||
(dissoc :fleet))] | ||
(assoc-in db | ||
[:mailserver/mailservers (keyword fleet) (keyword id)] | ||
updated-mailserver))) | ||
db | ||
mailservers)) |
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
41 changes: 0 additions & 41 deletions
41
src/legacy/status_im/ui/screens/offline_messaging_settings/styles.cljs
This file was deleted.
Oops, something went wrong.
88 changes: 0 additions & 88 deletions
88
src/legacy/status_im/ui/screens/offline_messaging_settings/views.cljs
This file was deleted.
Oops, something went wrong.
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