Commit a535ee13 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

notifications(fix): notify only the contact that the message applies to

- prevents the ContactViewModel's connected delegate that updates upon
  text message reception, from incrementing all contact's unread message
  count

Change-Id: Ief09bfd077cf1e28ecc23a2df1cc68b4eddf3bbd
Tuleap: #982
parent f5be5463
......@@ -75,8 +75,6 @@ Contact::Contact(String^ name,
/* connect to delegate */
ContactsViewModel::instance->notifyNewConversationMessage += ref new NotifyNewConversationMessage([&] () {
notificationNewMessage = Windows::UI::Xaml::Visibility::Visible;
unreadMessages_++;
PropertyChanged(this, ref new PropertyChangedEventArgs("unreadMessages"));
});
ContactsViewModel::instance->newContactSelected += ref new RingClientUWP::NewContactSelected([&]() {
......@@ -88,6 +86,14 @@ Contact::Contact(String^ name,
});
}
void
Contact::addNotifyNewConversationMessage()
{
notificationNewMessage = Windows::UI::Xaml::Visibility::Visible;
unreadMessages_++;
RingDebug::instance->print(Utils::toString(unreadMessages_.ToString()));
}
void
Contact::NotifyPropertyChanged(String^ propertyName)
{
......
......@@ -75,6 +75,7 @@ internal:
void saveConversationToFile();
String^ StringifyConversation();
void DestringifyConversation(String^ data);
void addNotifyNewConversationMessage();
protected:
void NotifyPropertyChanged(String^ propertyName);
......
......@@ -55,8 +55,12 @@ ContactsViewModel::ContactsViewModel()
/* save contacts conversation to disk */
contact->saveConversationToFile();
if (contact->ringID_ == from && isNotSelected)
if (contact->ringID_ == from && isNotSelected) {
// increment contact's unread message count
contact->addNotifyNewConversationMessage();
// update the xaml for all
notifyNewConversationMessage();
}
});
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment