Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
- Made the send button round
- Reduced the chat bubble corner radius
- Added SMS sound to notifications
- Hopefully fixed messaging stock app crash
- Added placeholder text for the cellular line dropdown
- App auto opens the first chat
- Sent messages are now slightly darker/lighter depending on the theme
  • Loading branch information
gus33000 committed Aug 4, 2019
1 parent 195b2eb commit 45f5ea8
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 32 deletions.
9 changes: 7 additions & 2 deletions Chat.BackgroundTasks/SmsBackgroundTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Windows.UI.Notifications;
using System.Threading.Tasks;
using Chat.Common;
using System;

namespace Chat.BackgroundTasks
{
Expand All @@ -21,7 +22,7 @@ private async Task DisplayToast(IBackgroundTaskInstance taskInstance)
SmsMessageReceivedTriggerDetails smsDetails = taskInstance.TriggerDetails as SmsMessageReceivedTriggerDetails;
SmsTextMessage2 smsTextMessage;

string deviceid = "";
string deviceid = "";

if (smsDetails.MessageType == SmsMessageType.Text)
{
Expand Down Expand Up @@ -78,7 +79,11 @@ private async Task DisplayToast(IBackgroundTaskInstance taskInstance)
}
}
},
Launch = "action=openThread" + "&from=" + smsTextMessage.From + "&deviceid=" + deviceid
Launch = "action=openThread" + "&from=" + smsTextMessage.From + "&deviceid=" + deviceid,
Audio = new ToastAudio()
{
Src = new Uri("ms-winsoundevent:Notification.SMS")
}
};

var toastNotif = new ToastNotification(toastContent.GetXml());
Expand Down
2 changes: 0 additions & 2 deletions Chat.Common/SmsUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ public async static Task<bool> SendTextMessageAsync(SmsDevice2 device, string[]

msg.Body = textmessage;
msg.From = number;
msg.IsRead = true;
msg.IsSeen = true;

msg.LocalTimestamp = offset;
msg.NetworkTimestamp = offset;
Expand Down
8 changes: 4 additions & 4 deletions Controls/ChatMenuItemControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@
<PersonPicture Grid.Row="0" x:Name="PeoplePic"
Grid.RowSpan="2"
Grid.Column="0"
Height="48"
Width="48"
VerticalAlignment="Top"
Margin="0,0,12,0"/>
Height="24"
Width="24"
VerticalAlignment="Center"
Margin="-6,0,12,0"/>

<!-- Name -->
<TextBlock Grid.Row="0" x:Name="ChatName"
Expand Down
18 changes: 11 additions & 7 deletions Controls/ChatMessageViewControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
d:DesignWidth="500">

<StackPanel Margin="8">
<Grid Padding="8" x:Name="ChatBubble" CornerRadius="15" MinWidth="50" Background="{ThemeResource SystemAccentColor}" MaxWidth="400" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid x:Name="ChatBubble" CornerRadius="8" MinWidth="100" MaxWidth="400" HorizontalAlignment="Left">
<Grid x:Name="BgColor" Background="{ThemeResource SystemAccentColor}"/>

<TextBlock Text="{x:Bind message.Body}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" Style="{ThemeResource FluentBodyTextStyle}" />
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Right" Grid.Row="1" TextTrimming="CharacterEllipsis" MaxLines="1" Text="{x:Bind message.LocalTimestamp.LocalDateTime}" Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" Style="{ThemeResource FluentCaptionTextStyle}" />
<Grid Padding="8">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<TextBlock Text="{x:Bind message.Body}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" Style="{ThemeResource FluentBodyTextStyle}" />
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Right" Grid.Row="1" TextTrimming="CharacterEllipsis" MaxLines="1" Text="{x:Bind message.LocalTimestamp.LocalDateTime}" Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" Style="{ThemeResource FluentCaptionTextStyle}" />
</Grid>
</Grid>
</StackPanel>
</UserControl>
3 changes: 3 additions & 0 deletions Controls/ChatMessageViewControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public ChatMessageViewControl(ChatMessage message)
this.InitializeComponent();
this.message = message;
if (!message.IsIncoming)
{
ChatBubble.HorizontalAlignment = HorizontalAlignment.Right;
BgColor.Opacity = 0.75;
}
}
}
}
2 changes: 1 addition & 1 deletion Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity
Name="LumiaWOA.Chat"
Publisher="CN=LumiaWOA"
Version="0.0.37.0" />
Version="0.0.39.0" />

<mp:PhoneIdentity PhoneProductId="d8719107-e9ed-450f-be3e-88003464d950" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
10 changes: 7 additions & 3 deletions Pages/ComposePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@
</Grid.RowDefinitions>

<ComboBox x:Name="CellularLineComboBox"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Margin="0,4,0,8"
SelectionChanged="CellularLineComboBox_SelectionChanged"
Style="{ThemeResource FluentComboBoxStyle}"
SelectedIndex="0"
BorderBrush="Transparent"
Background="Transparent"
PlaceholderText="No cellular device"
BorderThickness="0"/>

<Grid Grid.Row="1">
Expand Down Expand Up @@ -288,16 +290,18 @@

<Button x:Name="SendButton"
Grid.Column="2"
Height="48"
Width="48"
Height="38"
Width="38"
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
Style="{ThemeResource FluentDialogButtonBackStyle}"
VerticalAlignment="Bottom"
VerticalAlignment="Center"
Margin="0,0,4,0"
Click="SendButton_Click"
FontFamily="Segoe MDL2 Assets"
Content="&#xE724;"
BorderBrush="Transparent"
BorderThickness="0"
CornerRadius="45"
IsEnabled="False" />
</Grid>
</toolkit:DropShadowPanel>
Expand Down
12 changes: 8 additions & 4 deletions Pages/ConversationPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
Grid.Column="1"
Style="{ThemeResource FluentTitleTextStyle}"
VerticalAlignment="Center"
Text="Title"
/>


Expand All @@ -205,13 +206,14 @@
<ComboBox x:Name="CellularLineComboBox"
Grid.Column="3"
VerticalAlignment="Center"
HorizontalAlignment="Right"
HorizontalAlignment="Stretch"
Margin="0,4,0,8"
SelectionChanged="CellularLineComboBox_SelectionChanged"
Style="{ThemeResource FluentComboBoxStyle}"
SelectedIndex="0"
BorderBrush="Transparent"
Background="Transparent"
PlaceholderText="No cellular device"
BorderThickness="0"/>
</Grid>
</toolkit:DropShadowPanel>
Expand Down Expand Up @@ -321,16 +323,18 @@

<Button x:Name="SendButton"
Grid.Column="2"
Height="48"
Width="48"
Height="38"
Width="38"
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
Style="{ThemeResource FluentDialogButtonBackStyle}"
VerticalAlignment="Bottom"
VerticalAlignment="Center"
Margin="0,0,4,0"
Click="SendButton_Click"
FontFamily="Segoe MDL2 Assets"
Content="&#xE724;"
BorderBrush="Transparent"
BorderThickness="0"
CornerRadius="45"
IsEnabled="False" />
</Grid>
</toolkit:DropShadowPanel>
Expand Down
18 changes: 9 additions & 9 deletions Shell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
<ResourceDictionary x:Key="Default">
<AcrylicBrush x:Key="NavigationViewDefaultPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="{StaticResource SystemChromeAltHighColor}"
TintColor="{StaticResource SystemChromeMediumLowColor}"
TintOpacity="0.7"
FallbackColor="{StaticResource SystemChromeAltHighColor}" />
FallbackColor="{StaticResource SystemChromeMediumLowColor}" />
<AcrylicBrush x:Key="NavigationViewTopPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="{StaticResource SystemChromeAltHighColor}"
TintColor="{StaticResource SystemChromeMediumLowColor}"
TintOpacity="0.7"
FallbackColor="{StaticResource SystemChromeAltHighColor}" />
FallbackColor="{StaticResource SystemChromeMediumLowColor}" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="{StaticResource SystemChromeAltHighColor}"
TintColor="{StaticResource SystemChromeMediumLowColor}"
TintOpacity="0.7"
FallbackColor="{StaticResource SystemChromeAltHighColor}" />
FallbackColor="{StaticResource SystemChromeMediumLowColor}" />

<x:Double x:Key="NavigationViewTopPaneHeight">80</x:Double>
<x:Double x:Key="NavigationViewPaneHeaderRowMinHeight">80</x:Double>
Expand Down Expand Up @@ -417,7 +417,7 @@
</UserControl.Resources>

<Grid>
<NavigationView x:Name="NavigationView" IsSettingsVisible="False" AlwaysShowHeader="True" OpenPaneLength="380" SelectionChanged="NavigationView_SelectionChanged">
<NavigationView IsBackButtonVisible="Collapsed" PaneClosing="NavigationView_PaneClosing" PaneOpening="NavigationView_PaneOpening" x:Name="NavigationView" IsSettingsVisible="False" AlwaysShowHeader="True" OpenPaneLength="380" SelectionChanged="NavigationView_SelectionChanged">
<NavigationView.AutoSuggestBox>
<AutoSuggestBox Margin="6,16,0,0" Height="48" VerticalAlignment="Center" QueryIcon="Find" PlaceholderText="Find a conversation" Style="{StaticResource AutoSuggestBoxStyle1}"/>
</NavigationView.AutoSuggestBox>
Expand All @@ -443,8 +443,8 @@
<toolkit:DropShadowPanel ShadowOpacity="0.7" HorizontalContentAlignment="Stretch">
<Grid Background="{ThemeResource SystemControlAcrylicWindowBrush}">
<Frame x:Name="MainFrame"/>
<Grid Margin="0,-32,0,0" x:Name="TitlebarNarrowBackground" VerticalAlignment="Top" Height="{x:Bind Titlebar.Height, Mode=OneWay}" Visibility="Visible" Grid.ColumnSpan="2">
<Rectangle VerticalAlignment="Top" Height="{x:Bind Titlebar.Height, Mode=OneWay}" Fill="{ThemeResource SystemControlAcrylicWindowBrush}"/>
<Grid Margin="0,-32,0,0" x:Name="TitlebarNarrowBackground" VerticalAlignment="Top" Height="32" Visibility="Visible" Grid.ColumnSpan="2">
<Rectangle VerticalAlignment="Stretch" Fill="{ThemeResource SystemControlAcrylicWindowBrush}"/>
</Grid>
</Grid>
</toolkit:DropShadowPanel>
Expand Down
17 changes: 17 additions & 0 deletions Shell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ private async void Load()
var reader = store.GetConversationReader();
var convos = await reader.ReadBatchAsync();

bool initializedonce = false;

foreach (var convo in convos)
{
NavigationView.MenuItems.Add(new ChatMenuItemControl(convo));

if (!initializedonce)
NavigationView.SelectedItem = NavigationView.MenuItems[0];

initializedonce = true;
}
}

Expand Down Expand Up @@ -68,5 +75,15 @@ private void NavigationView_SelectionChanged(NavigationView sender, NavigationVi
if (args.SelectedItem != null)
MainFrame.Navigate(typeof(ConversationPage), (args.SelectedItem as ChatMenuItemControl).ChatConversation);
}

private void NavigationView_PaneClosing(NavigationView sender, NavigationViewPaneClosingEventArgs args)
{

}

private void NavigationView_PaneOpening(NavigationView sender, object args)
{

}
}
}

0 comments on commit 45f5ea8

Please sign in to comment.