Merge pull request #5284 from status-im/desktop_leftovers
Leftovers from desktop branch since 9th July
This commit is contained in:
commit
ac624ca447
|
@ -1,3 +1,12 @@
|
||||||
|
properties([
|
||||||
|
buildDiscarder(logRotator(
|
||||||
|
numToKeepStr: '2',
|
||||||
|
daysToKeepStr: '3',
|
||||||
|
artifactNumToKeepStr: '2',
|
||||||
|
artifactDaysToKeepStr: '3'
|
||||||
|
))
|
||||||
|
])
|
||||||
|
|
||||||
env.LANG="en_US.UTF-8"
|
env.LANG="en_US.UTF-8"
|
||||||
env.LANGUAGE="en_US.UTF-8"
|
env.LANGUAGE="en_US.UTF-8"
|
||||||
env.LC_ALL="en_US.UTF-8"
|
env.LC_ALL="en_US.UTF-8"
|
||||||
|
|
|
@ -8,16 +8,16 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define BUILD_FOR_BUNDLE
|
// #define BUILD_FOR_BUNDLE
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QStandardPaths>
|
|
||||||
|
|
||||||
#include "attachedproperties.h"
|
#include "attachedproperties.h"
|
||||||
#include "reactitem.h"
|
#include "reactitem.h"
|
||||||
|
@ -29,6 +29,9 @@ QStringList consoleOutputStrings;
|
||||||
bool ubuntuServerStarted = false;
|
bool ubuntuServerStarted = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const int MAIN_WINDOW_WIDTH = 1024;
|
||||||
|
const int MAIN_WINDOW_HEIGHT = 768;
|
||||||
|
|
||||||
// TODO: some way to change while running
|
// TODO: some way to change while running
|
||||||
class ReactNativeProperties : public QObject {
|
class ReactNativeProperties : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -141,14 +144,7 @@ int main(int argc, char **argv) {
|
||||||
Q_INIT_RESOURCE(react_resources);
|
Q_INIT_RESOURCE(react_resources);
|
||||||
|
|
||||||
#ifdef BUILD_FOR_BUNDLE
|
#ifdef BUILD_FOR_BUNDLE
|
||||||
QString dataFolder = QDir::homePath() + "/Library/StatusIm/";
|
|
||||||
qInstallMessageHandler(saveMessage);
|
qInstallMessageHandler(saveMessage);
|
||||||
|
|
||||||
QDir dir(dataFolder + "ethereum/mainnet_rpc");
|
|
||||||
if (!dir.exists()) {
|
|
||||||
dir.mkpath(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
runUbuntuServer();
|
runUbuntuServer();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -188,6 +184,7 @@ int main(int argc, char **argv) {
|
||||||
view.rootContext()->setContextProperty("ReactNativeProperties", rnp);
|
view.rootContext()->setContextProperty("ReactNativeProperties", rnp);
|
||||||
view.setSource(QUrl("qrc:///main.qml"));
|
view.setSource(QUrl("qrc:///main.qml"));
|
||||||
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||||
|
view.resize(MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT);
|
||||||
view.show();
|
view.show();
|
||||||
|
|
||||||
#ifdef BUILD_FOR_BUNDLE
|
#ifdef BUILD_FOR_BUNDLE
|
||||||
|
@ -202,8 +199,18 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
#ifdef BUILD_FOR_BUNDLE
|
#ifdef BUILD_FOR_BUNDLE
|
||||||
|
|
||||||
|
QString getDataStoragePath() {
|
||||||
|
QString dataStoragePath =
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
QDir dir(dataStoragePath);
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkpath(".");
|
||||||
|
}
|
||||||
|
return dataStoragePath;
|
||||||
|
}
|
||||||
|
|
||||||
void writeLogsToFile() {
|
void writeLogsToFile() {
|
||||||
QFile logFile(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/StatusIm.log");
|
QFile logFile(getDataStoragePath() + "/StatusIm.log");
|
||||||
if (logFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
if (logFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
||||||
for (QString message : consoleOutputStrings) {
|
for (QString message : consoleOutputStrings) {
|
||||||
logFile.write(message.toStdString().c_str());
|
logFile.write(message.toStdString().c_str());
|
||||||
|
@ -217,6 +224,7 @@ void writeLogsToFile() {
|
||||||
|
|
||||||
void runUbuntuServer() {
|
void runUbuntuServer() {
|
||||||
QProcess *process = new QProcess();
|
QProcess *process = new QProcess();
|
||||||
|
process->setWorkingDirectory(getDataStoragePath());
|
||||||
process->setProgram(QGuiApplication::applicationDirPath() + "/ubuntu-server");
|
process->setProgram(QGuiApplication::applicationDirPath() + "/ubuntu-server");
|
||||||
QObject::connect(process, &QProcess::errorOccurred,
|
QObject::connect(process, &QProcess::errorOccurred,
|
||||||
[=](QProcess::ProcessError) {
|
[=](QProcess::ProcessError) {
|
||||||
|
|
|
@ -63,35 +63,6 @@ QVariantMap RCTStatus::constantsToExport() {
|
||||||
return QVariantMap();
|
return QVariantMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RCTStatus::initJail(QString js, double callbackId) {
|
|
||||||
Q_D(RCTStatus);
|
|
||||||
qDebug() << "call of RCTStatus::initJail with param js:" << " and callback id: " << callbackId;
|
|
||||||
|
|
||||||
InitJail(js.toUtf8().data());
|
|
||||||
|
|
||||||
d->bridge->invokePromiseCallback(callbackId, QVariantList{ "{\"result\":\"\"}" });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RCTStatus::parseJail(QString chatId, QString js, double callbackId) {
|
|
||||||
Q_D(RCTStatus);
|
|
||||||
qDebug() << "call of RCTStatus::parseJail with param chatId: " << chatId << " js:" << " and callback id: " << callbackId;
|
|
||||||
|
|
||||||
const char* result = Parse(chatId.toUtf8().data(), js.toUtf8().data());
|
|
||||||
qDebug() << "RCTStatus::parseJail parseJail result: " << result;
|
|
||||||
d->bridge->invokePromiseCallback(callbackId, QVariantList{result});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RCTStatus::callJail(QString chatId, QString path, QString params, double callbackId) {
|
|
||||||
Q_D(RCTStatus);
|
|
||||||
qDebug() << "call of RCTStatus::callJail with param chatId: " << chatId << " path: " << path << " params: " << params << " and callback id: " << callbackId;
|
|
||||||
|
|
||||||
const char* result = Call(chatId.toUtf8().data(), path.toUtf8().data(), params.toUtf8().data());
|
|
||||||
qDebug() << "RCTStatus::callJail callJail result: " << result;
|
|
||||||
d->bridge->invokePromiseCallback(callbackId, QVariantList{result});
|
|
||||||
}
|
|
||||||
|
|
||||||
void RCTStatus::getDeviceUUID(double callbackId) {
|
void RCTStatus::getDeviceUUID(double callbackId) {
|
||||||
Q_D(RCTStatus);
|
Q_D(RCTStatus);
|
||||||
qDebug() << "call of RCTStatus::getDeviceUUID";
|
qDebug() << "call of RCTStatus::getDeviceUUID";
|
||||||
|
@ -113,12 +84,12 @@ void RCTStatus::startNode(QString configString) {
|
||||||
qDebug() << " RCTStatus::startNode configString: " << jsonDoc.toVariant().toMap();
|
qDebug() << " RCTStatus::startNode configString: " << jsonDoc.toVariant().toMap();
|
||||||
QVariantMap configJSON = jsonDoc.toVariant().toMap();
|
QVariantMap configJSON = jsonDoc.toVariant().toMap();
|
||||||
|
|
||||||
QString newKeystoreUrl = "keystore";
|
|
||||||
|
|
||||||
int networkId = configJSON["NetworkId"].toInt();
|
int networkId = configJSON["NetworkId"].toInt();
|
||||||
QString dataDir = configJSON["DataDir"].toString();
|
QString dataDir = configJSON["DataDir"].toString();
|
||||||
|
|
||||||
QString networkDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/" + dataDir;
|
QString rootDirPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/";
|
||||||
|
QString networkDir = rootDirPath + dataDir;
|
||||||
|
QString keyStoreDir = rootDirPath + "keystore";
|
||||||
QDir dir(networkDir);
|
QDir dir(networkDir);
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
dir.mkpath(".");
|
dir.mkpath(".");
|
||||||
|
@ -136,7 +107,7 @@ void RCTStatus::startNode(QString configString) {
|
||||||
|
|
||||||
qDebug() << " RCTStatus::startNode GenerateConfig configString: " << jsonDoc.toVariant().toMap();
|
qDebug() << " RCTStatus::startNode GenerateConfig configString: " << jsonDoc.toVariant().toMap();
|
||||||
QVariantMap generatedConfig = jsonDoc.toVariant().toMap();
|
QVariantMap generatedConfig = jsonDoc.toVariant().toMap();
|
||||||
generatedConfig["KeyStoreDir"] = newKeystoreUrl;
|
generatedConfig["KeyStoreDir"] = keyStoreDir;
|
||||||
generatedConfig["LogEnabled"] = true;
|
generatedConfig["LogEnabled"] = true;
|
||||||
generatedConfig["LogFile"] = networkDir + "/geth.log";
|
generatedConfig["LogFile"] = networkDir + "/geth.log";
|
||||||
//generatedConfig["LogLevel"] = "DEBUG";
|
//generatedConfig["LogLevel"] = "DEBUG";
|
||||||
|
|
|
@ -32,9 +32,6 @@ public:
|
||||||
QList<ModuleMethod*> methodsToExport() override;
|
QList<ModuleMethod*> methodsToExport() override;
|
||||||
QVariantMap constantsToExport() override;
|
QVariantMap constantsToExport() override;
|
||||||
|
|
||||||
Q_INVOKABLE void initJail(QString js, double callbackId);
|
|
||||||
Q_INVOKABLE void parseJail(QString chatId, QString js, double callbackId);
|
|
||||||
Q_INVOKABLE void callJail(QString chatId, QString path, QString params, double callbackId);
|
|
||||||
Q_INVOKABLE void startNode(QString configString);
|
Q_INVOKABLE void startNode(QString configString);
|
||||||
Q_INVOKABLE void shouldMoveToInternalStorage(double callbackId);
|
Q_INVOKABLE void shouldMoveToInternalStorage(double callbackId);
|
||||||
Q_INVOKABLE void moveToInternalStorage(double callbackId);
|
Q_INVOKABLE void moveToInternalStorage(double callbackId);
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
(ns status-im.ui.components.desktop.events
|
||||||
|
(:require [status-im.utils.handlers :as handlers]
|
||||||
|
[status-im.utils.handlers-macro :as handlers-macro]))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:show-desktop-tab
|
||||||
|
(fn [{:keys [db] :as cofx} [_ tab-name]]
|
||||||
|
{:db (assoc-in db [:desktop/desktop :tab-view-id] tab-name)}))
|
|
@ -1,5 +1,6 @@
|
||||||
(ns status-im.ui.components.desktop.tabs
|
(ns status-im.ui.components.desktop.tabs
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
|
status-im.ui.components.desktop.events
|
||||||
[status-im.ui.components.icons.vector-icons :as icons]
|
[status-im.ui.components.icons.vector-icons :as icons]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.colors :as colors]
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
:disabled active?
|
:disabled active?
|
||||||
:on-press #(do
|
:on-press #(do
|
||||||
(re-frame/dispatch [:navigate-to :home])
|
(re-frame/dispatch [:navigate-to :home])
|
||||||
(re-frame/dispatch [:set-in [:desktop/desktop :tab-view-id] view-id]))}
|
(re-frame/dispatch [:show-desktop-tab view-id]))}
|
||||||
[react/view
|
[react/view
|
||||||
[content active?]]])
|
[content active?]]])
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
[clojure.string :as string]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(defn- validate-pub-key [whisper-identity {:keys [address public-key]}]
|
(defn- validate-pub-key [whisper-identity {:keys [address public-key]}]
|
||||||
(when (and whisper-identity (not (string/blank? whisper-identity)))
|
(cond
|
||||||
(cond
|
(string/blank? whisper-identity)
|
||||||
(#{(hex/normalize-hex address) (hex/normalize-hex public-key)}
|
(i18n/label :t/use-valid-contact-code)
|
||||||
(hex/normalize-hex whisper-identity))
|
(#{(hex/normalize-hex address) (hex/normalize-hex public-key)}
|
||||||
(i18n/label :t/can-not-add-yourself)
|
(hex/normalize-hex whisper-identity))
|
||||||
|
(i18n/label :t/can-not-add-yourself)
|
||||||
|
|
||||||
(not (spec/valid? :global/public-key whisper-identity))
|
(not (spec/valid? :global/public-key whisper-identity))
|
||||||
(i18n/label :t/use-valid-contact-code))))
|
(i18n/label :t/use-valid-contact-code)))
|
||||||
|
|
|
@ -62,34 +62,53 @@
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:background-color colors/gray-lighter})
|
:background-color colors/gray-lighter})
|
||||||
|
|
||||||
|
(def img-container
|
||||||
|
{:height 56
|
||||||
|
:justify-content :center})
|
||||||
|
|
||||||
(def messages-scrollview-inner
|
(def messages-scrollview-inner
|
||||||
{:padding-vertical 46})
|
{:padding-vertical 46})
|
||||||
|
|
||||||
(def photo-style
|
(def photo-style
|
||||||
{:borderRadius 20
|
{:border-radius 20
|
||||||
:width 40
|
:width 40
|
||||||
:height 40
|
:height 40
|
||||||
:margin-right 8})
|
:margin-right 8})
|
||||||
|
|
||||||
|
(def photo-style-toolbar
|
||||||
|
{:border-radius 32
|
||||||
|
:width 32
|
||||||
|
:height 32
|
||||||
|
:margin-right 8})
|
||||||
|
|
||||||
|
(defn topic-image [color]
|
||||||
|
(merge photo-style-toolbar
|
||||||
|
{:background-color color
|
||||||
|
:align-items :center
|
||||||
|
:justify-content :center}))
|
||||||
|
|
||||||
|
(def topic-text
|
||||||
|
{:font-size 18
|
||||||
|
:color colors/white})
|
||||||
|
|
||||||
(def toolbar-chat-view
|
(def toolbar-chat-view
|
||||||
{:align-items :center
|
{:margin-left 11
|
||||||
:padding 11
|
|
||||||
:justify-content :center})
|
:justify-content :center})
|
||||||
|
|
||||||
(def toolbar-chat-name
|
(def toolbar-chat-name
|
||||||
{:font-size 16
|
{:font-size 16
|
||||||
:color :black
|
:color :black
|
||||||
:font-weight "600"})
|
:font-weight "300"})
|
||||||
|
|
||||||
(def add-contact
|
(def add-contact
|
||||||
{:background-color :white
|
{:background-color :white
|
||||||
:border-radius 6
|
:border-radius 6
|
||||||
:margin-top 3
|
:margin-top 3
|
||||||
:padding 4})
|
:padding-top 1})
|
||||||
|
|
||||||
(def add-contact-text
|
(def add-contact-text
|
||||||
{:font-size 14
|
{:font-size 14
|
||||||
:color colors/gray})
|
:color colors/blue})
|
||||||
|
|
||||||
(def message-text
|
(def message-text
|
||||||
{:font-size 14})
|
{:font-size 14})
|
||||||
|
@ -114,3 +133,40 @@
|
||||||
(def chat-view
|
(def chat-view
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:background-color :white})
|
:background-color :white})
|
||||||
|
|
||||||
|
(defn contact-card-text [color]
|
||||||
|
{:color color
|
||||||
|
:font-size 14})
|
||||||
|
|
||||||
|
(def contact-card-gray-text
|
||||||
|
{:color colors/gray
|
||||||
|
:font-size 14})
|
||||||
|
|
||||||
|
(def chat-profile-body
|
||||||
|
{:margin 32})
|
||||||
|
|
||||||
|
(def chat-profile-row
|
||||||
|
{:flex-direction :row
|
||||||
|
:align-items :center
|
||||||
|
:margin-bottom 10})
|
||||||
|
|
||||||
|
(def chat-profile-icon-container
|
||||||
|
{:background-color (colors/alpha colors/blue 0.1)
|
||||||
|
:justify-content :center
|
||||||
|
:align-items :center
|
||||||
|
:border-radius 15
|
||||||
|
;; not sure idiomatic reagent for multiple style values
|
||||||
|
;; for margin
|
||||||
|
:width 22
|
||||||
|
:height 22
|
||||||
|
:margin-right 10})
|
||||||
|
|
||||||
|
(defn chat-profile-icon [color]
|
||||||
|
{:tint-color color
|
||||||
|
:width 15
|
||||||
|
:height 15})
|
||||||
|
|
||||||
|
(def chat-profile-contact-code
|
||||||
|
{:color colors/gray
|
||||||
|
:margin-top 10
|
||||||
|
:margin-bottom 5})
|
||||||
|
|
|
@ -13,32 +13,40 @@
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.colors :as colors]
|
||||||
[status-im.chat.views.message.datemark :as message.datemark]
|
[status-im.chat.views.message.datemark :as message.datemark]
|
||||||
|
[status-im.ui.screens.desktop.main.tabs.profile.views :as profile.views]
|
||||||
|
[status-im.ui.components.icons.vector-icons :as vector-icons]
|
||||||
[status-im.ui.screens.desktop.main.chat.styles :as styles]
|
[status-im.ui.screens.desktop.main.chat.styles :as styles]
|
||||||
[status-im.i18n :as i18n]))
|
[status-im.i18n :as i18n]))
|
||||||
|
|
||||||
(views/defview toolbar-chat-view []
|
(views/defview toolbar-chat-view []
|
||||||
(views/letsubs [{:keys [chat-id name public-key public? group-chat]} [:get-current-chat]
|
(views/letsubs [{:keys [chat-id public-key public? group-chat color]} [:get-current-chat]
|
||||||
{:keys [pending?]} [:get-current-chat-contact]]
|
{:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]
|
||||||
(let [chat-name (str
|
current-chat-name [:get-current-chat-name]]
|
||||||
(if public? "#" "")
|
[react/view {:style styles/toolbar-chat-view}
|
||||||
(if (string/blank? name)
|
[react/view {:style {:flex-direction :row
|
||||||
(gfycat.core/generate-gfy public-key)
|
:align-items :center}}
|
||||||
(or name
|
|
||||||
(i18n/label :t/chat-name))))]
|
[react/view {:style styles/img-container}
|
||||||
[react/view {:style styles/toolbar-chat-view}
|
(if public?
|
||||||
[react/view {:style {:flex-direction :row}}
|
[react/view {:style (styles/topic-image color)}
|
||||||
(when public?
|
[react/text {:style styles/topic-text}
|
||||||
[icons/icon :icons/public-chat])
|
(string/capitalize (first current-chat-name))]]
|
||||||
(when (and group-chat (not public?))
|
[react/image {:style styles/photo-style-toolbar
|
||||||
[icons/icon :icons/group-chat])
|
:source {:uri photo-path}}])]
|
||||||
[react/text {:style styles/toolbar-chat-name}
|
|
||||||
chat-name]]
|
[react/view
|
||||||
|
[react/text {:style styles/toolbar-chat-name} current-chat-name]
|
||||||
(when pending?
|
(when pending?
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press #(re-frame/dispatch [:add-pending-contact chat-id])}
|
{:on-press #(re-frame/dispatch [:add-contact whisper-identity])}
|
||||||
[react/view {:style styles/add-contact} ;style/add-contact
|
[react/view {:style styles/add-contact}
|
||||||
[react/text {:style styles/add-contact-text}
|
[react/text {:style styles/add-contact-text}
|
||||||
(i18n/label :t/add-to-contacts)]]])])))
|
(i18n/label :t/add-to-contacts)]]])]
|
||||||
|
(when (and (not group-chat) (not public?))
|
||||||
|
[react/text {:style {:position :absolute
|
||||||
|
:right 20}
|
||||||
|
:on-press #(re-frame/dispatch [:navigate-to :chat-profile])}
|
||||||
|
(i18n/label :t/view-profile)])]]))
|
||||||
|
|
||||||
(views/defview message-author-name [{:keys [outgoing from] :as message}]
|
(views/defview message-author-name [{:keys [outgoing from] :as message}]
|
||||||
(views/letsubs [current-account [:get-current-account]
|
(views/letsubs [current-account [:get-current-account]
|
||||||
|
@ -92,6 +100,8 @@
|
||||||
|
|
||||||
(defn message [text me? {:keys [message-id chat-id message-status user-statuses from
|
(defn message [text me? {:keys [message-id chat-id message-status user-statuses from
|
||||||
current-public-key content-type group-chat outgoing type value] :as message}]
|
current-public-key content-type group-chat outgoing type value] :as message}]
|
||||||
|
(when (nil? message-id)
|
||||||
|
(log/debug "nil?" message))
|
||||||
(if (= type :datemark)
|
(if (= type :datemark)
|
||||||
^{:key (str "datemark" message-id)}
|
^{:key (str "datemark" message-id)}
|
||||||
[message.datemark/chat-datemark value]
|
[message.datemark/chat-datemark value]
|
||||||
|
@ -177,3 +187,32 @@
|
||||||
[toolbar-chat-view]
|
[toolbar-chat-view]
|
||||||
[messages-view current-chat]
|
[messages-view current-chat]
|
||||||
[chat-text-input]]))
|
[chat-text-input]]))
|
||||||
|
|
||||||
|
(views/defview chat-profile []
|
||||||
|
(views/letsubs [{:keys [pending? whisper-identity public-key] :as contact} [:get-current-chat-contact]]
|
||||||
|
[react/view {:style styles/chat-profile-body}
|
||||||
|
[profile.views/profile-badge contact]
|
||||||
|
;; for private chat, public key will be chat-id
|
||||||
|
[react/view
|
||||||
|
(if pending?
|
||||||
|
[react/touchable-highlight {:on-press #(re-frame/dispatch [:add-contact whisper-identity])}
|
||||||
|
[react/view {:style styles/chat-profile-row}
|
||||||
|
[react/view {:style styles/chat-profile-icon-container
|
||||||
|
:accessibility-label :add-contact-link}
|
||||||
|
[vector-icons/icon :icons/add {:style (styles/chat-profile-icon colors/blue)}]]
|
||||||
|
[react/text {:style (styles/contact-card-text colors/blue)} (i18n/label :t/add-to-contacts)]]]
|
||||||
|
[react/view {:style styles/chat-profile-row}
|
||||||
|
[react/view {:style styles/chat-profile-icon-container
|
||||||
|
:accessibility-label :add-contact-link}
|
||||||
|
[vector-icons/icon :icons/add {:style (styles/chat-profile-icon colors/gray)}]]
|
||||||
|
[react/text {:style (styles/contact-card-text colors/gray)} (i18n/label :t/in-contacts)]])
|
||||||
|
[react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to-chat public-key])}
|
||||||
|
[react/view {:style styles/chat-profile-row}
|
||||||
|
[react/view {:style styles/chat-profile-icon-container
|
||||||
|
:accessibility-label :send-message-link}
|
||||||
|
[vector-icons/icon :icons/chats {:style (styles/chat-profile-icon colors/blue)}]]
|
||||||
|
[react/text {:style (styles/contact-card-text colors/blue)}
|
||||||
|
(i18n/label :t/send-message)]]]
|
||||||
|
[react/text {:style styles/chat-profile-contact-code} (i18n/label :t/contact-code)]
|
||||||
|
[react/text {:style {:font-size 14}
|
||||||
|
:selectable true} public-key]]]))
|
||||||
|
|
|
@ -63,12 +63,16 @@
|
||||||
:accessibility-label :share-my-contact-code-button}
|
:accessibility-label :share-my-contact-code-button}
|
||||||
[vector-icons/icon :icons/qr {:style {:tint-color colors/blue}}]]]])
|
[vector-icons/icon :icons/qr {:style {:tint-color colors/blue}}]]]])
|
||||||
|
|
||||||
(views/defview profile []
|
(views/defview profile [user]
|
||||||
(views/letsubs [current-account [:get-current-account]]
|
[react/view styles/profile-view
|
||||||
[react/view styles/profile-view
|
[profile-badge user]
|
||||||
[profile-badge current-account]
|
[share-contact-code]
|
||||||
[share-contact-code]
|
[react/view {:style styles/logout-row}
|
||||||
[react/view {:style styles/logout-row}
|
[react/touchable-highlight {:on-press #(re-frame/dispatch [:logout])}
|
||||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:logout])}
|
[react/text {:style (styles/logout-row-text colors/red)} (i18n/label :t/logout)]]
|
||||||
[react/text {:style (styles/logout-row-text colors/red)} (i18n/label :t/logout)]]
|
[react/view [react/text {:style (styles/logout-row-text colors/gray)} "V" build/version " (" build/commit-sha ")"]]]])
|
||||||
[react/view [react/text {:style (styles/logout-row-text colors/gray)} "V" build/version]]]]))
|
|
||||||
|
(views/defview profile-data []
|
||||||
|
(views/letsubs
|
||||||
|
[user [:get-current-account]]
|
||||||
|
[profile user]))
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
(views/defview tab-views []
|
(views/defview tab-views []
|
||||||
(views/letsubs [tab [:get-in [:desktop/desktop :tab-view-id]]]
|
(views/letsubs [tab [:get-in [:desktop/desktop :tab-view-id]]]
|
||||||
(let [component (case tab
|
(let [component (case tab
|
||||||
:profile profile.views/profile
|
:profile profile.views/profile-data
|
||||||
:home home.views/chat-list-view
|
:home home.views/chat-list-view
|
||||||
react/view)]
|
react/view)]
|
||||||
[react/view {:style {:flex 1}}
|
[react/view {:style {:flex 1}}
|
||||||
|
@ -25,9 +25,10 @@
|
||||||
(views/defview main-view []
|
(views/defview main-view []
|
||||||
(views/letsubs [view-id [:get :view-id]]
|
(views/letsubs [view-id [:get :view-id]]
|
||||||
(let [component (case view-id
|
(let [component (case view-id
|
||||||
:chat chat.views/chat-view
|
:chat chat.views/chat-view
|
||||||
:new-contact add-new.views/new-contact
|
:new-contact add-new.views/new-contact
|
||||||
:qr-code profile.views/qr-code
|
:qr-code profile.views/qr-code
|
||||||
|
:chat-profile chat.views/chat-profile
|
||||||
status-view)]
|
status-view)]
|
||||||
[react/view {:style {:flex 1}}
|
[react/view {:style {:flex 1}}
|
||||||
[component]])))
|
[component]])))
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
:accounts accounts.views/accounts
|
:accounts accounts.views/accounts
|
||||||
:recover recover.views/recover
|
:recover recover.views/recover
|
||||||
:create-account create.views/create-account
|
:create-account create.views/create-account
|
||||||
(:new-contact :chat :home :qr-code) main.views/main-views
|
(:new-contact :chat :home :qr-code :chat-profile) main.views/main-views
|
||||||
:login login.views/login
|
:login login.views/login
|
||||||
react/view)]
|
react/view)]
|
||||||
[react/view {:style {:flex 1}}
|
[react/view {:style {:flex 1}}
|
||||||
|
|
|
@ -26,6 +26,12 @@
|
||||||
:out
|
:out
|
||||||
(string/replace "\n" "")))
|
(string/replace "\n" "")))
|
||||||
|
|
||||||
|
(defmacro get-current-sha []
|
||||||
|
"fetches the latest commit sha from the current branch"
|
||||||
|
(-> (shell/sh "bash" "-c" "git describe --always")
|
||||||
|
:out
|
||||||
|
(string/replace "\n" "")))
|
||||||
|
|
||||||
(defmacro git-short-version []
|
(defmacro git-short-version []
|
||||||
(let [version-file-path "VERSION"
|
(let [version-file-path "VERSION"
|
||||||
version-file (io/file version-file-path)]
|
version-file (io/file version-file-path)]
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
(:require-macros [status-im.utils.build :as build]))
|
(:require-macros [status-im.utils.build :as build]))
|
||||||
|
|
||||||
(def version (build/git-short-version))
|
(def version (build/git-short-version))
|
||||||
|
(def commit-sha (build/get-current-sha))
|
||||||
(def build-no (build/get-build-no))
|
(def build-no (build/get-build-no))
|
||||||
|
|
Loading…
Reference in New Issue