Fix community toggle

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2021-06-01 10:20:06 +02:00
parent a3cb837266
commit 508060f18d
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
4 changed files with 93 additions and 83 deletions

View File

@ -41,7 +41,11 @@
(defn get-item [k cb] (defn get-item [k cb]
(-> ^js async-storage (-> ^js async-storage
(.getItem (key->string k)) (.getItem (key->string k))
(.then cb) (.then (fn [^js data]
(-> data
js->clj
transit->clj
cb)))
(.catch (fn [error] (.catch (fn [error]
(cb nil) (cb nil)
(log/error "[async-storage]" error))))) (log/error "[async-storage]" error)))))

View File

@ -337,6 +337,7 @@
(transport/start-messenger) (transport/start-messenger)
(chat.loading/initialize-chats) (chat.loading/initialize-chats)
(communities/fetch) (communities/fetch)
(initialize-communities-enabled)
(multiaccounts/switch-preview-privacy-mode-flag) (multiaccounts/switch-preview-privacy-mode-flag)
(link-preview/request-link-preview-whitelist) (link-preview/request-link-preview-whitelist)
(logging/set-log-level (:log-level multiaccount))))) (logging/set-log-level (:log-level multiaccount)))))

View File

@ -2,6 +2,7 @@
(:require [re-frame.core :as re-frame] (:require [re-frame.core :as re-frame]
[status-im.i18n.i18n :as i18n] [status-im.i18n.i18n :as i18n]
[quo.core :as quo] [quo.core :as quo]
[status-im.utils.config :as config]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[status-im.ui.components.list.views :as list] [status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
@ -14,85 +15,89 @@
communities-enabled? communities-enabled?
current-fleet current-fleet
webview-debug]}] webview-debug]}]
[{:size :small (keep
:title (i18n/label :t/network) identity
:accessibility-label :network-button [{:size :small
:container-margin-top 8 :title (i18n/label :t/network)
:on-press :accessibility-label :network-button
#(re-frame/dispatch [:navigate-to :network-settings]) :container-margin-top 8
:accessory :text :on-press
:accessory-text network-name #(re-frame/dispatch [:navigate-to :network-settings])
:chevron true} :accessory :text
{:size :small :accessory-text network-name
:title (i18n/label :t/network-info) :chevron true}
:accessibility-label :network-button {:size :small
:container-margin-top 8 :title (i18n/label :t/network-info)
:on-press :accessibility-label :network-button
#(re-frame/dispatch [:navigate-to :network-info]) :container-margin-top 8
:chevron true} :on-press
{:size :small #(re-frame/dispatch [:navigate-to :network-info])
:title (i18n/label :t/log-level) :chevron true}
:accessibility-label :log-level-settings-button {:size :small
:on-press :title (i18n/label :t/log-level)
#(re-frame/dispatch [:navigate-to :log-level-settings]) :accessibility-label :log-level-settings-button
:accessory :text :on-press
:accessory-text current-log-level #(re-frame/dispatch [:navigate-to :log-level-settings])
:chevron true} :accessory :text
{:size :small :accessory-text current-log-level
:title (i18n/label :t/fleet) :chevron true}
:accessibility-label :fleet-settings-button {:size :small
:on-press :title (i18n/label :t/fleet)
#(re-frame/dispatch [:navigate-to :fleet-settings]) :accessibility-label :fleet-settings-button
:accessory :text :on-press
:accessory-text current-fleet #(re-frame/dispatch [:navigate-to :fleet-settings])
:chevron true} :accessory :text
{:size :small :accessory-text current-fleet
:title (i18n/label :t/bootnodes) :chevron true}
:accessibility-label :bootnodes-settings-button {:size :small
:on-press :title (i18n/label :t/bootnodes)
#(re-frame/dispatch [:navigate-to :bootnodes-settings]) :accessibility-label :bootnodes-settings-button
:chevron true} :on-press
{:size :small #(re-frame/dispatch [:navigate-to :bootnodes-settings])
:title (i18n/label :t/rpc-usage-info) :chevron true}
:accessibility-label :rpc-usage-info {:size :small
:container-margin-top 8 :title (i18n/label :t/rpc-usage-info)
:on-press :accessibility-label :rpc-usage-info
#(re-frame/dispatch [:navigate-to :rpc-usage-info]) :container-margin-top 8
:chevron true} :on-press
(when platform/ios? #(re-frame/dispatch [:navigate-to :rpc-usage-info])
{:size :small :chevron true}
:title (i18n/label :t/notification-settings) (when platform/ios?
:accessibility-label :advanced-notification-settings {:size :small
:on-press :title (i18n/label :t/notification-settings)
#(re-frame/dispatch [:navigate-to :notifications-advanced-settings]) :accessibility-label :advanced-notification-settings
:chevron true}) :on-press
{:size :small #(re-frame/dispatch [:navigate-to :notifications-advanced-settings])
:title (i18n/label :t/communities-enabled) :chevron true})
:accessibility-label :communities-enabled ;; If it's enabled in the config, we don't show the option
:container-margin-bottom 8 (when (not config/communities-enabled?)
:on-press {:size :small
#(re-frame/dispatch :title (i18n/label :t/communities-enabled)
[:multiaccounts.ui/switch-communities-enabled (not communities-enabled?)]) :accessibility-label :communities-enabled
:accessory :switch :container-margin-bottom 8
:active communities-enabled?} :on-press
{:size :small #(re-frame/dispatch
:title "Webview debug" [:multiaccounts.ui/switch-communities-enabled (not communities-enabled?)])
:accessibility-label :webview-debug-switch :accessory :switch
:container-margin-bottom 8 :active communities-enabled?})
:on-press {:size :small
#(re-frame/dispatch :title "Webview debug"
[:multiaccounts.ui/switch-webview-debug (not webview-debug)]) :accessibility-label :webview-debug-switch
:accessory :switch :container-margin-bottom 8
:active webview-debug} :on-press
{:size :small #(re-frame/dispatch
:title (i18n/label :t/waku-bloom-filter-mode) [:multiaccounts.ui/switch-webview-debug (not webview-debug)])
:accessibility-label :waku-bloom-filter-mode-settings-switch :accessory :switch
:container-margin-bottom 8 :active webview-debug}
:on-press {:size :small
#(re-frame/dispatch :title (i18n/label :t/waku-bloom-filter-mode)
[:multiaccounts.ui/waku-bloom-filter-mode-switched (not waku-bloom-filter-mode)]) :accessibility-label :waku-bloom-filter-mode-settings-switch
:accessory :switch :container-margin-bottom 8
:active waku-bloom-filter-mode}]) :on-press
#(re-frame/dispatch
[:multiaccounts.ui/waku-bloom-filter-mode-switched (not waku-bloom-filter-mode)])
:accessory :switch
:active waku-bloom-filter-mode}]))
(defn- flat-list-data [options] (defn- flat-list-data [options]
(normal-mode-settings-data options)) (normal-mode-settings-data options))

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead", "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "feature/allow-set-mailserver-sync-value", "version": "v0.79.7",
"commit-sha1": "26a367c8e269a85c278cfa25acfc892f5f4aba54", "commit-sha1": "60de443e89bd6a5d4f5b71e7038528d27f26090b",
"src-sha256": "1wraz35sjiyf2kq1yiga2gda7jvar4fvya1hdg9imfvffpgbs6aq" "src-sha256": "0gjgkqyvpbwg8drwi2mpcan5vxqrnrzl1j0ccmm2m8vq7j3b1332"
} }