Skip to content
Snippets Groups Projects
Commit 58c70b06 authored by Nicolas Jager's avatar Nicolas Jager
Browse files

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
No related branches found
No related tags found
No related merge requests found
/************************************************************************** /**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux * * Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> * * 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 * * 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 * * it under the terms of the GNU General Public License as published by *
...@@ -30,6 +31,7 @@ Contact::Contact(String^ name, ...@@ -30,6 +31,7 @@ Contact::Contact(String^ name,
{ {
name_ = name; name_ = name;
ringID_ = ringID; ringID_ = ringID;
conversation_ = ref new Conversation();
} }
void void
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/************************************************************************** /**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux * * Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> * * 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 * * 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 * * it under the terms of the GNU General Public License as published by *
...@@ -21,6 +22,7 @@ using namespace Windows::UI::Xaml::Data; ...@@ -21,6 +22,7 @@ using namespace Windows::UI::Xaml::Data;
namespace RingClientUWP namespace RingClientUWP
{ {
ref class Conversation;
public ref class Contact sealed : public INotifyPropertyChanged public ref class Contact sealed : public INotifyPropertyChanged
{ {
public: public:
...@@ -31,10 +33,19 @@ public: ...@@ -31,10 +33,19 @@ public:
property String^ name_; property String^ name_;
property String^ ringID_; property String^ ringID_;
property Conversation^ _conversation
{
Conversation^ get()
{
return conversation_;
}
}
protected: protected:
void NotifyPropertyChanged(String^ propertyName); 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 @@ ...@@ -20,6 +20,7 @@
/* standard system include files. */ /* standard system include files. */
#include <ppltasks.h> #include <ppltasks.h>
#include <iomanip> #include <iomanip>
#include <queue>
/* required by generated headers. */ /* required by generated headers. */
#include "App.xaml.h" #include "App.xaml.h"
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
#include "Call.h" #include "Call.h"
#include "Contact.h" #include "Contact.h"
#include "ContactsViewModel.h" #include "ContactsViewModel.h"
#include "Conversation.h"
/* ensure to be accessed from anywhere */ /* ensure to be accessed from anywhere */
#include "RingD.h" #include "RingD.h"
......
...@@ -164,6 +164,7 @@ ...@@ -164,6 +164,7 @@
<ClInclude Include="CallsViewModel.h" /> <ClInclude Include="CallsViewModel.h" />
<ClInclude Include="Contact.h" /> <ClInclude Include="Contact.h" />
<ClInclude Include="ContactsViewModel.h" /> <ClInclude Include="ContactsViewModel.h" />
<ClInclude Include="Conversation.h" />
<ClInclude Include="LoadingPage.xaml.h"> <ClInclude Include="LoadingPage.xaml.h">
<DependentUpon>LoadingPage.xaml</DependentUpon> <DependentUpon>LoadingPage.xaml</DependentUpon>
</ClInclude> </ClInclude>
...@@ -263,6 +264,7 @@ ...@@ -263,6 +264,7 @@
<ClCompile Include="CallsViewModel.cpp" /> <ClCompile Include="CallsViewModel.cpp" />
<ClCompile Include="Contact.cpp" /> <ClCompile Include="Contact.cpp" />
<ClCompile Include="ContactsViewModel.cpp" /> <ClCompile Include="ContactsViewModel.cpp" />
<ClCompile Include="Conversation.cpp" />
<ClCompile Include="LoadingPage.xaml.cpp"> <ClCompile Include="LoadingPage.xaml.cpp">
<DependentUpon>LoadingPage.xaml</DependentUpon> <DependentUpon>LoadingPage.xaml</DependentUpon>
</ClCompile> </ClCompile>
......
...@@ -71,6 +71,9 @@ ...@@ -71,6 +71,9 @@
<ClCompile Include="Call.cpp"> <ClCompile Include="Call.cpp">
<Filter>Common</Filter> <Filter>Common</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Conversation.cpp">
<Filter>Model</Filter>
</ClCompile>
<ClCompile Include="CallsViewModel.cpp"> <ClCompile Include="CallsViewModel.cpp">
<Filter>ModelViews</Filter> <Filter>ModelViews</Filter>
</ClCompile> </ClCompile>
...@@ -113,6 +116,9 @@ ...@@ -113,6 +116,9 @@
<ClInclude Include="CallsViewModel.h"> <ClInclude Include="CallsViewModel.h">
<Filter>ModelViews</Filter> <Filter>ModelViews</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Conversation.h">
<Filter>Model</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="Assets\LockScreenLogo.scale-200.png"> <Image Include="Assets\LockScreenLogo.scale-200.png">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment