Skip to content

Commit cd5059d

Browse files
committed
Properly fetch device name from view
1 parent a8110a8 commit cd5059d

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Signal-Windows/ViewModels/LinkPageViewModel.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ public class LinkPageViewModel : ViewModelBase
2323
public LinkPage View;
2424
private CancellationTokenSource CancelSource;
2525
private bool UIEnabled = true;
26-
27-
public string DeviceName { get; set; } = "Signal on Windows";
28-
2926
private Visibility _QRVisible;
3027

3128
public Visibility QRVisible
@@ -70,7 +67,6 @@ public async Task BeginLinking()
7067
{
7168
try
7269
{
73-
Debug.WriteLine(SynchronizationContext.Current);
7470
CancelSource = new CancellationTokenSource();
7571
// clean the database from stale values
7672
await Task.Run(() =>
@@ -98,7 +94,7 @@ await Task.Run(() =>
9894
int registrationId = (int)KeyHelper.generateRegistrationId(false);
9995

10096
var provisionMessage = await accountManager.GetProvisioningMessage(CancelSource.Token, tmpIdentity);
101-
int deviceId = await accountManager.FinishNewDeviceRegistration(CancelSource.Token, provisionMessage, tmpSignalingKey, password, false, true, registrationId, DeviceName);
97+
int deviceId = await accountManager.FinishNewDeviceRegistration(CancelSource.Token, provisionMessage, tmpSignalingKey, password, false, true, registrationId, View.GetDeviceName());
10298
SignalStore store = new SignalStore()
10399
{
104100
DeviceId = (uint)deviceId,

Signal-Windows/Views/LinkPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<Image Grid.Row="0" x:Name="QRCode" Stretch="Fill" Visibility="{x:Bind Vm.QRVisible, Mode=OneWay}" Width="250" Height="250" Margin="20 20 20 20" />
3636
<TextBlock Grid.Row="1" Foreground="White" TextWrapping="WrapWholeWords" Text="Open Signal on your phone and navigate to Settings > Linked devices. Tap the button to add a new device, then scan the code above." HorizontalAlignment="Center" Margin="20 20 20 20"></TextBlock>
3737
<TextBlock Grid.Row="2" Foreground="White" TextWrapping="WrapWholeWords" HorizontalAlignment="Center">This device's name will be</TextBlock>
38-
<TextBox Grid.Row="3" Name="DeviceName" Text="{x:Bind Vm.DeviceName, Mode=TwoWay}" Margin="20 20 20 20" Width="240" HorizontalAlignment="Center" />
38+
<TextBox Grid.Row="3" Name="DeviceName" Text="Signal on Windows" Margin="20 20 20 20" Width="240" HorizontalAlignment="Center" />
3939
<TextBlock Grid.Row="4" Foreground="White" Text="{x:Bind Vm.QRCodeString, Mode=OneWay}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Bottom" IsTextSelectionEnabled="True" Margin="20 20 20 20" />
4040
</Grid>
4141
</Grid>

Signal-Windows/Views/LinkPage.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public void SetQR(string qr)
5454
QRCode.Source = writer.Write(qr);
5555
}
5656

57+
public string GetDeviceName()
58+
{
59+
return DeviceName.Text;
60+
}
61+
5762
public async Task Finish(bool success)
5863
{
5964
if (success)

0 commit comments

Comments
 (0)