Skip to content
Snippets Groups Projects
Commit a535ee13 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Andreas Traczyk
Browse files

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
Branches
Tags
No related merge requests found
...@@ -75,8 +75,6 @@ Contact::Contact(String^ name, ...@@ -75,8 +75,6 @@ Contact::Contact(String^ name,
/* connect to delegate */ /* connect to delegate */
ContactsViewModel::instance->notifyNewConversationMessage += ref new NotifyNewConversationMessage([&] () { ContactsViewModel::instance->notifyNewConversationMessage += ref new NotifyNewConversationMessage([&] () {
notificationNewMessage = Windows::UI::Xaml::Visibility::Visible;
unreadMessages_++;
PropertyChanged(this, ref new PropertyChangedEventArgs("unreadMessages")); PropertyChanged(this, ref new PropertyChangedEventArgs("unreadMessages"));
}); });
ContactsViewModel::instance->newContactSelected += ref new RingClientUWP::NewContactSelected([&]() { ContactsViewModel::instance->newContactSelected += ref new RingClientUWP::NewContactSelected([&]() {
...@@ -88,6 +86,14 @@ Contact::Contact(String^ name, ...@@ -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 void
Contact::NotifyPropertyChanged(String^ propertyName) Contact::NotifyPropertyChanged(String^ propertyName)
{ {
......
...@@ -75,6 +75,7 @@ internal: ...@@ -75,6 +75,7 @@ internal:
void saveConversationToFile(); void saveConversationToFile();
String^ StringifyConversation(); String^ StringifyConversation();
void DestringifyConversation(String^ data); void DestringifyConversation(String^ data);
void addNotifyNewConversationMessage();
protected: protected:
void NotifyPropertyChanged(String^ propertyName); void NotifyPropertyChanged(String^ propertyName);
......
...@@ -55,8 +55,12 @@ ContactsViewModel::ContactsViewModel() ...@@ -55,8 +55,12 @@ ContactsViewModel::ContactsViewModel()
/* save contacts conversation to disk */ /* save contacts conversation to disk */
contact->saveConversationToFile(); 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(); notifyNewConversationMessage();
}
}); });
} }
......
...@@ -44,11 +44,6 @@ SmartPanel::SmartPanel() ...@@ -44,11 +44,6 @@ SmartPanel::SmartPanel()
_accountsList_->ItemsSource = AccountsViewModel::instance->accountsList; _accountsList_->ItemsSource = AccountsViewModel::instance->accountsList;
_smartList_->ItemsSource = ContactsViewModel::instance->contactsList; _smartList_->ItemsSource = ContactsViewModel::instance->contactsList;
/* connect delegate */
ContactsViewModel::instance->notifyNewConversationMessage += ref new NotifyNewConversationMessage([&]() {
//_visualNotificationNewMessage_->Vi
});
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment