Commit 58c70b06 authored by Nicolas Jager's avatar Nicolas Jager

account/text message : add conversation model

- adds conversation class and conversationMessage class.

- adds to each contact a conversation member wich will store the messages history.

Change-Id: Icdab0e2345ef2889057c06d965ff0eb2940c5a27
Tuleap: #943
parent 7224c766
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -30,6 +31,7 @@ Contact::Contact(String^ name,
{
name_ = name;
ringID_ = ringID;
conversation_ = ref new Conversation();
}
void
......
......@@ -2,6 +2,7 @@
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -21,6 +22,7 @@ using namespace Windows::UI::Xaml::Data;
namespace RingClientUWP
{
ref class Conversation;
public ref class Contact sealed : public INotifyPropertyChanged
{
public:
......@@ -31,10 +33,19 @@ public:
property String^ name_;
property String^ ringID_;
property Conversation^ _conversation
{
Conversation^ get()
{
return conversation_;
}
}
protected:
void NotifyPropertyChanged(String^ propertyName);
private:
Conversation^ conversation_;
};
}
......
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "pch.h"
#include "Conversation.h"
using namespace Windows::ApplicationModel::Core;
using namespace Platform;
using namespace Windows::UI::Core;
using namespace RingClientUWP;
Conversation::Conversation()
{
}
void
Conversation::addMessage(String^ date, bool fromContact, String^ payload)
{
ConversationMessage^ message = ref new ConversationMessage();
message->Date = date;
message->FromContact = fromContact;
message->Payload = payload;
std::string owner((fromContact) ? "from contact" : " from me");
MSG_("{Conversation::addMessage}");
MSG_("owner = " + owner);
}
#pragma once
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
using namespace Platform;
using namespace Windows::UI::Xaml::Data;
namespace RingClientUWP
{
public ref class ConversationMessage sealed
{
public:
property String^ Date;
property bool FromContact;
property String^ Payload;
};
public ref class Conversation sealed
{
private:
public:
Conversation();
void addMessage(String^ date, bool fromContact, String^ payload);
private:
Vector<ConversationMessage^> messages;
};
#define MSG_FROM_CONTACT true
#define MSG_FROM_ME false
}
......@@ -20,6 +20,7 @@
/* standard system include files. */
#include <ppltasks.h>
#include <iomanip>
#include <queue>
/* required by generated headers. */
#include "App.xaml.h"
......@@ -28,6 +29,7 @@
#include "Call.h"
#include "Contact.h"
#include "ContactsViewModel.h"
#include "Conversation.h"
/* ensure to be accessed from anywhere */
#include "RingD.h"
......
......@@ -164,6 +164,7 @@
<ClInclude Include="CallsViewModel.h" />
<ClInclude Include="Contact.h" />
<ClInclude Include="ContactsViewModel.h" />
<ClInclude Include="Conversation.h" />
<ClInclude Include="LoadingPage.xaml.h">
<DependentUpon>LoadingPage.xaml</DependentUpon>
</ClInclude>
......@@ -263,6 +264,7 @@
<ClCompile Include="CallsViewModel.cpp" />
<ClCompile Include="Contact.cpp" />
<ClCompile Include="ContactsViewModel.cpp" />
<ClCompile Include="Conversation.cpp" />
<ClCompile Include="LoadingPage.xaml.cpp">
<DependentUpon>LoadingPage.xaml</DependentUpon>
</ClCompile>
......
......@@ -71,6 +71,9 @@
<ClCompile Include="Call.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="Conversation.cpp">
<Filter>Model</Filter>
</ClCompile>
<ClCompile Include="CallsViewModel.cpp">
<Filter>ModelViews</Filter>
</ClCompile>
......@@ -112,6 +115,9 @@
</ClInclude>
<ClInclude Include="CallsViewModel.h">
<Filter>ModelViews</Filter>
</ClInclude>
<ClInclude Include="Conversation.h">
<Filter>Model</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
......
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