[#7422] Show feedback on mailserver error
This commit is contained in:
parent
5fe9e3d156
commit
b96063ce56
|
@ -361,8 +361,22 @@
|
|||
"mark mailserver status as `:error` if custom mailserver is used
|
||||
otherwise try to reconnect to another mailserver"
|
||||
[{:keys [db] :as cofx}]
|
||||
(if (preferred-mailserver-id cofx)
|
||||
{:db (update-mailserver-state db :error)}
|
||||
(if-let [preferred-mailserver (preferred-mailserver-id cofx)]
|
||||
(let [current-fleet (fleet/current-fleet db)]
|
||||
{:db
|
||||
(update-mailserver-state db :error)
|
||||
:ui/show-confirmation
|
||||
{:title (i18n/label :t/mailserver-error-title)
|
||||
:content (i18n/label :t/mailserver-error-content)
|
||||
:confirm-button-text (i18n/label :t/mailserver-pick-another)
|
||||
:on-accept #(re-frame/dispatch
|
||||
[:navigate-to :offline-messaging-settings])
|
||||
:extra-options [{:text (i18n/label :t/mailserver-retry)
|
||||
:onPress #(re-frame/dispatch
|
||||
[:mailserver.ui/connect-confirmed
|
||||
current-fleet
|
||||
preferred-mailserver])
|
||||
:style "default"}]}})
|
||||
(let [{:keys [address]} (fetch-current cofx)]
|
||||
(fx/merge cofx
|
||||
{:mailserver/remove-peer address}
|
||||
|
@ -384,7 +398,7 @@
|
|||
(fx/merge cofx
|
||||
{:db (dissoc db :mailserver/connection-checks)}
|
||||
(when (= :connecting (:mailserver/state db))
|
||||
(change-mailserver cofx)))
|
||||
(change-mailserver)))
|
||||
{:db (update db :mailserver/connection-checks dec)}))))
|
||||
|
||||
(fx/defn reset-request-to
|
||||
|
|
|
@ -24,20 +24,23 @@
|
|||
(show-popup title content on-dismiss)))
|
||||
|
||||
(defn show-confirmation
|
||||
[{:keys [title content confirm-button-text on-dismiss on-accept on-cancel cancel-button-text]}]
|
||||
[{:keys [title content confirm-button-text on-dismiss on-accept on-cancel cancel-button-text
|
||||
extra-options]}]
|
||||
(.alert (.-Alert rn-dependencies/react-native)
|
||||
title
|
||||
content
|
||||
;; Styles are only relevant on iOS. On Android first button is 'neutral' and second is 'positive'
|
||||
(clj->js
|
||||
(vector (merge {:text (or cancel-button-text (i18n/label :t/cancel))
|
||||
:style "cancel"
|
||||
:accessibility-label :cancel-button}
|
||||
(when on-cancel {:onPress on-cancel}))
|
||||
{:text (or confirm-button-text (i18n/label :t/ok))
|
||||
:onPress on-accept
|
||||
:style "default"
|
||||
:accessibility-label :confirm-button}))
|
||||
(concat
|
||||
(vector (merge {:text (or cancel-button-text (i18n/label :t/cancel))
|
||||
:style "cancel"
|
||||
:accessibility-label :cancel-button}
|
||||
(when on-cancel {:onPress on-cancel}))
|
||||
{:text (or confirm-button-text (i18n/label :t/ok))
|
||||
:onPress on-accept
|
||||
:style "default"
|
||||
:accessibility-label :confirm-button})
|
||||
(or extra-options nil)))
|
||||
#js {:cancelable false}))
|
||||
|
||||
(re-frame/reg-fx
|
||||
|
|
|
@ -901,5 +901,9 @@
|
|||
"sticker-market": "Sticker market",
|
||||
"you-dont-have-stickers": "You don’t have any stickers yet",
|
||||
"get-stickers": "Get Stickers",
|
||||
"recently-used-stickers": "Recently used stickers will appear here"
|
||||
"recently-used-stickers": "Recently used stickers will appear here",
|
||||
"mailserver-retry": "Retry",
|
||||
"mailserver-pick-another": "Pick another mailserver",
|
||||
"mailserver-error-title": "Error connecting to mailserver",
|
||||
"mailserver-error-content": "The mailserver you selected couldn't be reached."
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue