Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added save icon to attachments that are not of type image #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Signal-Windows/Controls/Attachment.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
</Image.Source>
</Image>
<SymbolIcon Name="AttachmentDownloadIcon" Symbol="Download" Tapped="AttachmentDownloadIcon_Tapped" />
<SymbolIcon Name="AttachmentSaveIcon" Symbol="Save"
Visibility="Collapsed" Tapped="AttachmentSaveIcon_Tapped" />
</Grid>
</StackPanel>
</UserControl>
10 changes: 10 additions & 0 deletions Signal-Windows/Controls/Attachment.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ private void Attachment_DataContextChanged(FrameworkElement sender, DataContextC
AttachmentDownloadIcon.Visibility = Visibility.Collapsed;
if (IMAGE_TYPES.Contains(Model.ContentType))
{
AttachmentSaveIcon.Visibility = Visibility.Collapsed;
var path = ApplicationData.Current.LocalCacheFolder.Path + @"\Attachments\" + Model.Id + ".plain";
ImagePath = new Uri(path);
}
else
{
AttachmentSaveIcon.Visibility = Visibility.Visible;
}
}
else if (Model.Status == SignalAttachmentStatus.Default || Model.Status == SignalAttachmentStatus.Finished || Model.Status == SignalAttachmentStatus.Failed)
{
AttachmentImage.Visibility = Visibility.Collapsed;
AttachmentDownloadIcon.Visibility = Visibility.Visible;
AttachmentSaveIcon.Visibility = Visibility.Collapsed;
}
}
}
Expand All @@ -87,6 +93,10 @@ private void AttachmentDownloadIcon_Tapped(object sender, TappedRoutedEventArgs
{
App.Handle.StartAttachmentDownload(Model);
}
private async void AttachmentSaveIcon_Tapped(object sender, TappedRoutedEventArgs e)
{
await App.Handle.ExportAttachment(Model);
}

private void AttachmentImage_Tapped(object sender, TappedRoutedEventArgs e)
{
Expand Down