mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-04 21:05:18 +00:00
Add react-native-desktop-config
Add section separator for logging-display Refactor user-login-callback Add comment to AppConfig class definition Fix mobile compilation error Use reference in AppConfig singleton; remove obsolete CMake directives Styling changes Disable status-go logs by default on desktop Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
This commit is contained in:
parent
51a7c537f8
commit
9bc98405a0
@ -73,6 +73,7 @@
|
|||||||
"react-native-fetch-polyfill"
|
"react-native-fetch-polyfill"
|
||||||
"react-native-desktop-linking"
|
"react-native-desktop-linking"
|
||||||
"react-native-desktop-menu"
|
"react-native-desktop-menu"
|
||||||
|
"react-native-desktop-config"
|
||||||
"react-native-desktop-notification"
|
"react-native-desktop-notification"
|
||||||
"text-encoding"
|
"text-encoding"
|
||||||
"js-sha3"
|
"js-sha3"
|
||||||
|
@ -88,6 +88,12 @@ else()
|
|||||||
set(RUN_SCRIPT_FILE_NAME "run-app.sh")
|
set(RUN_SCRIPT_FILE_NAME "run-app.sh")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
target_sources(${APP_NAME}
|
||||||
|
PRIVATE
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/appconfig.h"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/appconfig.cpp")
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
${RUN_SCRIPT_FILE_NAME}.in
|
${RUN_SCRIPT_FILE_NAME}.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${RUN_SCRIPT_FILE_NAME}
|
${CMAKE_CURRENT_BINARY_DIR}/${RUN_SCRIPT_FILE_NAME}
|
||||||
|
49
desktop/appconfig.cpp
Normal file
49
desktop/appconfig.cpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#include "appconfig.h"
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
|
||||||
|
const QStringList loggingCategories =
|
||||||
|
{"UIManager",
|
||||||
|
"Flexbox",
|
||||||
|
"WebSocketModule",
|
||||||
|
"Networking",
|
||||||
|
"ViewManager",
|
||||||
|
"RCTNotification",
|
||||||
|
"default",
|
||||||
|
"RCTStatus",
|
||||||
|
"jsserver",
|
||||||
|
"status"};
|
||||||
|
Q_LOGGING_CATEGORY(APPCONFIG, "AppConfig")
|
||||||
|
|
||||||
|
AppConfig AppConfig::appConfig;
|
||||||
|
|
||||||
|
AppConfig::AppConfig() {
|
||||||
|
}
|
||||||
|
|
||||||
|
AppConfig& AppConfig::inst() {
|
||||||
|
return appConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppConfig::getLoggingEnabled() const {
|
||||||
|
return loggingEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppConfig::setLoggingEnabled(bool enabled) {
|
||||||
|
//qCDebug(APPCONFIG) << "### appconfig setLoggingEnabled " << enabled;
|
||||||
|
QLoggingCategory::setFilterRules(getLoggingFilterRules(enabled));
|
||||||
|
this->loggingEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AppConfig::getLoggingFilterRules(bool enabled) const {
|
||||||
|
if (enabled) {
|
||||||
|
return "UIManager=false\nFlexbox=false\nViewManager=false\nNetworking=false\nWebSocketModule=false";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QString filterRules;
|
||||||
|
for (int i = 0; i < loggingCategories.size(); ++i) {
|
||||||
|
filterRules += (loggingCategories.at(i) + "=false\n");
|
||||||
|
}
|
||||||
|
return filterRules;
|
||||||
|
}
|
||||||
|
}
|
26
desktop/appconfig.h
Normal file
26
desktop/appconfig.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef APPCONFIG_H
|
||||||
|
#define APPCONFIG_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
// This class is intended to store app configuration
|
||||||
|
// modifiable from JS side
|
||||||
|
// Currently, only logging-related settings are here
|
||||||
|
// that are used by react-native-desktop-config module
|
||||||
|
class AppConfig {
|
||||||
|
public:
|
||||||
|
|
||||||
|
static AppConfig& inst();
|
||||||
|
|
||||||
|
bool getLoggingEnabled() const;
|
||||||
|
void setLoggingEnabled(bool enable);
|
||||||
|
|
||||||
|
private:
|
||||||
|
AppConfig();
|
||||||
|
|
||||||
|
bool loggingEnabled = false;
|
||||||
|
static AppConfig appConfig;
|
||||||
|
|
||||||
|
QString getLoggingFilterRules(bool enabled) const;
|
||||||
|
};
|
||||||
|
#endif // APPCONFIG_H
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "exceptionglobalhandler.h"
|
#include "exceptionglobalhandler.h"
|
||||||
|
|
||||||
|
#include "appconfig.h"
|
||||||
Q_DECLARE_LOGGING_CATEGORY(JSSERVER)
|
Q_DECLARE_LOGGING_CATEGORY(JSSERVER)
|
||||||
Q_DECLARE_LOGGING_CATEGORY(STATUS)
|
Q_DECLARE_LOGGING_CATEGORY(STATUS)
|
||||||
Q_LOGGING_CATEGORY(JSSERVER, "jsserver")
|
Q_LOGGING_CATEGORY(JSSERVER, "jsserver")
|
||||||
@ -221,7 +222,6 @@ QString getDataStoragePath() {
|
|||||||
|
|
||||||
void renameRealmDirs() {
|
void renameRealmDirs() {
|
||||||
QDir dataDir(getDataStoragePath());
|
QDir dataDir(getDataStoragePath());
|
||||||
qCDebug(STATUS) << "### path: " << getDataStoragePath();
|
|
||||||
|
|
||||||
if (dataDir.exists("default.realmaccounts")) {
|
if (dataDir.exists("default.realmaccounts")) {
|
||||||
dataDir.mkdir("default.realm");
|
dataDir.mkdir("default.realm");
|
||||||
@ -258,25 +258,14 @@ int main(int argc, char **argv) {
|
|||||||
Q_INIT_RESOURCE(react_resources);
|
Q_INIT_RESOURCE(react_resources);
|
||||||
|
|
||||||
loadFontsFromResources();
|
loadFontsFromResources();
|
||||||
#ifdef STATUS_NO_LOGGING
|
|
||||||
QLoggingCategory::setFilterRules("UIManager=false\n"
|
|
||||||
"Flexbox=false\n"
|
|
||||||
"WebSocketModule=false\n"
|
|
||||||
"Networking=false\n"
|
|
||||||
"ViewManager=false\n"
|
|
||||||
"RCTNotification=false\n"
|
|
||||||
"default=false\n"
|
|
||||||
"RCTStatus=false\n"
|
|
||||||
"jsserver=false\n"
|
|
||||||
"status=false\n");
|
|
||||||
#else
|
|
||||||
QLoggingCategory::setFilterRules(QStringLiteral("UIManager=false\nFlexbox=false\nViewManager=false\nNetworking=false\nWebSocketModule=false"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (redirectLogIntoFile()) {
|
if (redirectLogIntoFile()) {
|
||||||
qInstallMessageHandler(saveMessage);
|
qInstallMessageHandler(saveMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//qCDebug(STATUS) << "###STATUS_NO_LOGGING";
|
||||||
|
AppConfig::inst().setLoggingEnabled(false);
|
||||||
|
|
||||||
|
|
||||||
#ifdef BUILD_FOR_BUNDLE
|
#ifdef BUILD_FOR_BUNDLE
|
||||||
if (!runNodeJsServer()) {
|
if (!runNodeJsServer()) {
|
||||||
if (g_nodeJsServerProcess->state() == QProcess::NotRunning) {
|
if (g_nodeJsServerProcess->state() == QProcess::NotRunning) {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"modules/react-native-status/desktop",
|
"modules/react-native-status/desktop",
|
||||||
"modules/react-native-desktop-linking/desktop",
|
"modules/react-native-desktop-linking/desktop",
|
||||||
"modules/react-native-desktop-menu/desktop",
|
"modules/react-native-desktop-menu/desktop",
|
||||||
|
"modules/react-native-desktop-config/desktop",
|
||||||
"modules/react-native-desktop-notification/desktop",
|
"modules/react-native-desktop-notification/desktop",
|
||||||
"node_modules/google-breakpad"
|
"node_modules/google-breakpad"
|
||||||
],
|
],
|
||||||
|
7
modules/react-native-desktop-config/desktop/CMakeLists.txt
Executable file
7
modules/react-native-desktop-config/desktop/CMakeLists.txt
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
set(REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_TYPE_NAMES ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_TYPE_NAMES}
|
||||||
|
\"DesktopConfig\" PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/desktopconfig.cpp PARENT_SCOPE)
|
@ -0,0 +1,44 @@
|
|||||||
|
#include "desktopconfig.h"
|
||||||
|
#include "bridge.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include "../../../desktop/appconfig.h"
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(DESKTOPCONFIG, "DesktopConfig")
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct RegisterQMLMetaType {
|
||||||
|
RegisterQMLMetaType() { qRegisterMetaType<DesktopConfig *>(); }
|
||||||
|
} registerMetaType;
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
|
DesktopConfig::DesktopConfig(QObject *parent)
|
||||||
|
: QObject(parent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
DesktopConfig::~DesktopConfig() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void DesktopConfig::setBridge(Bridge *bridge) {
|
||||||
|
this->bridge = bridge;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DesktopConfig::moduleName() { return "DesktopConfigManager"; }
|
||||||
|
|
||||||
|
QList<ModuleMethod *> DesktopConfig::methodsToExport() {
|
||||||
|
return QList<ModuleMethod *>{};
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap DesktopConfig::constantsToExport() { return QVariantMap(); }
|
||||||
|
|
||||||
|
void DesktopConfig::getLoggingEnabled(double callback) {
|
||||||
|
bridge->invokePromiseCallback(callback, QVariantList{AppConfig::inst().getLoggingEnabled()});
|
||||||
|
}
|
||||||
|
|
||||||
|
void DesktopConfig::setLoggingEnabled(bool enable) {
|
||||||
|
//qCDebug(DESKTOPCONFIG) << "### setLoggingEnabled " << enable;
|
||||||
|
AppConfig::inst().setLoggingEnabled(enable);
|
||||||
|
}
|
||||||
|
|
32
modules/react-native-desktop-config/desktop/desktopconfig.h
Normal file
32
modules/react-native-desktop-config/desktop/desktopconfig.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef DESKTOPCONFIG_H
|
||||||
|
#define DESKTOPCONFIG_H
|
||||||
|
|
||||||
|
#include "moduleinterface.h"
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(CONFIG)
|
||||||
|
|
||||||
|
class Bridge;
|
||||||
|
class DesktopConfig : public QObject, public ModuleInterface {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(ModuleInterface)
|
||||||
|
|
||||||
|
public:
|
||||||
|
Q_INVOKABLE DesktopConfig(QObject* parent = 0);
|
||||||
|
virtual ~DesktopConfig();
|
||||||
|
|
||||||
|
void setBridge(Bridge* bridge) override;
|
||||||
|
|
||||||
|
QString moduleName() override;
|
||||||
|
QList<ModuleMethod*> methodsToExport() override;
|
||||||
|
QVariantMap constantsToExport() override;
|
||||||
|
|
||||||
|
Q_INVOKABLE void getLoggingEnabled(double callback);
|
||||||
|
Q_INVOKABLE void setLoggingEnabled(bool enable);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Bridge* bridge = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DESKTOPCONFIG_H
|
20
modules/react-native-desktop-config/index.js
vendored
Normal file
20
modules/react-native-desktop-config/index.js
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const NativeModules = require('react-native').NativeModules;
|
||||||
|
|
||||||
|
class DesktopConfig {
|
||||||
|
|
||||||
|
static getLoggingEnabled(callbackFn) {
|
||||||
|
NativeModules.DesktopConfigManager.getLoggingEnabled(
|
||||||
|
(enabled) => {
|
||||||
|
callbackFn(enabled);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static setLoggingEnabled(enabled) {
|
||||||
|
NativeModules.DesktopConfigManager.setLoggingEnabled(enabled);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = DesktopConfig;
|
13
modules/react-native-desktop-config/package.json
Normal file
13
modules/react-native-desktop-config/package.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"nativePackage": true,
|
||||||
|
"name": "react-native-desktop-config",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Configuration backend for Desktop",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": ""
|
||||||
|
}
|
@ -14,6 +14,7 @@
|
|||||||
(def i18n (js/require "react-native-i18n"))
|
(def i18n (js/require "react-native-i18n"))
|
||||||
(def desktop-linking (.-DesktopLinking (.-NativeModules react-native)))
|
(def desktop-linking (.-DesktopLinking (.-NativeModules react-native)))
|
||||||
(def desktop-menu (js/require "react-native-desktop-menu"))
|
(def desktop-menu (js/require "react-native-desktop-menu"))
|
||||||
|
(def desktop-config (js/require "react-native-desktop-config"))
|
||||||
|
|
||||||
(def react-native-firebase #js {})
|
(def react-native-firebase #js {})
|
||||||
(def nfc-manager #js {})
|
(def nfc-manager #js {})
|
||||||
|
@ -28,3 +28,4 @@
|
|||||||
(def react-navigation (js/require "react-navigation"))
|
(def react-navigation (js/require "react-navigation"))
|
||||||
(def desktop-linking #js {:addEventListener (fn [])})
|
(def desktop-linking #js {:addEventListener (fn [])})
|
||||||
(def desktop-menu #js {:addEventListener (fn [])})
|
(def desktop-menu #js {:addEventListener (fn [])})
|
||||||
|
(def desktop-config #js {:addEventListener (fn [])})
|
||||||
|
@ -33,6 +33,7 @@ external_modules_dir=( \
|
|||||||
'node_modules/google-breakpad' \
|
'node_modules/google-breakpad' \
|
||||||
'modules/react-native-desktop-linking/desktop' \
|
'modules/react-native-desktop-linking/desktop' \
|
||||||
'modules/react-native-desktop-menu/desktop' \
|
'modules/react-native-desktop-menu/desktop' \
|
||||||
|
'modules/react-native-desktop-config/desktop' \
|
||||||
'modules/react-native-desktop-notification/desktop' \
|
'modules/react-native-desktop-notification/desktop' \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
[status-im.native-module.core :as status]
|
[status-im.native-module.core :as status]
|
||||||
[status-im.ui.screens.navigation :as navigation]
|
[status-im.ui.screens.navigation :as navigation]
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
|
[status-im.react-native.js-dependencies :as rn-dependencies]
|
||||||
[status-im.utils.keychain.core :as keychain]
|
[status-im.utils.keychain.core :as keychain]
|
||||||
[status-im.utils.types :as types]
|
[status-im.utils.types :as types]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
@ -100,6 +101,10 @@
|
|||||||
#(re-frame/dispatch
|
#(re-frame/dispatch
|
||||||
[:web3/fetch-node-version-callback %])]}
|
[:web3/fetch-node-version-callback %])]}
|
||||||
(protocol/initialize-protocol address)
|
(protocol/initialize-protocol address)
|
||||||
|
#(when platform/desktop?
|
||||||
|
(let [logging-enabled (get-in db [:account/account :settings :logging-enabled])]
|
||||||
|
(log/debug "### user-login-callback .setLoggingEnabled" logging-enabled)
|
||||||
|
(.setLoggingEnabled rn-dependencies/desktop-config logging-enabled)))
|
||||||
#(when-not platform/desktop?
|
#(when-not platform/desktop?
|
||||||
(initialize-wallet %)))
|
(initialize-wallet %)))
|
||||||
(account-and-db-password-do-not-match cofx error)))))
|
(account-and-db-password-do-not-match cofx error)))))
|
||||||
|
@ -556,6 +556,18 @@
|
|||||||
(fn [cofx [_ log-level]]
|
(fn [cofx [_ log-level]]
|
||||||
(log-level/show-change-log-level-confirmation cofx log-level)))
|
(log-level/show-change-log-level-confirmation cofx log-level)))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:log-level.ui/logging-enabled
|
||||||
|
(fn [cofx [_ enabled]]
|
||||||
|
(log/debug "### :log-level.ui/logging-enabled" enabled)
|
||||||
|
|
||||||
|
(log-level/show-logging-enabled-confirmation cofx enabled)))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:log-level.ui/logging-enabled-confirmed
|
||||||
|
(fn [cofx [_ enabled]]
|
||||||
|
(log-level/save-logging-enabled cofx enabled)))
|
||||||
|
|
||||||
;; Browser bridge module
|
;; Browser bridge module
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
(ns status-im.log-level.core
|
(ns status-im.log-level.core
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.accounts.update.core :as accounts.update]
|
[status-im.accounts.update.core :as accounts.update]
|
||||||
|
[status-im.react-native.js-dependencies :as rn-dependencies]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.utils.fx :as fx]))
|
[status-im.utils.fx :as fx]))
|
||||||
|
|
||||||
@ -21,3 +22,24 @@
|
|||||||
:confirm-button-text (i18n/label :t/close-app-button)
|
:confirm-button-text (i18n/label :t/close-app-button)
|
||||||
:on-accept #(re-frame/dispatch [:log-level.ui/change-log-level-confirmed value])
|
:on-accept #(re-frame/dispatch [:log-level.ui/change-log-level-confirmed value])
|
||||||
:on-cancel nil}})
|
:on-cancel nil}})
|
||||||
|
|
||||||
|
(fx/defn show-logging-enabled-confirmation
|
||||||
|
[{:keys [db]} enabled]
|
||||||
|
{:ui/show-confirmation {:title (i18n/label :t/close-app-title)
|
||||||
|
:content (i18n/label :t/change-logging-enabled
|
||||||
|
{:enable (i18n/label (if enabled
|
||||||
|
:enable :disable))})
|
||||||
|
:confirm-button-text (i18n/label :t/close-app-button)
|
||||||
|
:on-accept #(re-frame/dispatch [:log-level.ui/logging-enabled-confirmed enabled])
|
||||||
|
:on-cancel nil}})
|
||||||
|
|
||||||
|
(fx/defn save-logging-enabled
|
||||||
|
[{:keys [db now] :as cofx} enabled]
|
||||||
|
(let [settings (get-in db [:account/account :settings])]
|
||||||
|
(.setLoggingEnabled rn-dependencies/desktop-config enabled)
|
||||||
|
(accounts.update/update-settings cofx
|
||||||
|
(-> settings
|
||||||
|
(assoc :logging-enabled enabled)
|
||||||
|
(#(if enabled (assoc %1 :log-level "INFO") (dissoc %1 :log-level))))
|
||||||
|
{:success-event [:accounts.update.callback/save-settings-success]})))
|
||||||
|
|
||||||
|
@ -86,7 +86,8 @@
|
|||||||
(get accounts address))
|
(get accounts address))
|
||||||
use-custom-bootnodes (get-in settings [:bootnodes network])
|
use-custom-bootnodes (get-in settings [:bootnodes network])
|
||||||
log-level (or (:log-level settings)
|
log-level (or (:log-level settings)
|
||||||
config/log-level-status-go)]
|
(if utils.platform/desktop? ""
|
||||||
|
config/log-level-status-go))]
|
||||||
(cond-> (get-in networks [network :config])
|
(cond-> (get-in networks [network :config])
|
||||||
:always
|
:always
|
||||||
(get-base-node-config)
|
(get-base-node-config)
|
||||||
|
@ -163,30 +163,33 @@
|
|||||||
{:margin 24
|
{:margin 24
|
||||||
:font-size 20})
|
:font-size 20})
|
||||||
|
|
||||||
(def connection-message-text
|
(def adv-settings-subtitle
|
||||||
{:margin-left 24
|
{:margin-left 24
|
||||||
:margin-bottom 10
|
:margin-bottom 10
|
||||||
|
:font-weight :bold
|
||||||
:font-size 16})
|
:font-size 16})
|
||||||
|
|
||||||
|
(def connection-stats-title
|
||||||
|
(merge adv-settings-subtitle
|
||||||
|
{:font-size 14}))
|
||||||
|
|
||||||
(def connection-stats-entry
|
(def connection-stats-entry
|
||||||
{:margin-left 24
|
{:margin-left 24
|
||||||
:margin-bottom 10})
|
:margin-bottom 10})
|
||||||
|
|
||||||
(def title-separator
|
(def title-separator
|
||||||
{:height 1
|
{:height 1
|
||||||
|
:margin-top 16
|
||||||
|
:margin-bottom 8
|
||||||
:background-color colors/gray-light})
|
:background-color colors/gray-light})
|
||||||
|
|
||||||
(def mailserver-title
|
|
||||||
{:margin-left 24
|
|
||||||
:margin-top 36
|
|
||||||
:margin-bottom 16
|
|
||||||
:font-size 16})
|
|
||||||
|
|
||||||
(def connection-stats-title
|
|
||||||
{:margin-left 24
|
|
||||||
:margin-top 16
|
|
||||||
:margin-bottom 16
|
|
||||||
:font-size 16})
|
|
||||||
|
|
||||||
(def pair-button
|
(def pair-button
|
||||||
{:margin-left 32})
|
{:margin-left 32})
|
||||||
|
|
||||||
|
(defn connection-circle [disconnected?]
|
||||||
|
{:background-color (if disconnected? colors/red colors/green)
|
||||||
|
:margin-left 24
|
||||||
|
:margin-right 16
|
||||||
|
:width 16
|
||||||
|
:height 16
|
||||||
|
:border-radius 16})
|
||||||
|
@ -81,8 +81,6 @@
|
|||||||
|
|
||||||
(defn installations-section [installations]
|
(defn installations-section [installations]
|
||||||
[react/view
|
[react/view
|
||||||
[react/view {:style styles/title-separator}]
|
|
||||||
[react/text {:style styles/mailserver-title} (i18n/label :devices)]
|
|
||||||
[pairing.views/pair-this-device]
|
[pairing.views/pair-this-device]
|
||||||
[pairing.views/sync-devices]
|
[pairing.views/sync-devices]
|
||||||
[pairing.views/installations-list installations]])
|
[pairing.views/installations-list installations]])
|
||||||
@ -132,6 +130,18 @@
|
|||||||
[react/text {:style styles/connection-stats-entry}
|
[react/text {:style styles/connection-stats-entry}
|
||||||
(str "outbound " les-packets-out)]]])
|
(str "outbound " les-packets-out)]]])
|
||||||
|
|
||||||
|
(views/defview logging-display []
|
||||||
|
(views/letsubs [logging-enabled [:settings/logging-enabled]]
|
||||||
|
[react/view {:style (styles/profile-row false)}
|
||||||
|
[react/text {:style (assoc (styles/profile-row-text colors/black)
|
||||||
|
:font-size 14)} "Logging enabled?"]
|
||||||
|
(let [_ (log/debug "### logging-display" logging-enabled)]
|
||||||
|
[react/switch {:on-tint-color colors/blue
|
||||||
|
:value logging-enabled
|
||||||
|
:on-value-change #(do
|
||||||
|
(log/debug "### changelogging-enabled:" logging-enabled)
|
||||||
|
(re-frame/dispatch [:log-level.ui/logging-enabled (not logging-enabled)]))}])]))
|
||||||
|
|
||||||
(views/defview advanced-settings []
|
(views/defview advanced-settings []
|
||||||
(views/letsubs [installations [:pairing/installations]
|
(views/letsubs [installations [:pairing/installations]
|
||||||
current-mailserver-id [:mailserver/current-id]
|
current-mailserver-id [:mailserver/current-id]
|
||||||
@ -147,19 +157,31 @@
|
|||||||
[react/text {:style styles/advanced-settings-title
|
[react/text {:style styles/advanced-settings-title
|
||||||
:font :medium}
|
:font :medium}
|
||||||
(i18n/label :advanced-settings)]
|
(i18n/label :advanced-settings)]
|
||||||
[react/view
|
|
||||||
[react/text {:style styles/connection-message-text} connection-message]]
|
|
||||||
[react/view {:style styles/title-separator}]
|
[react/view {:style styles/title-separator}]
|
||||||
[react/text {:style styles/mailserver-title} (i18n/label :offline-messaging)]
|
[react/text {:style styles/adv-settings-subtitle} "Connections"]
|
||||||
|
[react/view {:style {:flex-direction :row
|
||||||
|
:margin-bottom 8}}
|
||||||
|
[react/view {:style (styles/connection-circle disconnected)}]
|
||||||
|
[react/text connection-message]]
|
||||||
|
(connection-statistics-display connection-stats)
|
||||||
|
|
||||||
|
[react/view {:style styles/title-separator}]
|
||||||
|
[react/text {:style styles/adv-settings-subtitle} (i18n/label :offline-messaging)]
|
||||||
[react/view
|
[react/view
|
||||||
(for [mailserver (vals mailservers)]
|
(for [mailserver (vals mailservers)]
|
||||||
^{:key (:id mailserver)}
|
^{:key (:id mailserver)}
|
||||||
[react/view {:style {:margin-vertical 8}}
|
[react/view {:style {:margin-vertical 8}}
|
||||||
[render-fn mailserver]])]
|
[render-fn mailserver]])]
|
||||||
|
;
|
||||||
|
[react/view {:style styles/title-separator}]
|
||||||
|
[react/text {:style styles/adv-settings-subtitle} (i18n/label :devices)]
|
||||||
(when (config/pairing-enabled? true)
|
(when (config/pairing-enabled? true)
|
||||||
(installations-section installations))
|
(installations-section installations))
|
||||||
|
;
|
||||||
[react/view {:style styles/title-separator}]
|
[react/view {:style styles/title-separator}]
|
||||||
(connection-statistics-display connection-stats)])))
|
[react/text {:style styles/adv-settings-subtitle} "Logging"]
|
||||||
|
[logging-display]])))
|
||||||
|
|
||||||
(views/defview backup-recovery-phrase []
|
(views/defview backup-recovery-phrase []
|
||||||
[profile.recovery/backup-seed])
|
[profile.recovery/backup-seed])
|
||||||
|
@ -7,3 +7,8 @@
|
|||||||
(fn [db _]
|
(fn [db _]
|
||||||
(or (get-in db [:account/account :settings :log-level])
|
(or (get-in db [:account/account :settings :log-level])
|
||||||
config/log-level-status-go)))
|
config/log-level-status-go)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:settings/logging-enabled
|
||||||
|
(fn [db _]
|
||||||
|
(or (get-in db [:account/account :settings :logging-enabled]) false)))
|
||||||
|
@ -564,6 +564,9 @@
|
|||||||
"transactions-sign-transaction": "Sign transaction",
|
"transactions-sign-transaction": "Sign transaction",
|
||||||
"wallet-backup-recovery-title": "Backup your recovery phrase",
|
"wallet-backup-recovery-title": "Backup your recovery phrase",
|
||||||
"change-log-level": "Change log level to {{log-level}}",
|
"change-log-level": "Change log level to {{log-level}}",
|
||||||
|
"change-logging-enabled": "Are you sure you want to {{enable}} logging?",
|
||||||
|
"enable": "enable",
|
||||||
|
"disable": "disable",
|
||||||
"on": "On",
|
"on": "On",
|
||||||
"currency-display-name-mur": "Mauritius Rupee",
|
"currency-display-name-mur": "Mauritius Rupee",
|
||||||
"already-have-account": "I already have an account",
|
"already-have-account": "I already have an account",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user