Skip to content

Commit

Permalink
Working on settings search
Browse files Browse the repository at this point in the history
  • Loading branch information
FrayxRulez committed Mar 13, 2019
1 parent 1b781e9 commit a1e5fec
Show file tree
Hide file tree
Showing 8 changed files with 436 additions and 10 deletions.
8 changes: 8 additions & 0 deletions Unigram/Unigram/Common/NavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ public static void NavigateToMain(this INavigationService service, string parame
service.Navigate(typeof(MainPage));
}

public static void NavigateToPasscode(this INavigationService service)
{
if (service is TLNavigationService serviceEx)
{
serviceEx.NavigateToPasscode();
}
}

#region Payments

public static void NavigateToPaymentFormStep1(this INavigationService service, MessageViewModel message, PaymentForm paymentForm)
Expand Down
23 changes: 23 additions & 0 deletions Unigram/Unigram/Common/TLNavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
using Template10.Services.NavigationService;
using Template10.Services.ViewService;
using Unigram.Controls;
using Unigram.Controls.Views;
using Unigram.Services;
using Unigram.Views;
using Unigram.Views.Settings;
using Windows.ApplicationModel.DataTransfer;
using Windows.System;
using Windows.UI.Core;
Expand All @@ -19,13 +21,15 @@ namespace Unigram.Common
public class TLNavigationService : NavigationService
{
private readonly IProtoService _protoService;
private readonly IPasscodeService _passcodeService;

private ViewLifetimeControl _instantLifetime;

public TLNavigationService(IProtoService protoService, Frame frame, int session, string id)
: base(frame, session, id)
{
_protoService = protoService;
_passcodeService = TLContainer.Current.Passcode;
}

public int SessionId => _protoService.SessionId;
Expand Down Expand Up @@ -160,5 +164,24 @@ public async void NavigateToChat(long chatId, long? message = null, string acces

NavigateToChat(chat, message, accessToken, state);
}

public async void NavigateToPasscode()
{
if (_passcodeService.IsEnabled)
{
var dialog = new SettingsPasscodeConfirmView(_passcodeService);
dialog.IsSimple = _passcodeService.IsSimple;

var confirm = await dialog.ShowAsync();
if (confirm == ContentDialogResult.Primary)
{
Navigate(typeof(SettingsPasscodePage));
}
}
else
{
Navigate(typeof(SettingsPasscodePage));
}
}
}
}
Loading

0 comments on commit a1e5fec

Please sign in to comment.