1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-13 06:43:17 +00:00

moved view controllers to core library for reuse

This commit is contained in:
Kyle Spearrin
2018-09-20 21:54:01 -04:00
parent df80122ce1
commit 5f1a8017f1
18 changed files with 1138 additions and 1019 deletions

View File

@@ -26,7 +26,7 @@ namespace Bit.iOS.Autofill
private bool _setupHockeyApp = false;
private IGoogleAnalyticsService _googleAnalyticsService;
public CredentialProviderViewController (IntPtr handle) : base (handle)
public CredentialProviderViewController(IntPtr handle) : base(handle)
{
}
@@ -38,7 +38,7 @@ namespace Bit.iOS.Autofill
_context.ExtContext = ExtensionContext;
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
if (!_setupHockeyApp)
if(!_setupHockeyApp)
{
var appIdService = Resolver.Resolve<IAppIdService>();
var crashManagerDelegate = new HockeyAppCrashManagerDelegate(appIdService, Resolver.Resolve<IAuthService>());
@@ -59,7 +59,7 @@ namespace Bit.iOS.Autofill
base.PrepareCredentialList(serviceIdentifiers);
var authService = Resolver.Resolve<IAuthService>();
if (!authService.IsAuthenticated)
if(!authService.IsAuthenticated)
{
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
{
@@ -69,8 +69,6 @@ namespace Bit.iOS.Autofill
return;
}
PerformSegue("loginListSegue", this);
}
@@ -91,10 +89,11 @@ namespace Bit.iOS.Autofill
public void CompleteRequest(string username = null, string password = null, string totp = null)
{
if(string.IsNullOrWhiteSpace(username) && string.IsNullOrWhiteSpace(password)) {
if(string.IsNullOrWhiteSpace(username) && string.IsNullOrWhiteSpace(password))
{
_googleAnalyticsService.TrackAutofillExtensionEvent("Canceled");
var err = new NSError(new NSString("ASExtensionErrorDomain"),
Convert.ToInt32(ASExtensionErrorCode.UserCanceled), null);
var err = new NSError(new NSString("ASExtensionErrorDomain"),
Convert.ToInt32(ASExtensionErrorCode.UserCanceled), null);
_googleAnalyticsService.Dispatch(() =>
{
NSRunLoop.Main.BeginInvokeOnMainThread(() =>
@@ -121,16 +120,14 @@ namespace Bit.iOS.Autofill
});
}
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
{
var navController = segue.DestinationViewController as UINavigationController;
if (navController != null)
if(navController != null)
{
var listLoginController = navController.TopViewController as LoginListViewController;
if (listLoginController != null)
if(listLoginController != null)
{
listLoginController.Context = _context;
listLoginController.CPViewController = this;