Skip to content

Commit ad8bea4

Browse files
committed
Don't put + in country code text box
1 parent d5deb66 commit ad8bea4

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

Signal-Windows/ViewModels/RegisterPageViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public void RegisterButton_Click()
6666
try
6767
{
6868
string number = PhoneNumberFormatter.FormatE164(PhonePrefix, PhoneSuffix);
69+
if (!number.StartsWith("+"))
70+
{
71+
number = $"+{number}";
72+
}
6973
if(number != null && number.Length > 0 && number[0] == '+')
7074
{
7175
FinalNumber = number;
@@ -106,7 +110,7 @@ private void BackButton_Click(object sender, BackRequestedEventArgs e)
106110
public void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
107111
{
108112
int index = (sender as ComboBox).SelectedIndex;
109-
PhonePrefix = Utils.GetCountryCode(CountryArrays.Abbreviations[index]);
113+
PhonePrefix = Utils.GetCountryCode(CountryArrays.Abbreviations[index]).Replace("+", string.Empty);
110114
}
111115
}
112116
}

Signal-Windows/Views/RegisterPage.xaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,22 @@
4242
</Grid.RowDefinitions>
4343
<TextBlock x:Name="TitleTextBlock" Grid.Row="0" Foreground="White" FontSize="34" HorizontalAlignment="Center" Text="Connect with Signal" FontWeight="Light" VerticalAlignment="Center"/>
4444
<StackPanel Grid.Row="1">
45-
<ComboBox HorizontalAlignment="Center" Width="300" ItemsSource="{x:Bind Vm.CountriesList}" SelectionChanged="ComboBox_SelectionChanged" x:Name="CountriesList" VerticalAlignment="Stretch" d:LayoutOverrides="TopPosition, BottomPosition" PlaceholderText="Select your country"/>
46-
<Grid Width="300" Margin="0,18,0,0">
47-
<Grid.ColumnDefinitions>
48-
<ColumnDefinition Width="Auto"/>
49-
<ColumnDefinition Width="48"/>
50-
<ColumnDefinition Width="10"/>
51-
<ColumnDefinition Width="*"/>
52-
</Grid.ColumnDefinitions>
53-
<TextBlock Grid.Column="0" Text="+" Foreground="White" FontSize="20"/>
54-
<TextBox Grid.Column="1" Text="{x:Bind Vm.PhonePrefix, Mode=TwoWay}" MinWidth="32"/>
55-
<TextBox Grid.Column="3" Text="{x:Bind Vm.PhoneSuffix, Mode=TwoWay}" PlaceholderText="Phone number"/>
56-
</Grid>
45+
<StackPanel Width="300">
46+
<ComboBox HorizontalAlignment="Stretch" ItemsSource="{x:Bind Vm.CountriesList}" SelectionChanged="ComboBox_SelectionChanged" x:Name="CountriesList" VerticalAlignment="Stretch" d:LayoutOverrides="TopPosition, BottomPosition" PlaceholderText="Select your country"/>
47+
<Grid Margin="0,18,0,0">
48+
<Grid.ColumnDefinitions>
49+
<ColumnDefinition Width="Auto"/>
50+
<ColumnDefinition Width="100"/>
51+
<ColumnDefinition Width="10"/>
52+
<ColumnDefinition Width="*"/>
53+
</Grid.ColumnDefinitions>
54+
<TextBlock Grid.Column="0" Text="+" Foreground="White" FontSize="20"/>
55+
<TextBox Grid.Column="1" Text="{x:Bind Vm.PhonePrefix, Mode=TwoWay}" MinWidth="32"/>
56+
<TextBox Grid.Column="3" Text="{x:Bind Vm.PhoneSuffix, Mode=TwoWay}" PlaceholderText="Phone number"/>
57+
</Grid>
58+
</StackPanel>
5759
<TextBlock x:Name="VerifyTextBlock" Text="Verify your phone number to connect with Signal." FontSize="20" Foreground="White" HorizontalAlignment="Center" Margin="0,16,0,0" TextAlignment="Center" TextWrapping="Wrap"/>
58-
<Button x:Name="RegisterButton" Background="White" Foreground="#2190EA" HorizontalAlignment="Center" Width="300" Content="Register" Click="RegisterButton_Click" Margin="0,16,0,0"/>
60+
<Button x:Name="RegisterButton" Background="White" Foreground="#2190EA" HorizontalAlignment="Center" Content="Register" Click="RegisterButton_Click" Margin="0,16,0,0" Width="256"/>
5961
</StackPanel>
6062
</Grid>
6163
</Page>

0 commit comments

Comments
 (0)