call : accept/reject incoming calls
- removes contacts as sources for the smartList.
- creates smartListItems, and set them as sources for the smartList.
SmartListItem is a UI control, not a model.
- adds contacts and calls (associated) inside smartListItem.
- removes some UI property from contact class (model).
- adds a new filter : Controls, where smartListItems belongs.
Tuleap: #1014
Change-Id: Ia7679c2328f9dc85b6265c5e518aad08805230fb
diff --git a/ContactsViewModel.cpp b/ContactsViewModel.cpp
index 7ac6dc8..e0b43f5 100644
--- a/ContactsViewModel.cpp
+++ b/ContactsViewModel.cpp
@@ -64,28 +64,9 @@
saveContactsToFile();
}
});
- CallsViewModel::instance->callRecieved += ref new RingClientUWP::CallRecieved([&](
- Call^ call) {
- auto from = call->from;
- auto contact = findContactByName(from);
-
- if (contact == nullptr)
- contact = addNewContact(from, from); // contact checked inside addNewContact.
-
- bool isNotSelected = (contact != ContactsViewModel::instance->selectedContact) ? true : false;
-
- if (contact == nullptr) {
- ERR_("contact not handled!");
- return;
- }
- contact->_call = call;
- contact->_contactBarHeight = 50;
-
- });
-
}
-Contact^
+Contact^ // refacto : remove "byName"
ContactsViewModel::findContactByName(String^ name)
{
for each (Contact^ contact in contactsList_)
@@ -103,6 +84,7 @@
Contact^ contact = ref new Contact(trimedName, trimedName, nullptr, 0);
contactsList_->Append(contact);
saveContactsToFile();
+ contactAdded(contact);
return contact;
}
@@ -196,7 +178,9 @@
guid = contactObject->GetNamedString(GUIDKey);
unreadmessages = static_cast<uint16_t>(contactObject->GetNamedNumber(unreadMessagesKey));
}
- contactsList_->Append(ref new Contact(name, ringid, guid, unreadmessages));
+ auto contact = ref new Contact(name, ringid, guid, unreadmessages);
+ contactsList_->Append(contact);
+ contactAdded(contact);
}
}
}