Skip to content

Commit

Permalink
Add an explanation when creating a poll
Browse files Browse the repository at this point in the history
  • Loading branch information
FrayxRulez committed Apr 24, 2020
1 parent 12ef993 commit 87725ee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Unigram/Unigram/Controls/Views/CreatePollView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,16 @@
Style="{StaticResource CheckButtonStyle}"
Toggled="Quiz_Toggled"/>
</controls:HeaderedControl>

<controls:HeaderedControl
x:Name="QuizSettings"
Header="{CustomResource AddAnExplanation}"
Footer="{CustomResource AddAnExplanationInfo}"
Visibility="Collapsed">
<controls:FormattedTextBox
x:Name="QuizExplanation"
PlaceholderText="{CustomResource AddAnExplanation}"
Margin="12,8,12,8"/>
</controls:HeaderedControl>
</StackPanel>
</controls:TLContentDialog>
4 changes: 3 additions & 1 deletion Unigram/Unigram/Controls/Views/CreatePollView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Telegram.Td;
using Telegram.Td.Api;
using Template10.Mvvm;
using Unigram.Common;
Expand Down Expand Up @@ -91,7 +92,7 @@ public PollType Type
{
if (Quiz.IsOn)
{
return new PollTypeQuiz(Items.IndexOf(Items.FirstOrDefault(x => x.IsChecked)));
return new PollTypeQuiz(Items.IndexOf(Items.FirstOrDefault(x => x.IsChecked)), QuizExplanation.GetFormattedText());
}

return new PollTypeRegular(Multiple.IsOn);
Expand Down Expand Up @@ -224,6 +225,7 @@ private void Multiple_Toggled(object sender, RoutedEventArgs e)
private void Quiz_Toggled(object sender, RoutedEventArgs e)
{
Multiple.IsEnabled = !Quiz.IsOn;
QuizSettings.Visibility = Quiz.IsOn ? Visibility.Visible : Visibility.Collapsed;

if (Quiz.IsOn)
{
Expand Down
2 changes: 1 addition & 1 deletion Unigram/Unigram/ViewModels/DialogViewModel.Media.cs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ private async Task SendPollAsync(bool forceQuiz, bool forceRegular, bool forceAn
}

var reply = GetReply(true);
var input = new InputMessagePoll(dialog.Question, dialog.Options, dialog.IsAnonymous, dialog.Type, false);
var input = new InputMessagePoll(dialog.Question, dialog.Options, dialog.IsAnonymous, dialog.Type, 0, 0, false);

await SendMessageAsync(reply, input, options);
}
Expand Down

0 comments on commit 87725ee

Please sign in to comment.