From 7c04bb907677ea7303b9bc61ffa3ecb83cb7543e Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 10 Feb 2021 11:34:36 +0100 Subject: [PATCH] [#11716] Implement new Connectivity dialogues and remove 'Offline' snackbars Signed-off-by: andrey --- resources/images/icons/mobile_sync@2x.png | Bin 0 -> 867 bytes resources/images/icons/mobile_sync@3x.png | Bin 0 -> 1241 bytes resources/images/icons/mobile_sync_off@2x.png | Bin 0 -> 1044 bytes resources/images/icons/mobile_sync_off@3x.png | Bin 0 -> 1564 bytes resources/images/icons/node_offline@2x.png | Bin 0 -> 1114 bytes resources/images/icons/node_offline@3x.png | Bin 0 -> 1721 bytes resources/images/icons/offline@2x.png | Bin 0 -> 933 bytes resources/images/icons/offline@3x.png | Bin 0 -> 1345 bytes src/quo/components/button/view.cljs | 3 + src/quo/components/list/item.cljs | 4 +- src/status_im/subs.cljs | 63 ++-- .../ui/components/connectivity/styles.cljs | 17 - .../ui/components/connectivity/view.cljs | 316 ++++++------------ src/status_im/ui/screens/chat/views.cljs | 20 +- src/status_im/ui/screens/home/views.cljs | 16 +- .../mobile_network_settings/events.cljs | 1 - .../mobile_network_settings/sheets.cljs | 13 +- .../screens/mobile_network_settings/view.cljs | 9 +- .../ui/screens/sync_settings/views.cljs | 7 +- translations/en.json | 16 +- 20 files changed, 195 insertions(+), 290 deletions(-) create mode 100644 resources/images/icons/mobile_sync@2x.png create mode 100644 resources/images/icons/mobile_sync@3x.png create mode 100644 resources/images/icons/mobile_sync_off@2x.png create mode 100644 resources/images/icons/mobile_sync_off@3x.png create mode 100644 resources/images/icons/node_offline@2x.png create mode 100644 resources/images/icons/node_offline@3x.png create mode 100644 resources/images/icons/offline@2x.png create mode 100644 resources/images/icons/offline@3x.png delete mode 100644 src/status_im/ui/components/connectivity/styles.cljs diff --git a/resources/images/icons/mobile_sync@2x.png b/resources/images/icons/mobile_sync@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..341c4d6995067ceb6f9fa337b097e4f46132a056 GIT binary patch literal 867 zcmV-p1DyPcP)a)Jwe$MY>xmppa*C}BxqH2Y0C);Cs?sms=BNcP%qFMz!BgCaD(oDh^HQh z5R>v{ry^aEM_K`9ZO@zeaF_rT6kIk8&dlBSpbQRF>kv?YMRv zKHrs?stT3h6)a^1O2vDBFdE7iFBuWlR@0xr0jvd(;V$w3b|qxIID>jxgkFUhW5eY# z?CL`LgW*{7#H7{qs&D|SBv!@)A0IM)AE>`ath*&XR$f`NTA?pr;-aN;)5Z&t zv72+kU1@u!FcyGXy+(v7WFV?ANjN!6sKxJP7|pbO%KO$h`$_zl0f=pB;6jCC2$OhR z2(IPDHa~X{WTg<0H~)oz`-hUL7xlt$W zUvt?ZM8B3W6joj37Yxf_L2Dk thiZQ#zY!>|Oy*H8(Vwm11qB5We*jSrG$i}Ek@^4t002ovPDHLkV1g>Ie3}3N literal 0 HcmV?d00001 diff --git a/resources/images/icons/mobile_sync@3x.png b/resources/images/icons/mobile_sync@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..3e5dfea8bdad404e8a7c2f79d4ecfb5107b61703 GIT binary patch literal 1241 zcmV;~1Sb25P)T z=@}=qWNc?_ID_hFKFP{uEXV$HZgT_hcsw4D$MXaP>1casCg940RxqBF^zucpeEjv5_JVQk9jVqA-9Wf<-+!-un&)*QUaN@ zPNF(F!4kdAb}JG|Ncr*eBZ7FP1-c`#tNA^V zIM@V`b^2JhosWQfYb%S}dF|suaVPnpu!}-n}3QE9U2PFX$>EA0Uj+LxJk?Nix5WRzM z(U#e?u@X|ZM0L&c%NCOC0#Ti!O}l)D5@CN@9GX@rq7cn2k>Xf|sp}|Mf>O7|$iZ>6 zgqQ@#NfhkU174$`PNsrXkQMY@ky>SReQe~UbGnXvV_v6qd`7OWK1`ljJQfAO2#K?4 zem5RV98NMnEx7_iI12WbmlAPZg~3tk`# zULXrzAPZg~3tk`#ULXrzAPY_fLJ-fP;;>FVn<#`m8qEI8c!4ZuszwUIQbnSxmcG4W!<35VU92!k6cD_n`<@pwEQ&us7q9>%0LN2pSq00000NkvXXu0mjf D%2yuv literal 0 HcmV?d00001 diff --git a/resources/images/icons/mobile_sync_off@2x.png b/resources/images/icons/mobile_sync_off@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..82e6ccbcb28e5cf1ec530f20c23d6be5bfd33582 GIT binary patch literal 1044 zcmV+v1nc{WP)6VMy1|3mD( z7aD4k0I~CI%MW0~ z_}p9JJ!%`i*34LlZcDH*P!X=a>+2kviKy;FvE4e1N$&V z5A?}-SZ-_R<5&B+L^L}`&Is}dNE5*r^Q8#a@L9~GELYCpATC1nLR8Om8gx}5y}o~^ z%*3d3)NaBWHh7^qI0~+6*iy;^?8LWqonM9Og{U5Thu^8*XEu`#enqjN(W4n&LnZ-4 zT!ac^(icK>)lb^!6QLIZIf7?J^-zT8g+@%XfzMwmU0myxGA$vMq)osWr}+(N(i?a! z^ga|Y!;aH(IywA6qYos;p7B4?y)#?vu8P>1XCNYFCiYF@MCZ`C#d_XF|7kfbW?|mh zMVzo_X!I-477#X`5MdVV<{svGIayO^Eov0vKKd=?YFjfB@YJ|lga|I>Id=BfSXnxN81MCR2A%2ky`-qk|MMPgkj&ZE;t0;&&STf&|XS}wheF&7{p{tu;l<$ zluc;&2h6F3ViZh8&>`x2Fl>VXc?6`QDpq%}_uh-5$@1C-beQnYj_=?kVvE zIg#O#6wP?&pW1OZZ99rcY~c$I{#r<}tMeS$5`8wkz#z(e?Ym{mzs_G7P7{$u8heTW O0000WY0wk^gsajab2^LNeAXKX*QJrvsr6*YE1=t(F4NCu8 z31_D7*`}M=V|(n(#LmheDawy=%=nu(@4fN70idCwp`oGSyQP2SZPEj3K;QG$=>bcG zWi?(5ulo$-ad;p*JJ{RlK}8I%CP&zbv*_&;KE4Pc?gWFI-oE<GHJmOXSJcFz2Pr&4x`6Kmxkpl)GOG1(8rBbBlXL-74 zMoYZgcgOfNripY5_@{U#Em+`lw&uRXrspW#oIpbGHa^{g1`7?bS+a)P+FI*97=(u6 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Nsi0ce7PAuz?kvQB`P z20y!Cpc}k^7|S_p&*xKUfdPy&kV27(`pNb0*Nkr)_E*Jzbd`b{2_&xE-Fq{KN)w+UHfqjX-;NujKXI7wn71d4F>K09`O z5`4byCusI`XRRb4p1f=elE6{!FB-My=MBH7nqx~MQRT%$xrNIkv zirJBlSFs^M2$4TuD=2Kgv8;}S$N^XoaAK&N+5#D-BpBmA6on0)*3+G{8t% zQ<#uwo%sQ(v5#7S9#|s)p6;( zY7*Atx!1w8^>h@`6gniP_g$3I`#4_})dZeF4+D>8yA^kjj{XM;RN_z?K2`~8QESly zsZAm}1~@pd>D`neCw83NpdAp_-AfO}F*`6KAdt4&GczJ=aNaULSxe-w`!J9LQhj4f z=rkMZPK8cu5p6XMiEgV<7x*BW8JnUaK?on5pVa+Tmnju8;XfvO?1%tsOYgz493fUzj!^8ku_k|uBx+J!ifIyans)PM#X3hqxcj8In gDgEuc!w!#)f40~@Fy()4F8}}l07*qoM6N<$f-^+zDgXcg literal 0 HcmV?d00001 diff --git a/resources/images/icons/node_offline@3x.png b/resources/images/icons/node_offline@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..4d44df801a73f8371d2f8ae6271e4d31ec6048b9 GIT binary patch literal 1721 zcmV;q21fabP)IG`| z0v-L1NT9ov(wH9rK@yZQk=_|a2}nxR!^L9p0uz9>)>><=wbuG()$Mst=mje(t~+?q zf7^8#|46SZ{5!0mnCbvU4S|WA%-G;???nq%NIcKUQp)Dl^;-{CNJ>EMgVq?|hVk}Q zgT%5m%wcUTJ>e7JA_(z=HQ%LovuYDitrtGQF& zz&qN(e^OadOF3c7#zvq-VdaeQHQ!G z07SYc&KY-Tw1kqf28g7Br1;{Ftpbm7mk{DrthwfVf+m!dRX`*|NRz|8h7m|piAQ1b zk3 zDoi)#zx>z?t+VBnnNJEeQ~XF4aD+&+pLO_gu-} zU0x6G(n5NXkZh|EAeu7Ft70k)zdRucR4u3e;6*@kL^3J+eoD8?phN(w6s?LSnKWYZ*gH83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:t/peer-to-peer)] + (if (= peers :offline) + [quo/list-item + {:title (i18n/label :t/not-connected-to-peers) + :accessibility-label "not-connected-to-peers" + :subtitle (i18n/label :t/unable-to-send-messages) + :theme :negative + :icon :main-icons/network}] + [quo/list-item + {:title (str (i18n/label :t/connected-to) " " peers-count " " (string/lower-case (i18n/label :t/peers))) + :accessibility-label "connected-to-n-peers" + :subtitle (i18n/label :t/can-send-messages) + :theme :positive + :icon :main-icons/network}]) + [quo/list-header (i18n/label :t/history-nodes)] + (cond + (#{:error :offline} node) + [quo/list-item + {:title (i18n/label :t/not-connected-nodes) + :accessibility-label "not-connected-nodes" + :subtitle (i18n/label :t/unable-to-fetch) + :theme :negative + :icon :main-icons/mailserver}] + (= node :disabled) + [quo/list-item + {:title (i18n/label :t/nodes-disabled) + :accessibility-label "nodes-disabled" + :subtitle (i18n/label :t/unable-to-fetch) + :disabled true + :icon :main-icons/mailserver}] + (and mobile (not sync)) + [quo/list-item + {:title (i18n/label :t/waiting-wi-fi) + :accessibility-label "waiting-wi-fi" + :subtitle (i18n/label :t/unable-to-fetch) + :disabled true + :icon :main-icons/mailserver}] + (= node :connecting) + [quo/list-item + {:title (i18n/label :t/connecting) + :accessibility-label "connecting" + :subtitle (i18n/label :t/unable-to-fetch) + :icon :main-icons/mailserver}] + (= node :online) + [quo/list-item + {:title (str (i18n/label :t/connected-to) " " current-mailserver-name) + :accessibility-label "connected-to-mailserver" + :subtitle (i18n/label :t/you-can-fetch) + :theme :positive + :icon :main-icons/mailserver}]) + [quo/list-item + {:title (i18n/label :t/settings) + :accessibility-label "settings" + :theme :accent + :on-press #(hide-sheet-and-dispatch [:navigate-to :profile-stack {:screen :sync-settings}]) + :icon :main-icons/settings}] + (when mobile + [:<> + [react/view {:margin-vertical 8 :background-color colors/gray-lighter :height 36 + :align-items :center :justify-content :center} + [react/text {:style {:color colors/gray}} (i18n/label :t/youre-on-mobile-network)]] + [quo/list-item + {:title (i18n/label :t/mobile-network-use-mobile) + :accessibility-label "mobile-network-use-mobile" + :accessory :switch + :on-press #(re-frame/dispatch [:mobile-network/set-syncing (not syncing-on-mobile-network?)]) + :active syncing-on-mobile-network?}] + [react/text {:style {:margin-horizontal 16 :margin-bottom 12 :color colors/gray}} + (i18n/label :t/status-mobile-descr)]])])) -(defn connectivity-status-comp - [_ _] - (let [height (reagent/atom 36)] - (fn [props status-hidden] - [react/view {} - (when-not @status-hidden - [react/text {:style (merge styles/text {:position :absolute - :opacity 0}) - :on-layout (fn [e] - (let [h (-> e .-nativeEvent .-layout .-height)] - (reset! height (+ h (* (:top styles/text) 2)))))} - (i18n/label (:message props))]) - [connectivity-status props status-hidden height]]))) +(defn get-icon [{:keys [peers node mobile sync]}] + (if (= peers :offline) + :main-icons/offline + (if mobile + (if sync :main-icons/mobile-sync :main-icons/mobile-sync-off) + (when (#{:error :disabled} node) :main-icons/node-offline)))) -;; timer updating the enqueued status -(def timer (atom nil)) - -;; connectivity status change going to be persisted to :connectivity/ui-status-properties -(def enqueued-connectivity-status-properties (atom nil)) - -(defn propagate-status - "Smoothly propagate from :connectivity/status-properties subscription to -:ui-status-properties db. UI components will render based on :ui-status-properties" - [{:keys [status-properties app-active-since logged-in-since ui-status-properties]}] - (when (or (and (nil? @enqueued-connectivity-status-properties) - (not= status-properties ui-status-properties)) - (and (some? @enqueued-connectivity-status-properties) - (not= status-properties @enqueued-connectivity-status-properties))) - ;; reset queued with new state and start a timer if not yet started - (reset! enqueued-connectivity-status-properties status-properties) - (when-not @timer - (reset! - timer - (utils/set-timeout - #(do - (reset! timer nil) - (when @enqueued-connectivity-status-properties - (re-frame/dispatch [:set - :connectivity/ui-status-properties - @enqueued-connectivity-status-properties]) - (reset! enqueued-connectivity-status-properties nil))) - - ;; timeout choice: - ;; if the app is in foreground or logged-in for less than , - ;; postpone state changes for otherwise - (let [ts (max - (or logged-in-since 0) - (or app-active-since 0)) - ts-diff (- (datetime/timestamp) ts) - timeout (if (< ts-diff timewindow-for-long-delay) - long-delay - standard-delay)] - (log/debug "propagate-status set-timeout: " logged-in-since app-active-since ts-diff timeout) - timeout)))))) - -(defn status-propagator-dummy-view - "this empty view is needed to react propagate status-properties to ui-status-properties" - [props] - (reagent/create-class - {:component-did-mount - #(propagate-status props) - :should-component-update - (fn [_ _ [_ props]] - (propagate-status props) - false) - :reagent-render - #()})) - -(defview connectivity [header footer] - (letsubs [status-properties [:connectivity/status-properties] - app-active-since [:app-active-since] - logged-in-since [:logged-in-since] - ui-status-properties [:connectivity/ui-status-properties] - status-hidden (reagent/atom true) - window-width (reagent/atom 0)] - (let [loading-indicator? (:loading-indicator? ui-status-properties)] - [react/view {:style {:flex 1} - :on-layout #(reset! window-width (-> ^js % .-nativeEvent .-layout .-width))} - [react/view {:style {:z-index 2 :background-color colors/white}} - header - [react/view - (when (and loading-indicator? @status-hidden) - [loading-indicator @window-width])]] - [connectivity-status-comp - (merge (or ui-status-properties - {:connected? true :message :t/connected}) - {:window-width @window-width}) - status-hidden] - ;;TODO this is something weird, rework - [status-propagator-dummy-view {:status-properties status-properties - :app-active-since app-active-since - :logged-in-since logged-in-since - :ui-status-properties ui-status-properties}] - footer]))) +(defview connectivity-button [] + (letsubs [state [:connectivity/state]] + (when-let [icon (get-icon state)] + [quo/button {:type :icon + :accessibility-label (str "conn-button-" (name icon)) + :style {:margin-right 16} + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + {:content connectivity-sheet}]) + :theme (if (= (:peers state) :offline) :negative :secondary)} icon]))) \ No newline at end of file diff --git a/src/status_im/ui/screens/chat/views.cljs b/src/status_im/ui/screens/chat/views.cljs index a1ce63f25e..2436a19f30 100644 --- a/src/status_im/ui/screens/chat/views.cljs +++ b/src/status_im/ui/screens/chat/views.cljs @@ -295,16 +295,16 @@ @(re-frame/subscribe [:chats/current-chat])] (when current-chat [react/view {:style {:flex 1}} - [connectivity/connectivity - [topbar] - [react/view {:style {:flex 1}} - (if group-chat - [invitation-requests chat-id admins] - [add-contact-bar chat-id]) - [messages-view {:chat current-chat - :bottom-space (max @bottom-space @panel-space) - :pan-responder pan-responder - :space-keeper space-keeper}]]] + [connectivity/loading-indicator] + [topbar] + [react/view {:style {:flex 1}} + (if group-chat + [invitation-requests chat-id admins] + [add-contact-bar chat-id]) + [messages-view {:chat current-chat + :bottom-space (max @bottom-space @panel-space) + :pan-responder pan-responder + :space-keeper space-keeper}]] (when (and group-chat invitation-admin) [accessory/view {:y position-y :on-update-inset on-update} diff --git a/src/status_im/ui/screens/home/views.cljs b/src/status_im/ui/screens/home/views.cljs index 9b1e810363..77c0e2bb07 100644 --- a/src/status_im/ui/screens/home/views.cljs +++ b/src/status_im/ui/screens/home/views.cljs @@ -163,10 +163,9 @@ (when (or (seq chats) @search-active? (seq search-filter)) [search-input-wrapper search-filter chats]) [referral-item/list-item]] - (when - (and (empty? chats) - (not status-community)) - (or @search-active? (seq search-filter)) + (when (and (empty? chats) + (not status-community) + (or @search-active? (seq search-filter))) [start-suggestion search-filter]) (when status-community ;; We only support one community now, Status @@ -201,8 +200,9 @@ (defn home [] [react/keyboard-avoiding-view {:style styles/home-container} - [connectivity/connectivity - [topbar/topbar {:title (i18n/label :t/chat) - :navigation :none}] - [chats-list]] + [topbar/topbar {:title (i18n/label :t/chat) + :navigation :none + :right-component [connectivity/connectivity-button]}] + [connectivity/loading-indicator] + [chats-list] [plus-button]]) diff --git a/src/status_im/ui/screens/mobile_network_settings/events.cljs b/src/status_im/ui/screens/mobile_network_settings/events.cljs index f3c50af79c..dd26606ecc 100644 --- a/src/status_im/ui/screens/mobile_network_settings/events.cljs +++ b/src/status_im/ui/screens/mobile_network_settings/events.cljs @@ -59,7 +59,6 @@ :syncing-on-mobile-network? (boolean sync?) {}) (multiaccounts.update/multiaccount-update :remember-syncing-choice? (boolean remember-choice?) {}) - (bottom-sheet/hide-bottom-sheet) (when (and cellular? sync?) (mailserver/process-next-messages-request)) (wallet/restart-wallet-service-default)))))) diff --git a/src/status_im/ui/screens/mobile_network_settings/sheets.cljs b/src/status_im/ui/screens/mobile_network_settings/sheets.cljs index bb80514ec1..3a854ea0e7 100644 --- a/src/status_im/ui/screens/mobile_network_settings/sheets.cljs +++ b/src/status_im/ui/screens/mobile_network_settings/sheets.cljs @@ -34,7 +34,8 @@ (views/defview checkbox [] (views/letsubs [checked? [:mobile-network/remember-choice?]] [react/view - {:style styles/checkbox-line-container} + {:style styles/checkbox-line-container + :accessibility-label "remember-choice"} [checkbox/checkbox {:checked? checked? :style styles/checkbox @@ -54,6 +55,10 @@ [{:style styles/settings-link} (str " " (i18n/label :mobile-network-sheet-settings))]]]) +(defn hide-sheet-and-dispatch [event] + (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch event)) + (views/defview settings-sheet [] [react/view {:flex 1} [react/view {:align-items :center} @@ -61,16 +66,18 @@ [details :mobile-syncing-sheet-details]] [quo/list-item {:theme :accent + :accessibility-label "mobile-network-continue-syncing" :title (i18n/label :t/mobile-network-continue-syncing) :subtitle (i18n/label :t/mobile-network-continue-syncing-details) :icon :main-icons/network - :on-press #(re-frame/dispatch [:mobile-network/continue-syncing])}] + :on-press #(hide-sheet-and-dispatch [:mobile-network/continue-syncing])}] [quo/list-item {:theme :negative + :accessibility-label "mobile-network-stop-syncing" :title (i18n/label :t/mobile-network-stop-syncing) :subtitle (i18n/label :t/mobile-network-stop-syncing-details) :icon :main-icons/cancel - :on-press #(re-frame/dispatch [:mobile-network/stop-syncing])}] + :on-press #(hide-sheet-and-dispatch [:mobile-network/stop-syncing])}] [separator] [react/view {:flex 1 :align-self :stretch} diff --git a/src/status_im/ui/screens/mobile_network_settings/view.cljs b/src/status_im/ui/screens/mobile_network_settings/view.cljs index 652139416e..bcf50778fc 100644 --- a/src/status_im/ui/screens/mobile_network_settings/view.cljs +++ b/src/status_im/ui/screens/mobile_network_settings/view.cljs @@ -25,7 +25,8 @@ [:multiaccount]] [react/view {:style styles/container} [topbar/topbar {:title (i18n/label :t/mobile-network-settings)}] - [react/view {:style styles/switch-container} + [react/view {:style styles/switch-container + :accessibility-label "mobile-network-use-mobile"} [profile.components/settings-switch-item {:label-kw :t/mobile-network-use-mobile :value syncing-on-mobile-network? @@ -33,7 +34,8 @@ [react/view {:style styles/details} [react/text {:style styles/use-mobile-data-text} (i18n/label :t/mobile-network-use-mobile-data)]] - [react/view {:style styles/switch-container} + [react/view {:style styles/switch-container + :accessibility-label "mobile-network-ask-me"} [profile.components/settings-switch-item {:label-kw :t/mobile-network-ask-me :value (not remember-syncing-choice?) @@ -43,8 +45,9 @@ {:style styles/defaults-container} [react/text {:style styles/defaults + :accessibility-label "restore-defaults" :on-press #(hide-sheet-and-dispatch [:mobile-network/restore-defaults])} - "Restore Defaults"]]])) + (i18n/label :t/restore-defaults)]]])) (def settings-sheet {:content sheets/settings-sheet}) diff --git a/src/status_im/ui/screens/sync_settings/views.cljs b/src/status_im/ui/screens/sync_settings/views.cljs index e7490f22e8..223f9601d2 100644 --- a/src/status_im/ui/screens/sync_settings/views.cljs +++ b/src/status_im/ui/screens/sync_settings/views.cljs @@ -10,9 +10,7 @@ (views/defview sync-settings [] (views/letsubs [{:keys [syncing-on-mobile-network? use-mailservers?]} [:multiaccount] - current-mailserver-id [:mailserver/current-id] - current-fleet [:fleets/current-fleet] - mailservers [:mailserver/mailservers]] + current-mailserver-name [:mailserver/current-name]] [react/view {:style {:flex 1 :background-color colors/white}} [topbar/topbar {:title (i18n/label :t/sync-settings) :navigation {:on-press #(re-frame/dispatch [:navigate-to :profile-stack {:screen :my-profile}])}}] @@ -32,8 +30,7 @@ :title (i18n/label :t/history-nodes) :on-press #(re-frame/dispatch [:navigate-to :offline-messaging-settings]) :accessory :text - :accessory-text (when use-mailservers? - (get-in mailservers [current-fleet current-mailserver-id :name])) + :accessory-text (when use-mailservers? current-mailserver-name) :chevron true}] ;; TODO(Ferossgp): Devider componemt [react/view {:height 1 diff --git a/translations/en.json b/translations/en.json index 49405e5e40..cc33aaa90c 100644 --- a/translations/en.json +++ b/translations/en.json @@ -165,6 +165,7 @@ "connect": "Connect", "connect-mailserver-content": "Connect to {{name}}?", "connected": "Connected", + "connected-to": "Connected to", "connecting": "Connecting...", "connecting-requires-login": "Connecting to another network requires login", "connection-with-the-card-lost": "Connection with the card\n has been lost", @@ -1403,5 +1404,18 @@ "everyone": "Everyone", "show-profile-pictures": "Show profile pictures of", "non-archival-node": "RPC endpoint doesn't support archival requests. Your local transfers history might be incomplete.", - "custom-node": "You are using custom RPC endpoint. Your local transfers history might be incomplete." + "custom-node": "You are using custom RPC endpoint. Your local transfers history might be incomplete.", + "connection-status": "Connection status", + "peer-to-peer": "Peer to peer", + "not-connected-to-peers": "Not connected to any peers", + "unable-to-send-messages": "Unable to send and receive messages", + "can-send-messages": "You can send and receive new messages", + "not-connected-nodes": "Not connected to a status node", + "unable-to-fetch": "Unable to fetch chat history", + "nodes-disabled": "Status nodes disabled", + "waiting-wi-fi": "Waiting for Wi-Fi…", + "you-can-fetch": "You can fetch chat history", + "youre-on-mobile-network": "You’re on mobile network", + "status-mobile-descr": "Status tends to use a lot of data when syncing chats. You can choose not to sync when on mobile network", + "restore-defaults": "Restore Defaults" }