1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-27 12:26:31 +01:00

copy classes to autofill

This commit is contained in:
Kyle Spearrin 2018-09-20 22:24:13 -04:00
parent 219af7f288
commit d32eb9c9bc
7 changed files with 178 additions and 58 deletions

View File

@ -0,0 +1,28 @@
using System;
using UIKit;
namespace Bit.iOS.Extension
{
public partial class LockFingerprintViewController : Core.Controllers.LockFingerprintViewController
{
public LockFingerprintViewController(IntPtr handle) : base(handle)
{ }
public LoadingViewController LoadingController { get; set; }
public override UINavigationItem BaseNavItem => NavItem;
public override UIBarButtonItem BaseCancelButton => CancelButton;
public override UIButton BaseUseButton => UseButton;
public override UIButton BaseFingerprintButton => FingerprintButton;
public override Action Success => () => LoadingController.DismissLockAndContinue();
partial void CancelButton_Activated(UIBarButtonItem sender)
{
LoadingController.CompleteRequest(null);
}
partial void FingerprintButton_TouchUpInside(UIButton sender)
{
var task = CheckFingerprintAsync();
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using UIKit;
namespace Bit.iOS.Extension
{
public partial class LockPasswordViewController : Core.Controllers.LockPasswordViewController
{
public LockPasswordViewController(IntPtr handle) : base(handle)
{ }
public LoadingViewController LoadingController { get; set; }
public override UINavigationItem BaseNavItem => NavItem;
public override UIBarButtonItem BaseCancelButton => CancelButton;
public override UIBarButtonItem BaseSubmitButton => SubmitButton;
public override Action Success => () => LoadingController.DismissLockAndContinue();
partial void SubmitButton_Activated(UIBarButtonItem sender)
{
CheckPassword();
}
partial void CancelButton_Activated(UIBarButtonItem sender)
{
LoadingController.CompleteRequest(null);
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using UIKit;
namespace Bit.iOS.Extension
{
public partial class LockPinViewController : Core.Controllers.LockPinViewController
{
public LockPinViewController(IntPtr handle) : base(handle)
{ }
public LoadingViewController LoadingController { get; set; }
public override UINavigationItem BaseNavItem => NavItem;
public override UIBarButtonItem BaseCancelButton => CancelButton;
public override UILabel BasePinLabel => PinLabel;
public override UILabel BaseInstructionLabel => InstructionLabel;
public override UITextField BasePinTextField => PinTextField;
public override Action Success => () => LoadingController.DismissLockAndContinue();
partial void CancelButton_Activated(UIBarButtonItem sender)
{
LoadingController.CompleteRequest(null);
}
}
}

View File

@ -0,0 +1,63 @@
using System;
using Foundation;
using UIKit;
namespace Bit.iOS.Extension
{
public partial class LoginAddViewController : Core.Controllers.LoginAddViewController
{
public LoginAddViewController(IntPtr handle) : base(handle)
{ }
public LoginListViewController LoginListController { get; set; }
public LoadingViewController LoadingController { get; set; }
public override UINavigationItem BaseNavItem => NavItem;
public override UIBarButtonItem BaseCancelButton => CancelBarButton;
public override UIBarButtonItem BaseSaveButton => SaveBarButton;
public override Action Success => () =>
{
if(LoginListController != null)
{
LoginListController.DismissModal();
}
else if(LoadingController != null)
{
LoadingController.CompleteUsernamePasswordRequest(UsernameCell.TextField.Text,
PasswordCell.TextField.Text, null, null);
}
};
partial void CancelBarButton_Activated(UIBarButtonItem sender)
{
if(LoginListController != null)
{
DismissViewController(true, null);
}
else
{
LoadingController.CompleteRequest(null);
}
}
async partial void SaveBarButton_Activated(UIBarButtonItem sender)
{
await this.SaveAsync();
}
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
{
var navController = segue.DestinationViewController as UINavigationController;
if(navController != null)
{
var passwordGeneratorController = navController.TopViewController as PasswordGeneratorViewController;
if(passwordGeneratorController != null)
{
passwordGeneratorController.PasswordOptions = Context.PasswordOptions;
passwordGeneratorController.Parent = this;
}
}
}
}
}

View File

@ -1,55 +0,0 @@
// WARNING
//
// This file has been generated automatically by Visual Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;
namespace Bit.iOS.Autofill
{
[Register ("LoginListViewController")]
partial class LoginListViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UIBarButtonItem AddBarButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UIBarButtonItem CancelBarButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UINavigationItem NavItem { get; set; }
[Action ("AddBarButton_Activated:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void AddBarButton_Activated (UIKit.UIBarButtonItem sender);
[Action ("CancelBarButton_Activated:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void CancelBarButton_Activated (UIKit.UIBarButtonItem sender);
void ReleaseDesignerOutlets ()
{
if (AddBarButton != null) {
AddBarButton.Dispose ();
AddBarButton = null;
}
if (CancelBarButton != null) {
CancelBarButton.Dispose ();
CancelBarButton = null;
}
if (NavItem != null) {
NavItem.Dispose ();
NavItem = null;
}
}
}
}

View File

@ -0,0 +1,31 @@
using System;
using UIKit;
namespace Bit.iOS.Extension
{
public partial class PasswordGeneratorViewController : Core.Controllers.PasswordGeneratorViewController
{
public PasswordGeneratorViewController(IntPtr handle) : base(handle)
{ }
public LoginAddViewController Parent { get; set; }
public override UINavigationItem BaseNavItem => NavItem;
public override UIBarButtonItem BaseCancelButton => CancelBarButton;
public override UIBarButtonItem BaseSelectBarButton => SelectBarButton;
public override UILabel BasePasswordLabel => PasswordLabel;
partial void SelectBarButton_Activated(UIBarButtonItem sender)
{
GoogleAnalyticsService.TrackExtensionEvent("SelectedGeneratedPassword");
DismissViewController(true, () =>
{
Parent.PasswordCell.TextField.Text = PasswordLabel.Text;
});
}
partial void CancelBarButton_Activated(UIBarButtonItem sender)
{
DismissViewController(true, null);
}
}
}

View File

@ -203,11 +203,16 @@
<AppExtensionDebugBundleId /> <AppExtensionDebugBundleId />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="LockFingerprintViewController.cs" />
<Compile Include="LockPasswordViewController.cs" />
<Compile Include="LockPinViewController.cs" />
<Compile Include="LoginAddViewController.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" /> <Compile Include="AppDelegate.cs" />
<Compile Include="Models\Context.cs" /> <Compile Include="Models\Context.cs" />
<None Include="Info.plist" /> <None Include="Info.plist" />
<None Include="Entitlements.plist" /> <None Include="Entitlements.plist" />
<Compile Include="PasswordGeneratorViewController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<InterfaceDefinition Include="MainInterface.storyboard" /> <InterfaceDefinition Include="MainInterface.storyboard" />
<Compile Include="CredentialProviderViewController.cs" /> <Compile Include="CredentialProviderViewController.cs" />
@ -215,9 +220,6 @@
<DependentUpon>CredentialProviderViewController.cs</DependentUpon> <DependentUpon>CredentialProviderViewController.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="LoginListViewController.cs" /> <Compile Include="LoginListViewController.cs" />
<Compile Include="LoginListViewController.designer.cs">
<DependentUpon>LoginListViewController.cs</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />