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

text message : print message on message text page

Change-Id: I49fae020f196ffa5450d414bcce5ded0c1d0c092
Tuleap: #971
parent 0788e96d
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ ContactsViewModel::ContactsViewModel() ...@@ -50,7 +50,7 @@ ContactsViewModel::ContactsViewModel()
return; return;
} }
screenConversationMessage("" /* accountId not used yet at this stage */, from, payload); contact->_conversation->addMessage(""/* date not yet used*/, MSG_FROM_CONTACT, payload);
if (contact->ringID_ == from && isNotSelected) if (contact->ringID_ == from && isNotSelected)
notifyNewConversationMessage(); notifyNewConversationMessage();
......
...@@ -28,6 +28,7 @@ using namespace RingClientUWP; ...@@ -28,6 +28,7 @@ using namespace RingClientUWP;
Conversation::Conversation() Conversation::Conversation()
{ {
messagesList_ = ref new Vector<ConversationMessage^>();
} }
void void
...@@ -40,4 +41,9 @@ Conversation::addMessage(String^ date, bool fromContact, String^ payload) ...@@ -40,4 +41,9 @@ Conversation::addMessage(String^ date, bool fromContact, String^ payload)
std::string owner((fromContact) ? "from contact" : " from me"); std::string owner((fromContact) ? "from contact" : " from me");
MSG_("{Conversation::addMessage}"); MSG_("{Conversation::addMessage}");
MSG_("owner = " + owner); MSG_("owner = " + owner);
/* add message to _messagesList_ */
messagesList_->Append(message);
// TODO store message on the disk
} }
...@@ -36,11 +36,23 @@ private: ...@@ -36,11 +36,23 @@ private:
public: public:
/* functions */
Conversation(); Conversation();
void addMessage(String^ date, bool fromContact, String^ payload); void addMessage(String^ date, bool fromContact, String^ payload);
internal:
/* properties */
property Vector<ConversationMessage^>^ _messages
{
Vector<ConversationMessage^>^ get()
{
return messagesList_;
}
}
private: private:
Vector<ConversationMessage^> messages; /* members */
Vector<ConversationMessage^>^ messagesList_;
}; };
#define MSG_FROM_CONTACT true #define MSG_FROM_CONTACT true
......
...@@ -9,20 +9,11 @@ ...@@ -9,20 +9,11 @@
mc:Ignorable="d"> mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<!--<DataTemplate x:Key="MessageTemplate" x:DataType="local:RingInstantMessage"> <DataTemplate x:Key="ConversationMessageTemplate" x:DataType="local:ConversationMessage">
<Grid> <Grid>
<Grid.ColumnDefinitions> <TextBlock x:Name="_msgContent_" Text="{x:Bind Payload}"/>
<ColumnDefinition Width="70" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image x:Name="_contactAvatar_"
Margin="2,2"
Source="ms-appx:///contact-avatar-test.png"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock x:Name="_msgContent_" Text="{x:Bind msg_}"/>
</Grid> </Grid>
</DataTemplate>--> </DataTemplate>
<!-- barre d'envoi de message --> <!-- barre d'envoi de message -->
<Style TargetType="TextBox"> <Style TargetType="TextBox">
...@@ -121,7 +112,10 @@ ...@@ -121,7 +112,10 @@
Grid.Row="1"> Grid.Row="1">
<StackPanel x:Name="_messagesWindowOutput_" <StackPanel x:Name="_messagesWindowOutput_"
Background="#FFF2F2F2"> Background="#FFF2F2F2">
<ListBox x:Name="_messagesList_"
Margin="0"
Padding="0"
ItemTemplate="{StaticResource ConversationMessageTemplate}"/>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
<Grid Height="50" <Grid Height="50"
......
...@@ -40,6 +40,12 @@ using namespace Windows::UI::Xaml::Navigation; ...@@ -40,6 +40,12 @@ using namespace Windows::UI::Xaml::Navigation;
MessageTextPage::MessageTextPage() MessageTextPage::MessageTextPage()
{ {
InitializeComponent(); InitializeComponent();
/* connect delegates. */ // may be useless
RingD::instance->incomingAccountMessage += ref new IncomingAccountMessage([&](String^ accountId,
String^ from, String^ payload) {
});
} }
void void
...@@ -57,7 +63,8 @@ RingClientUWP::Views::MessageTextPage::updatePageContent() ...@@ -57,7 +63,8 @@ RingClientUWP::Views::MessageTextPage::updatePageContent()
_title_->Text = contact->name_; _title_->Text = contact->name_;
_messagesWindowOutput_->Children->Clear(); _messagesList_->ItemsSource = contact->_conversation->_messages;
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment