accountadapter: move current account id and type properties to lrcinstance

Change-Id: I609452e83edd55a909d0f30aa6cb0daa3687ff3c
This commit is contained in:
Ming Rui Zhang
2021-05-13 17:47:23 -04:00
parent 76eb198b9c
commit 9d0f84d8be
32 changed files with 289 additions and 223 deletions

View File

@@ -48,7 +48,7 @@ MessagesAdapter::MessagesAdapter(AppSettingsManager* settingsManager,
void
MessagesAdapter::safeInit()
{
connect(lrcInstance_, &LRCInstance::currentAccountChanged, [this]() {
connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this]() {
currentConvUid_.clear();
connectConversationModel();
});
@@ -73,7 +73,7 @@ MessagesAdapter::setupChatView(const QString& convUid)
QString contactURI = convInfo.participants.at(0);
auto selectedAccountId = lrcInstance_->getCurrAccId();
auto selectedAccountId = lrcInstance_->getCurrentAccountId();
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(selectedAccountId);
lrc::api::contact::Info contactInfo;
@@ -131,7 +131,7 @@ MessagesAdapter::connectConversationModel()
[this](const QString& convUid,
uint64_t interactionId,
const lrc::api::interaction::Info& interaction) {
auto accountId = lrcInstance_->getCurrAccId();
auto accountId = lrcInstance_->getCurrentAccountId();
newInteraction(accountId, convUid, interactionId, interaction);
});
@@ -180,7 +180,7 @@ void
MessagesAdapter::slotSendMessageContentSaved(const QString& content)
{
if (!LastConvUid_.isEmpty()) {
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrAccId(), content);
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrentAccountId(), content);
}
LastConvUid_ = lrcInstance_->get_selectedConvUid();
@@ -189,7 +189,7 @@ MessagesAdapter::slotSendMessageContentSaved(const QString& content)
setInvitation(false);
clear();
auto restoredContent = lrcInstance_->getContentDraft(lrcInstance_->get_selectedConvUid(),
lrcInstance_->getCurrAccId());
lrcInstance_->getCurrentAccountId());
setSendMessageContent(restoredContent);
}
@@ -197,7 +197,7 @@ void
MessagesAdapter::slotUpdateDraft(const QString& content)
{
if (!LastConvUid_.isEmpty()) {
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrAccId(), content);
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrentAccountId(), content);
}
}