From fbf3d97d57eaef293b77836fda0780828cd41909 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 29 May 2020 15:25:06 -0400 Subject: [PATCH] check app options ios extension on nfc check (#933) --- src/App/App.xaml.cs | 2 +- src/App/Models/AppOptions.cs | 2 +- src/iOS.Autofill/CredentialProviderViewController.cs | 4 ++-- src/iOS.Core/Services/DeviceActionService.cs | 8 ++++++-- src/iOS.Extension/LoadingViewController.cs | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index fb9482346..33b4bf85c 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -43,7 +43,7 @@ namespace Bit.App public App(AppOptions appOptions) { Options = appOptions ?? new AppOptions(); - if (Options.EmptyApp) + if (Options.IosExtension) { Current = this; return; diff --git a/src/App/Models/AppOptions.cs b/src/App/Models/AppOptions.cs index c772714b6..0d3e424a7 100644 --- a/src/App/Models/AppOptions.cs +++ b/src/App/Models/AppOptions.cs @@ -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; } } } diff --git a/src/iOS.Autofill/CredentialProviderViewController.cs b/src/iOS.Autofill/CredentialProviderViewController.cs index 353d00cf1..82400ef03 100644 --- a/src/iOS.Autofill/CredentialProviderViewController.cs +++ b/src/iOS.Autofill/CredentialProviderViewController.cs @@ -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) diff --git a/src/iOS.Core/Services/DeviceActionService.cs b/src/iOS.Core/Services/DeviceActionService.cs index 1fc87e758..3df138991 100644 --- a/src/iOS.Core/Services/DeviceActionService.cs +++ b/src/iOS.Core/Services/DeviceActionService.cs @@ -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 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); } diff --git a/src/iOS.Extension/LoadingViewController.cs b/src/iOS.Extension/LoadingViewController.cs index 53f01f164..1ac977de1 100644 --- a/src/iOS.Extension/LoadingViewController.cs +++ b/src/iOS.Extension/LoadingViewController.cs @@ -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)