From 57e9c54694a07bcc0a8fb6b1d23a3fe0c9934195 Mon Sep 17 00:00:00 2001 From: Fela Ameghino Date: Wed, 28 Jun 2017 12:29:43 +0200 Subject: [PATCH] Fixed navigation --- Unigram/Unigram/App.xaml.cs | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Unigram/Unigram/App.xaml.cs b/Unigram/Unigram/App.xaml.cs index 19a11ce42d..7af3a03487 100644 --- a/Unigram/Unigram/App.xaml.cs +++ b/Unigram/Unigram/App.xaml.cs @@ -45,6 +45,7 @@ using Telegram.Api.Aggregator; using Unigram.Controls; using Unigram.Views.Users; +using System.Linq; namespace Unigram { @@ -264,29 +265,36 @@ public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs if (store != null && annotationStore != null) { var full = await store.GetContactAsync(contact.Contact.Id); + if (full == null) + { + goto Navigate; + } + var annotations = await annotationStore.FindAnnotationsForContactAsync(full); + var first = annotations.FirstOrDefault(); - if (first != null) + if (first == null) { - var remote = first.RemoteId; - if (int.TryParse(remote.Substring(1), out int userId)) - { - NavigationService.Navigate(typeof(DialogPage), new TLPeerUser { UserId = userId }); - } - else - { - NavigationService.Navigate(typeof(MainPage)); - } + goto Navigate; + } + + var remote = first.RemoteId; + if (int.TryParse(remote.Substring(1), out int userId)) + { + NavigationService.Navigate(typeof(DialogPage), new TLPeerUser { UserId = userId }); } else { - NavigationService.Navigate(typeof(MainPage)); + goto Navigate; } } else { NavigationService.Navigate(typeof(MainPage)); } + + Navigate: + NavigationService.Navigate(typeof(MainPage)); } else if (args is ProtocolActivatedEventArgs protocol) {