refresh if conf=1
This commit is contained in:
@@ -216,6 +216,11 @@ void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
|
|||||||
this->requestZaddrMap[tx] = requestZaddr;
|
this->requestZaddrMap[tx] = requestZaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatModel::addconfirmations(QString tx, int confirmation)
|
||||||
|
{
|
||||||
|
this->confirmationsMap[tx] = confirmation;
|
||||||
|
}
|
||||||
|
|
||||||
QString ChatModel::getCidByTx(QString tx)
|
QString ChatModel::getCidByTx(QString tx)
|
||||||
{
|
{
|
||||||
for(auto& pair : this->cidMap)
|
for(auto& pair : this->cidMap)
|
||||||
@@ -231,6 +236,21 @@ QString ChatModel::getCidByTx(QString tx)
|
|||||||
return QString("0xdeadbeef");
|
return QString("0xdeadbeef");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ChatModel::getConfirmationByTx(QString tx)
|
||||||
|
{
|
||||||
|
for(auto& pair : this->confirmationsMap)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->confirmationsMap.count(tx) > 0)
|
||||||
|
{
|
||||||
|
return this->confirmationsMap[tx];
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString("0xdeadbeef");
|
||||||
|
}
|
||||||
|
|
||||||
QString ChatModel::getrequestZaddrByTx(QString tx)
|
QString ChatModel::getrequestZaddrByTx(QString tx)
|
||||||
{
|
{
|
||||||
for(auto& pair : this->requestZaddrMap)
|
for(auto& pair : this->requestZaddrMap)
|
||||||
@@ -256,6 +276,11 @@ void ChatModel::killrequestZaddrCache()
|
|||||||
this->requestZaddrMap.clear();
|
this->requestZaddrMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatModel::killConfirmationCache()
|
||||||
|
{
|
||||||
|
this->confirmationsMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, int version=0, int headerNumber=1)
|
QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, int version=0, int headerNumber=1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class ChatModel
|
|||||||
MainWindow* main;
|
MainWindow* main;
|
||||||
std::map<QString, QString> cidMap;
|
std::map<QString, QString> cidMap;
|
||||||
std::map<QString, QString> requestZaddrMap;
|
std::map<QString, QString> requestZaddrMap;
|
||||||
|
std::map<QString, QString> confirmationsMap;
|
||||||
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -49,10 +50,13 @@ class ChatModel
|
|||||||
void addMessage(QString timestamp, ChatItem item);
|
void addMessage(QString timestamp, ChatItem item);
|
||||||
void addCid(QString tx, QString cid);
|
void addCid(QString tx, QString cid);
|
||||||
void addrequestZaddr(QString tx, QString requestZaddr);
|
void addrequestZaddr(QString tx, QString requestZaddr);
|
||||||
|
void addconfirmations(QString tx, int confirmation);
|
||||||
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
|
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
|
||||||
QString getCidByTx(QString tx);
|
QString getCidByTx(QString tx);
|
||||||
QString getrequestZaddrByTx(QString tx);
|
QString getrequestZaddrByTx(QString tx);
|
||||||
|
QString getConfirmationByTx(QString tx);
|
||||||
void killCidCache();
|
void killCidCache();
|
||||||
|
void killConfirmationCache();
|
||||||
void killrequestZaddrCache();
|
void killrequestZaddrCache();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -896,6 +896,16 @@ void Controller::refreshTransactions() {
|
|||||||
CAmount amount = CAmount::fromqint64(-1* o["value"].get<json::number_unsigned_t>());
|
CAmount amount = CAmount::fromqint64(-1* o["value"].get<json::number_unsigned_t>());
|
||||||
|
|
||||||
// Check for Memos
|
// Check for Memos
|
||||||
|
|
||||||
|
if (confirmations == 0) {
|
||||||
|
chatModel->addconfirmations(txid, confirmations);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
|
||||||
|
DataStore::getChatDataStore()->clear();
|
||||||
|
chatModel->killConfirmationCache();
|
||||||
|
this->refresh(true);
|
||||||
|
}
|
||||||
|
|
||||||
QString memo;
|
QString memo;
|
||||||
if (!o["memo"].is_null()) {
|
if (!o["memo"].is_null()) {
|
||||||
@@ -912,10 +922,6 @@ void Controller::refreshTransactions() {
|
|||||||
isNotarized = false;
|
isNotarized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirmations == 1) {
|
|
||||||
DataStore::getChatDataStore()->clear();
|
|
||||||
this->refresh(true);
|
|
||||||
}
|
|
||||||
qDebug()<<"Conf : " << confirmations;
|
qDebug()<<"Conf : " << confirmations;
|
||||||
|
|
||||||
ChatItem item = ChatItem(
|
ChatItem item = ChatItem(
|
||||||
@@ -932,10 +938,13 @@ void Controller::refreshTransactions() {
|
|||||||
isNotarized
|
isNotarized
|
||||||
);
|
);
|
||||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// this->refresh(true);
|
||||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||||
total_amount = total_amount + amount;
|
total_amount = total_amount + amount;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user