Commit 28c251d6 authored by Erwan Croze's avatar Erwan Croze 👋🏻

Fixing bug in last commit

parent 73539542
......@@ -54,7 +54,7 @@ namespace Linphone.Controls {
if (message.Appdata != null && message.Appdata.Length > 0) {
// Image already downloaded
Image.Visibility = Visibility.Visible;
//Save.Visibility = Visibility.Visible;
Download.Visibility = Visibility.Collapsed;
SetImage(message.Appdata);
} else {
// Image needs to be downloaded
......@@ -63,6 +63,7 @@ namespace Linphone.Controls {
} else {
Message.Visibility = Visibility.Visible;
Image.Visibility = Visibility.Collapsed;
Download.Visibility = Visibility.Collapsed;
Message.Blocks.Add(Utils.FormatText(message.Text));
}
}
......@@ -140,15 +141,19 @@ namespace Linphone.Controls {
/// Displays the image in the bubble
/// </summary>
public void RefreshImage() {
string filePath = ChatMessage.FileTransferFilepath;
ProgressBar.Visibility = Visibility.Collapsed;
if (filePath != null && filePath.Length > 0) {
Download.Visibility = Visibility.Collapsed;
Image.Visibility = Visibility.Visible;
// Save.Visibility = Visibility.Visible;
SetImage(ChatMessage.Appdata);
} else {
Download.Visibility = Visibility.Visible;
string fileName = (ChatMessage.FileTransferInformation != null) ? ChatMessage.FileTransferInformation.Name : null;
bool isImageMessage = fileName != null && fileName.Length > 0;
if (isImageMessage) {
string filePath = ChatMessage.FileTransferFilepath;
ProgressBar.Visibility = Visibility.Collapsed;
if (ChatMessage.Appdata != null && ChatMessage.Appdata.Length > 0) {
Download.Visibility = Visibility.Collapsed;
Image.Visibility = Visibility.Visible;
// Save.Visibility = Visibility.Visible;
SetImage(ChatMessage.Appdata);
} else {
Download.Visibility = Visibility.Visible;
}
}
}
......
......@@ -110,10 +110,14 @@ namespace Linphone.Controls {
/// Displays the image in the bubble
/// </summary>
public void RefreshImage() {
string filePath = ChatMessage.FileTransferFilepath;
if (filePath != null && filePath.Length > 0) {
Image.Visibility = Visibility.Visible;
SetImage(ChatMessage.Appdata);
string fileName = (ChatMessage.FileTransferInformation != null) ? ChatMessage.FileTransferInformation.Name : null;
bool isImageMessage = fileName != null && fileName.Length > 0;
if (isImageMessage) {
string filePath = ChatMessage.FileTransferFilepath;
if (filePath != null && filePath.Length > 0) {
Image.Visibility = Visibility.Visible;
SetImage(ChatMessage.Appdata);
}
}
}
......
......@@ -73,12 +73,18 @@ namespace Linphone.Model {
public Visibility IsLastMessageImage {
get {
if (Messages.Last().FileTransferFilepath != null || Messages.Last().Appdata != null) {
if (Messages.Last().FileTransferFilepath != null || Messages.Last().Appdata != null ||
(Messages.Last().FileTransferInformation != null && Messages.Last().FileTransferInformation.Name != null)) {
return Visibility.Visible;
} else {
return Visibility.Collapsed;
}
}
}
public Visibility IsLastMessageText {
get {
return (IsLastMessageImage == Visibility.Visible) ? Visibility.Collapsed : Visibility.Visible;
}
}
......
......@@ -63,7 +63,7 @@ namespace Linphone.Views {
chatListenerInit();
MessageBox.SendFileClick += send_file;
MessageBox.SendMessageClick += send_message;
scrollToBottom();
SystemNavigationManager.GetForCurrentView().BackRequested += Back_requested;
}
......@@ -165,7 +165,6 @@ namespace Linphone.Views {
MessagesList.Children.Add(bubble);
}
}
scrollToBottom();
}
private void Bubble_ImageTapped(object sender, string appData) {
......@@ -453,7 +452,7 @@ namespace Linphone.Views {
private void scrollToBottom() {
MessagesScroll.UpdateLayout();
MessagesScroll.ChangeView(1, MessagesScroll.ScrollableHeight, 1);
MessagesScroll.ChangeView(1, MessagesScroll.ExtentHeight, 1);
}
public async void bubble_DownloadImage(object sender, ChatMessage message) {
......
......@@ -67,7 +67,8 @@
Style="{StaticResource ListItemStyle}"
Foreground="{Binding IsLastMessageUnread, Converter={StaticResource BoolToAccentBrushConverter}}"
MaxLines="2"
TextWrapping="Wrap"/>
TextWrapping="Wrap"
Visibility="{Binding IsLastMessageText}"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
......
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