mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-24 11:55:38 +01:00
config flow
This commit is contained in:
parent
471871eb2e
commit
eee96bf8cf
@ -143,16 +143,48 @@ namespace Bit.iOS.Autofill
|
||||
|
||||
public override void PrepareInterfaceForExtensionConfiguration()
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("AUTOFILL BITWARDEN: PrepareInterfaceForExtensionConfiguration");
|
||||
_context.Configuring = true;
|
||||
|
||||
var authService = Resolver.Resolve<IAuthService>();
|
||||
if(authService.IsAuthenticated)
|
||||
if (!authService.IsAuthenticated)
|
||||
{
|
||||
var task = ASHelpers.ReplaceAllIdentities(Resolver.Resolve<ICipherService>());
|
||||
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
|
||||
{
|
||||
ExtensionContext.CompleteExtensionConfigurationRequest();
|
||||
});
|
||||
PresentViewController(alert, true, null);
|
||||
return;
|
||||
}
|
||||
|
||||
var lockService = Resolver.Resolve<ILockService>();
|
||||
var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult();
|
||||
switch (lockType)
|
||||
{
|
||||
case App.Enums.LockType.Fingerprint:
|
||||
PerformSegue("lockFingerprintSegue", this);
|
||||
break;
|
||||
case App.Enums.LockType.PIN:
|
||||
PerformSegue("lockPinSegue", this);
|
||||
break;
|
||||
case App.Enums.LockType.Password:
|
||||
PerformSegue("lockPasswordSegue", this);
|
||||
break;
|
||||
default:
|
||||
var task = ASHelpers.ReplaceAllIdentities(Resolver.Resolve<ICipherService>());
|
||||
ExtensionContext.CompleteExtensionConfigurationRequest();
|
||||
break;
|
||||
}
|
||||
ExtensionContext.CompleteExtensionConfigurationRequest();
|
||||
}
|
||||
|
||||
public void CompleteRequest(string username = null, string password = null, string totp = null)
|
||||
{
|
||||
if(_context.Configuring)
|
||||
{
|
||||
ExtensionContext.CompleteExtensionConfigurationRequest();
|
||||
return;
|
||||
}
|
||||
|
||||
if(string.IsNullOrWhiteSpace(username) && string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
_googleAnalyticsService.TrackAutofillExtensionEvent("Canceled");
|
||||
@ -223,6 +255,12 @@ namespace Bit.iOS.Autofill
|
||||
ProvideCredential();
|
||||
return;
|
||||
}
|
||||
if(_context.Configuring)
|
||||
{
|
||||
var task = ASHelpers.ReplaceAllIdentities(Resolver.Resolve<ICipherService>());
|
||||
ExtensionContext.CompleteExtensionConfigurationRequest();
|
||||
return;
|
||||
}
|
||||
PerformSegue("loginListSegue", this);
|
||||
});
|
||||
}
|
||||
|
@ -22,8 +22,11 @@
|
||||
<string>MainInterface</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.authentication-services-credential-provider-ui</string>
|
||||
<key>ASCredentialProviderExtensionShowsConfigurationUI</key>
|
||||
<true/>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>ASCredentialProviderExtensionShowsConfigurationUI</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
|
@ -8,6 +8,7 @@ namespace Bit.iOS.Autofill.Models
|
||||
{
|
||||
public NSExtensionContext ExtContext { get; set; }
|
||||
public ASCredentialServiceIdentifier[] ServiceIdentifiers { get; set; }
|
||||
public ASPasswordCredentialIdentity CredentialIdentity { get; set; }
|
||||
public ASPasswordCredentialIdentity CredentialIdentity { get; set; }
|
||||
public bool Configuring { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user