2017-02-10 02:12:34 +03:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Acr.UserDialogs;
|
|
|
|
|
using Bit.App.Controls;
|
|
|
|
|
using Bit.App.Resources;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using XLabs.Ioc;
|
2017-11-22 07:08:45 +03:00
|
|
|
|
using Bit.App.Abstractions;
|
2017-02-10 02:12:34 +03:00
|
|
|
|
|
|
|
|
|
namespace Bit.App.Pages
|
|
|
|
|
{
|
|
|
|
|
public class BaseLockPage : ExtendedContentPage
|
|
|
|
|
{
|
2017-11-22 07:08:45 +03:00
|
|
|
|
private readonly IDeviceActionService _deviceActionService;
|
|
|
|
|
|
2017-02-10 02:12:34 +03:00
|
|
|
|
public BaseLockPage()
|
|
|
|
|
: base(false, false)
|
|
|
|
|
{
|
|
|
|
|
UserDialogs = Resolver.Resolve<IUserDialogs>();
|
2017-11-22 07:08:45 +03:00
|
|
|
|
AuthService = Resolver.Resolve<IAuthService>();
|
|
|
|
|
_deviceActionService = Resolver.Resolve<IDeviceActionService>();
|
2017-02-10 02:12:34 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected IUserDialogs UserDialogs { get; set; }
|
2017-11-22 07:08:45 +03:00
|
|
|
|
protected IAuthService AuthService { get; set; }
|
2017-02-10 02:12:34 +03:00
|
|
|
|
|
|
|
|
|
protected override bool OnBackButtonPressed()
|
|
|
|
|
{
|
2017-11-22 07:08:45 +03:00
|
|
|
|
_deviceActionService.Background();
|
2017-02-10 02:12:34 +03:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected async Task LogoutAsync()
|
|
|
|
|
{
|
|
|
|
|
if(!await UserDialogs.ConfirmAsync(AppResources.LogoutConfirmation, null, AppResources.Yes, AppResources.Cancel))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-11-22 07:08:45 +03:00
|
|
|
|
AuthService.LogOut();
|
2017-02-10 02:12:34 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|