Add version numbers

This commit is contained in:
Aditya Kulkarni
2019-01-31 14:49:16 -08:00
parent 1b938928e2
commit 37b5645cd9
4 changed files with 22 additions and 19 deletions

View File

@@ -88,7 +88,8 @@ void RPC::setConnection(Connection* c) {
ui->statusBar->showMessage("Ready!");
refreshZECPrice();
checkForUpdate();
// Commented for Android beta.
// checkForUpdate();
// Force update, because this might be coming from a settings update
// where we need to immediately refresh

View File

@@ -1 +1 @@
#define APP_VERSION "0.5.7"
#define APP_VERSION "0.5.7-androidbeta"

View File

@@ -3,6 +3,7 @@
#include "rpc.h"
#include "settings.h"
#include "ui_mobileappconnector.h"
#include "version.h"
WSServer::WSServer(quint16 port, bool debug, QObject *parent) :
QObject(parent),
@@ -408,30 +409,23 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, QW
// Filter out sprout Txns
if (Settings::getInstance()->isSproutAddress(i))
continue;
// Filter out balances that don't have the requisite amount
if (allBalances->value(i) < amt)
continue;
bals.append(QPair<QString, double>(i, allBalances->value(i)));
}
if (bals.isEmpty()) {
error("No sapling or transparent addresses");
error("No sapling or transparent addresses with enough balance to spend.");
return;
}
std::sort(bals.begin(), bals.end(), [=](const QPair<QString, double>a, const QPair<QString, double> b) ->bool {
// If same type, sort by amount
if (a.first[0] == b.first[0]) {
return a.second > b.second;
}
else {
return a > b;
}
std::sort(bals.begin(), bals.end(), [=](const QPair<QString, double>a, const QPair<QString, double> b) -> bool {
// Sort z addresses first
return a.first > b.first;
});
if (amt > bals[0].second) {
// There isn't any any address capable of sending the Tx.
error("Amount exceeds the balance of your largest address.");
return;
}
tx.fromAddr = bals[0].first;
tx.toAddrs = { ToFields{ sendTx["to"].toString(), amt, sendTx["memo"].toString(), sendTx["memo"].toString().toUtf8().toHex()} };
@@ -468,6 +462,13 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, QW
void AppDataServer::processGetInfo(QJsonObject jobj, MainWindow* mainWindow, QWebSocket* pClient) {
auto connectedName = jobj["name"].toString();
double maxSpendable = 0;
auto balances = mainWindow->getRPC()->getAllBalances()->values();
if (balances.length() > 0) {
std::sort(balances.begin(), balances.end(), std::less<double>());
maxSpendable = balances[balances.length() - 1];
}
{
QSettings s;
s.setValue("mobileapp/connectedname", connectedName);
@@ -479,8 +480,10 @@ void AppDataServer::processGetInfo(QJsonObject jobj, MainWindow* mainWindow, QWe
{"saplingAddress", mainWindow->getRPC()->getDefaultSaplingAddress()},
{"tAddress", mainWindow->getRPC()->getDefaultTAddress()},
{"balance", AppDataModel::getInstance()->getTotalBalance()},
{"maxspendable", maxSpendable},
{"tokenName", Settings::getTokenName()},
{"zecprice", Settings::getInstance()->getZECPrice()}
{"zecprice", Settings::getInstance()->getZECPrice()},
{"serverversion", QString(APP_VERSION)}
}).toJson();
pClient->sendTextMessage(encryptOutgoing(r));
}

View File

@@ -89,7 +89,6 @@ private:
double balTransparent;
double balShielded;
double balTotal;
double balMaxSingle;
QString saplingAddress;