check app options ios extension on nfc check (#933)

This commit is contained in:
Kyle Spearrin 2020-05-29 15:25:06 -04:00 committed by GitHub
parent 6da0f82ddd
commit fbf3d97d57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

View file

@ -43,7 +43,7 @@ namespace Bit.App
public App(AppOptions appOptions)
{
Options = appOptions ?? new AppOptions();
if (Options.EmptyApp)
if (Options.IosExtension)
{
Current = this;
return;

View file

@ -18,6 +18,6 @@ namespace Bit.App.Models
public string SaveCardExpMonth { get; set; }
public string SaveCardExpYear { get; set; }
public string SaveCardCode { get; set; }
public bool EmptyApp { get; set; }
public bool IosExtension { get; set; }
}
}

View file

@ -291,7 +291,7 @@ namespace Bit.iOS.Autofill
private void LaunchLoginFlow()
{
var loginPage = new LoginPage();
var app = new App.App(new AppOptions { EmptyApp = true });
var app = new App.App(new AppOptions { IosExtension = true });
ThemeManager.SetTheme(false, app.Resources);
ThemeManager.ApplyResourcesToPage(loginPage);
if (loginPage.BindingContext is LoginPageViewModel vm)
@ -311,7 +311,7 @@ namespace Bit.iOS.Autofill
private void LaunchTwoFactorFlow()
{
var twoFactorPage = new TwoFactorPage();
var app = new App.App(new AppOptions { EmptyApp = true });
var app = new App.App(new AppOptions { IosExtension = true });
ThemeManager.SetTheme(false, app.Resources);
ThemeManager.ApplyResourcesToPage(twoFactorPage);
if (twoFactorPage.BindingContext is TwoFactorPageViewModel vm)

View file

@ -295,7 +295,11 @@ namespace Bit.iOS.Core.Services
public bool SupportsNfc()
{
return CoreNFC.NFCNdefReaderSession.ReadingAvailable;
if(Application.Current is App.App currentApp && !currentApp.Options.IosExtension)
{
return CoreNFC.NFCNdefReaderSession.ReadingAvailable;
}
return false;
}
public bool SupportsCamera()
@ -350,7 +354,7 @@ namespace Bit.iOS.Core.Services
public Task<string> DisplayActionSheetAsync(string title, string cancel, string destruction,
params string[] buttons)
{
if (Application.Current is App.App app && app.Options != null && !app.Options.EmptyApp)
if (Application.Current is App.App app && app.Options != null && !app.Options.IosExtension)
{
return app.MainPage.DisplayActionSheet(title, cancel, destruction, buttons);
}

View file

@ -423,7 +423,7 @@ namespace Bit.iOS.Extension
private void LaunchLoginFlow()
{
var loginPage = new LoginPage();
var app = new App.App(new AppOptions { EmptyApp = true });
var app = new App.App(new AppOptions { IosExtension = true });
ThemeManager.SetTheme(false, app.Resources);
ThemeManager.ApplyResourcesToPage(loginPage);
if (loginPage.BindingContext is LoginPageViewModel vm)
@ -443,7 +443,7 @@ namespace Bit.iOS.Extension
private void LaunchTwoFactorFlow()
{
var twoFactorPage = new TwoFactorPage();
var app = new App.App(new AppOptions { EmptyApp = true });
var app = new App.App(new AppOptions { IosExtension = true });
ThemeManager.SetTheme(false, app.Resources);
ThemeManager.ApplyResourcesToPage(twoFactorPage);
if (twoFactorPage.BindingContext is TwoFactorPageViewModel vm)