fix : message text bugs

- fix wrong unread notifications.
- fix, closes the chat panel at the end of a call.
- cleanup some tricky code.

Change-Id: I65beca257bd4aee5451165ef6dc0a9ad5236161e
Tuleap: #790
diff --git a/MainPage.xaml.cpp b/MainPage.xaml.cpp
index f219fb1..140a76b 100644
--- a/MainPage.xaml.cpp
+++ b/MainPage.xaml.cpp
@@ -232,7 +232,6 @@
         }

     }

 

-    videoPage->chatOpen = false;

     videoPage->updatePageContent();

     showFrame(_videoFrame_);

 }

diff --git a/MessageTextPage.xaml.cpp b/MessageTextPage.xaml.cpp
index 9700db0..9c6be50 100644
--- a/MessageTextPage.xaml.cpp
+++ b/MessageTextPage.xaml.cpp
@@ -72,6 +72,7 @@
     /* show the name of contact on the page */

     _title_->Text = contact->_name;

     _profilName_->Text = contact->_displayName;

+    contact->_unreadMessages = 0;

 

     String^ image_path = Utils::toPlatformString(RingD::instance->getLocalFolder()) + ".vcards\\" + contact->_vcardUID + ".png";

     if (Utils::fileExists(Utils::toString(image_path))) {

diff --git a/SmartPanel.xaml b/SmartPanel.xaml
index 187eda2..44d0983 100644
--- a/SmartPanel.xaml
+++ b/SmartPanel.xaml
@@ -256,8 +256,6 @@
                             </Border>-->

                             <Border x:Name="_visualNotificationNewMessage_"

                                     Visibility="{x:Bind _contact._unreadMessages, Converter={StaticResource _NewMessageBubleNotification_}, Mode=OneWay}"

-                                    BorderThickness="2"

-                                    BorderBrush="White"

                                     Style="{StaticResource BorderStyle2}">

                                 <TextBlock Text="{x:Bind _contact._unreadMessages, Mode=OneWay}"

                                            Style="{StaticResource TextStyle3}"/>

diff --git a/VideoPage.xaml.cpp b/VideoPage.xaml.cpp
index 67dc210..1ec2c97 100644
--- a/VideoPage.xaml.cpp
+++ b/VideoPage.xaml.cpp
@@ -136,6 +136,10 @@
         }

         case CallStatus::ENDED:

             Video::VideoManager::instance->rendererManager()->raiseClearRenderTarget();

+

+            /* "close" the chat panel */

+            _rowChatBx_->Height = 0;

+

             break;

         case CallStatus::PEER_PAUSED:

         case CallStatus::PAUSED:

@@ -267,15 +271,13 @@
 

 void RingClientUWP::Views::VideoPage::_btnChat__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e)

 {

-    chatOpen = !chatOpen;

-    _rowChatBx_->Height = (chatOpen) ? 200 : 0;

-    /*if (chatOpen) {

+    if (_rowChatBx_->Height == 0) {

         _rowChatBx_->Height = 200;

-        chatPanelCall();

+        SmartPanelItemsViewModel::instance->_selectedItem->_contact->_unreadMessages = 0;

     }

     else {

         _rowChatBx_->Height = 0;

-    }*/

+    }

 }

 

 

@@ -395,19 +397,8 @@
 

 void RingClientUWP::Views::VideoPage::OnincomingMessage(Platform::String ^callId, Platform::String ^payload)

 {

-    if (!chatOpen) {

+    if (_rowChatBx_->Height == 0)

         _rowChatBx_->Height = 200;

-        chatOpen = true;

-    }

-

-    auto item = SmartPanelItemsViewModel::instance->_selectedItem;

-

-    //if (item)

-    //    if (item->_callId != callId) {

-    //        SmartPanelItemsViewModel::instance->findItem(callId)->_contact->_unreadMessages++;

-    //        //item->_contact->_unreadMessages++;

-    //    }

-

 

     scrollDown();

 }

diff --git a/VideoPage.xaml.h b/VideoPage.xaml.h
index ffd567a..bda71fa 100644
--- a/VideoPage.xaml.h
+++ b/VideoPage.xaml.h
@@ -63,18 +63,6 @@
         }

     }

 

-    property bool chatOpen // use this with a converter to set the height to 200px for the chatpanel...

-    {

-        bool get()

-        {

-            return chatOpen_;

-        }

-        void set(bool value)

-        {

-            chatOpen_ = value;

-        }

-    }

-

     void scrollDown();

     void screenVideo(bool state);

 

@@ -95,7 +83,6 @@
 

 private:

     bool barFading_;

-    bool chatOpen_;

 

     void _sendBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);

     void _messageTextBox__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);