Skip to content
Snippets Groups Projects
Commit b00d61fc authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

lrcinstance: clear the interaction cache when switching the conversation

Gitlab: #550
Change-Id: I713af229a3f90ca9d6b3e526ae3c710e7f573c66
parent 44fdbb83
No related branches found
No related tags found
No related merge requests found
...@@ -428,3 +428,22 @@ LRCInstance::getCurrentCallId() ...@@ -428,3 +428,22 @@ LRCInstance::getCurrentCallId()
return QString(); return QString();
} }
} }
QString
LRCInstance::get_selectedConvUid()
{
return selectedConvUid_;
}
void
LRCInstance::set_selectedConvUid(QString selectedConvUid)
{
if (selectedConvUid_ != selectedConvUid) {
auto& accInfo = accountModel().getAccountInfo(get_currentAccountId());
auto& convModel = accInfo.conversationModel;
convModel->clearInteractionsCache(selectedConvUid_);
selectedConvUid_ = selectedConvUid;
Q_EMIT selectedConvUidChanged();
}
}
...@@ -55,7 +55,8 @@ using getConvPredicate = std::function<bool(const conversation::Info& conv)>; ...@@ -55,7 +55,8 @@ using getConvPredicate = std::function<bool(const conversation::Info& conv)>;
class LRCInstance : public QObject class LRCInstance : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_PROPERTY(QString, selectedConvUid) Q_PROPERTY(QString selectedConvUid READ get_selectedConvUid WRITE set_selectedConvUid NOTIFY
selectedConvUidChanged)
QML_PROPERTY(QString, currentAccountId) QML_PROPERTY(QString, currentAccountId)
QML_RO_PROPERTY(lrc::api::profile::Type, currentAccountType) QML_RO_PROPERTY(lrc::api::profile::Type, currentAccountType)
QML_PROPERTY(bool, currentAccountAvatarSet) QML_PROPERTY(bool, currentAccountAvatarSet)
...@@ -123,8 +124,13 @@ public: ...@@ -123,8 +124,13 @@ public:
bool hasActiveCall(bool withVideo = false); bool hasActiveCall(bool withVideo = false);
VectorString getConferenceSubcalls(const QString& callId); VectorString getConferenceSubcalls(const QString& callId);
QString get_selectedConvUid();
void set_selectedConvUid(QString selectedConvUid = "");
Q_SIGNALS: Q_SIGNALS:
void accountListChanged(); void accountListChanged();
void selectedConvUidChanged();
void restoreAppRequested(); void restoreAppRequested();
void notificationClicked(); void notificationClicked();
void quitEngineRequested(); void quitEngineRequested();
...@@ -136,6 +142,7 @@ private: ...@@ -136,6 +142,7 @@ private:
std::unique_ptr<RenderManager> renderer_; std::unique_ptr<RenderManager> renderer_;
std::unique_ptr<UpdateManager> updateManager_; std::unique_ptr<UpdateManager> updateManager_;
QString selectedConvUid_;
MapStringString contentDrafts_; MapStringString contentDrafts_;
MapStringString lastConferences_; MapStringString lastConferences_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment