Skip to content

Commit 7a3136e

Browse files
committed
Display unread count in conversation list
1 parent 40dac2d commit 7a3136e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

Signal-Windows/Controls/ConversationListElement.xaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:local="using:Signal_Windows.Controls"
6+
xmlns:model="using:Signal_Windows.Models"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
89
mc:Ignorable="d"
@@ -26,7 +27,17 @@
2627
<TextBlock Grid.Column="0" Name="ConversationDisplayName" FontSize="15" FontWeight="SemiLight" Text="{x:Bind Model.ThreadDisplayName, Mode=OneWay}" TextTrimming="CharacterEllipsis"/>
2728
<TextBlock x:Name="LastActiveTextBlock" Grid.Column="1" Text="{x:Bind LastMessageTimestamp, Mode=OneWay}" FontSize="11" Foreground="#999999" TextTrimming="CharacterEllipsis"/>
2829
</Grid>
29-
<TextBlock Text="{x:Bind LastMessage, Mode=OneWay}" FontSize="12"/>
30+
<Grid>
31+
<Grid.ColumnDefinitions>
32+
<ColumnDefinition Width="*"/>
33+
<ColumnDefinition Width="Auto"/>
34+
</Grid.ColumnDefinitions>
35+
<TextBlock Grid.Column="0" Text="{x:Bind LastMessage, Mode=OneWay}" FontSize="12"/>
36+
<Grid Grid.Column="1" Width="20" Height="20" Margin="10 0 0 0">
37+
<Ellipse Fill="#2190EA" Visibility="{x:Bind UnreadStringVisibility, Mode=TwoWay}"/>
38+
<TextBlock Text="{x:Bind UnreadString, Mode=TwoWay}" FontWeight="Bold" FontSize="12" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
39+
</Grid>
40+
</Grid>
3041
</StackPanel>
3142
</Grid>
3243
</UserControl>

Signal-Windows/Controls/ConversationListElement.xaml.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ public uint UnreadCount
4242
{
4343
_UnreadCount = value;
4444
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UnreadString)));
45+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UnreadStringVisibility)));
46+
}
47+
}
48+
49+
public Visibility UnreadStringVisibility
50+
{
51+
get
52+
{
53+
if (UnreadCount > 0)
54+
{
55+
return Visibility.Visible;
56+
}
57+
else
58+
{
59+
return Visibility.Collapsed;
60+
}
61+
}
62+
set
63+
{
64+
// we never set this
4565
}
4666
}
4767

@@ -58,6 +78,10 @@ public string UnreadString
5878
return "";
5979
}
6080
}
81+
set
82+
{
83+
// we never set this
84+
}
6185
}
6286

6387
private string _LastMessage = "@";

0 commit comments

Comments
 (0)