mirror of
https://github.com/bitwarden/android.git
synced 2024-12-30 21:08:33 +03:00
Moved lock logic to loading view controller.
This commit is contained in:
parent
047f5b100f
commit
7f5d371bf3
6 changed files with 74 additions and 55 deletions
|
@ -66,7 +66,24 @@ namespace Bit.iOS.Extension
|
||||||
public override void ViewDidAppear(bool animated)
|
public override void ViewDidAppear(bool animated)
|
||||||
{
|
{
|
||||||
base.ViewDidAppear(animated);
|
base.ViewDidAppear(animated);
|
||||||
|
|
||||||
|
var lockService = Resolver.Resolve<ILockService>();
|
||||||
|
var lockType = lockService.GetLockType(false);
|
||||||
|
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:
|
||||||
PerformSegue("siteListSegue", this);
|
PerformSegue("siteListSegue", this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
||||||
|
@ -74,14 +91,46 @@ namespace Bit.iOS.Extension
|
||||||
var navController = segue.DestinationViewController as UINavigationController;
|
var navController = segue.DestinationViewController as UINavigationController;
|
||||||
if(navController != null)
|
if(navController != null)
|
||||||
{
|
{
|
||||||
var actionController = navController.TopViewController as SiteListViewController;
|
var listSiteController = navController.TopViewController as SiteListViewController;
|
||||||
if(actionController != null)
|
var addSiteController = navController.TopViewController as SiteAddViewController;
|
||||||
|
var fingerprintViewController = navController.TopViewController as LockFingerprintViewController;
|
||||||
|
var pinViewController = navController.TopViewController as LockPinViewController;
|
||||||
|
var passwordViewController = navController.TopViewController as LockPasswordViewController;
|
||||||
|
|
||||||
|
if(listSiteController != null)
|
||||||
{
|
{
|
||||||
actionController.Context = _context;
|
listSiteController.Context = _context;
|
||||||
|
}
|
||||||
|
else if(addSiteController != null)
|
||||||
|
{
|
||||||
|
addSiteController.Context = _context;
|
||||||
|
}
|
||||||
|
else if(fingerprintViewController != null)
|
||||||
|
{
|
||||||
|
fingerprintViewController.Context = _context;
|
||||||
|
fingerprintViewController.LoadingViewController = this;
|
||||||
|
}
|
||||||
|
else if(pinViewController != null)
|
||||||
|
{
|
||||||
|
pinViewController.Context = _context;
|
||||||
|
pinViewController.LoadingViewController = this;
|
||||||
|
}
|
||||||
|
else if(passwordViewController != null)
|
||||||
|
{
|
||||||
|
passwordViewController.Context = _context;
|
||||||
|
passwordViewController.LoadingViewController = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DismissLockAndContinue()
|
||||||
|
{
|
||||||
|
DismissViewController(true, () =>
|
||||||
|
{
|
||||||
|
PerformSegue("siteListSegue", this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void SetIoc()
|
private void SetIoc()
|
||||||
{
|
{
|
||||||
var container = new UnityContainer();
|
var container = new UnityContainer();
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace Bit.iOS.Extension
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public Context Context { get; set; }
|
public Context Context { get; set; }
|
||||||
|
public LoadingViewController LoadingViewController { get; set; }
|
||||||
|
|
||||||
public override void ViewWillAppear(bool animated)
|
public override void ViewWillAppear(bool animated)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +74,7 @@ namespace Bit.iOS.Extension
|
||||||
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
|
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
|
||||||
if(result.Authenticated)
|
if(result.Authenticated)
|
||||||
{
|
{
|
||||||
DismissModalViewController(true);
|
LoadingViewController.DismissLockAndContinue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace Bit.iOS.Extension
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public Context Context { get; set; }
|
public Context Context { get; set; }
|
||||||
|
public LoadingViewController LoadingViewController { get; set; }
|
||||||
public FormEntryTableViewCell MasterPasswordCell { get; set; } = new FormEntryTableViewCell(
|
public FormEntryTableViewCell MasterPasswordCell { get; set; } = new FormEntryTableViewCell(
|
||||||
AppResources.MasterPassword, useLabelAsPlaceholder: true);
|
AppResources.MasterPassword, useLabelAsPlaceholder: true);
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ namespace Bit.iOS.Extension
|
||||||
if(key.SequenceEqual(_cryptoService.Key))
|
if(key.SequenceEqual(_cryptoService.Key))
|
||||||
{
|
{
|
||||||
MasterPasswordCell.TextField.ResignFirstResponder();
|
MasterPasswordCell.TextField.ResignFirstResponder();
|
||||||
DismissModalViewController(true);
|
LoadingViewController.DismissLockAndContinue();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Bit.iOS.Extension
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public Context Context { get; set; }
|
public Context Context { get; set; }
|
||||||
|
public LoadingViewController LoadingViewController { get; set; }
|
||||||
|
|
||||||
public override void ViewWillAppear(bool animated)
|
public override void ViewWillAppear(bool animated)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +59,7 @@ namespace Bit.iOS.Extension
|
||||||
if(PinTextField.Text == _authService.PIN)
|
if(PinTextField.Text == _authService.PIN)
|
||||||
{
|
{
|
||||||
PinTextField.ResignFirstResponder();
|
PinTextField.ResignFirstResponder();
|
||||||
DismissModalViewController(true);
|
LoadingViewController.DismissLockAndContinue();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
</view>
|
</view>
|
||||||
<connections>
|
<connections>
|
||||||
<segue destination="oCZ-GQ-aOK" kind="show" identifier="siteListSegue" id="1679"/>
|
<segue destination="oCZ-GQ-aOK" kind="show" identifier="siteListSegue" id="1679"/>
|
||||||
|
<segue id="8446" destination="6512" kind="presentation" identifier="lockFingerprintSegue" animates="NO"/>
|
||||||
|
<segue id="8924" destination="6815" kind="presentation" identifier="lockPinSegue" animates="NO"/>
|
||||||
|
<segue id="9874" destination="6855" kind="presentation" identifier="lockPasswordSegue" animates="NO"/>
|
||||||
|
<segue id="10498" destination="1845" kind="presentation" identifier="newSiteSegue" modalPresentationStyle="" modalTransitionStyle=""/>
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
@ -90,7 +94,7 @@
|
||||||
</navigationController>
|
</navigationController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="1849" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="1849" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1900" y="562"/>
|
<point key="canvasLocation" x="1932" y="-270"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="2086">
|
<scene sceneID="2086">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -128,7 +132,7 @@
|
||||||
</tableViewController>
|
</tableViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="2093" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="2093" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="2644" y="570"/>
|
<point key="canvasLocation" x="2632" y="-276"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="2303">
|
<scene sceneID="2303">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -173,9 +177,6 @@
|
||||||
<outlet property="AddBarButton" destination="3736" id="name-outlet-3736"/>
|
<outlet property="AddBarButton" destination="3736" id="name-outlet-3736"/>
|
||||||
<outlet property="CancelBarButton" destination="3735" id="name-outlet-3735"/>
|
<outlet property="CancelBarButton" destination="3735" id="name-outlet-3735"/>
|
||||||
<outlet property="NavItem" destination="3734" id="name-outlet-3734"/>
|
<outlet property="NavItem" destination="3734" id="name-outlet-3734"/>
|
||||||
<segue id="6763" destination="6512" kind="presentation" identifier="lockFingerprintSegue" animates="NO" modalPresentationStyle="" modalTransitionStyle=""/>
|
|
||||||
<segue id="7049" destination="6815" kind="presentation" identifier="lockPinSegue" animates="NO"/>
|
|
||||||
<segue id="7291" destination="6855" kind="presentation" identifier="lockPasswordSegue" animates="NO"/>
|
|
||||||
</connections>
|
</connections>
|
||||||
<toolbarItems/>
|
<toolbarItems/>
|
||||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||||
|
@ -215,7 +216,7 @@
|
||||||
</navigationController>
|
</navigationController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4578" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="4578" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="3357" y="556"/>
|
<point key="canvasLocation" x="3369" y="-276"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="4579">
|
<scene sceneID="4579">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -276,7 +277,7 @@
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4582" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="4582" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="4045" y="558"/>
|
<point key="canvasLocation" x="4045" y="-272"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="4911">
|
<scene sceneID="4911">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -294,7 +295,7 @@
|
||||||
</tableViewController>
|
</tableViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4918" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="4918" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="4676" y="618"/>
|
<point key="canvasLocation" x="4708" y="-194"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="6511">
|
<scene sceneID="6511">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -309,7 +310,7 @@
|
||||||
</navigationController>
|
</navigationController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6516" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="6516" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1906" y="1256"/>
|
<point key="canvasLocation" x="296" y="1394"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="6517">
|
<scene sceneID="6517">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -352,7 +353,7 @@
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6520" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="6520" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="2655" y="1260"/>
|
<point key="canvasLocation" x="983" y="1390"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="6801">
|
<scene sceneID="6801">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -407,7 +408,7 @@
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6813" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="6813" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="2653" y="1933"/>
|
<point key="canvasLocation" x="975" y="2083"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="6814">
|
<scene sceneID="6814">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -422,7 +423,7 @@
|
||||||
</navigationController>
|
</navigationController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6818" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="6818" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1886" y="1931"/>
|
<point key="canvasLocation" x="306" y="2083"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="6854">
|
<scene sceneID="6854">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -437,7 +438,7 @@
|
||||||
</navigationController>
|
</navigationController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6858" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="6858" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1878" y="2669"/>
|
<point key="canvasLocation" x="306" y="2759"/>
|
||||||
</scene>
|
</scene>
|
||||||
<scene sceneID="7412">
|
<scene sceneID="7412">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -471,7 +472,7 @@
|
||||||
</tableViewController>
|
</tableViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="7419" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="7419" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="2532" y="2675"/>
|
<point key="canvasLocation" x="977" y="2775"/>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Models;
|
|
||||||
using Bit.iOS.Core;
|
using Bit.iOS.Core;
|
||||||
using Bit.iOS.Extension.Models;
|
using Bit.iOS.Extension.Models;
|
||||||
using Foundation;
|
using Foundation;
|
||||||
|
@ -32,23 +31,6 @@ namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
base.ViewDidLoad();
|
base.ViewDidLoad();
|
||||||
|
|
||||||
var lockService = Resolver.Resolve<ILockService>();
|
|
||||||
var lockType = lockService.GetLockType(false);
|
|
||||||
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:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerable<SiteViewModel> filteredSiteModels = new List<SiteViewModel>();
|
IEnumerable<SiteViewModel> filteredSiteModels = new List<SiteViewModel>();
|
||||||
if(Context.DomainName != null)
|
if(Context.DomainName != null)
|
||||||
{
|
{
|
||||||
|
@ -88,27 +70,11 @@ namespace Bit.iOS.Extension
|
||||||
if(navController != null)
|
if(navController != null)
|
||||||
{
|
{
|
||||||
var addSiteController = navController.TopViewController as SiteAddViewController;
|
var addSiteController = navController.TopViewController as SiteAddViewController;
|
||||||
var fingerprintViewController = navController.TopViewController as LockFingerprintViewController;
|
|
||||||
var pinViewController = navController.TopViewController as LockPinViewController;
|
|
||||||
var passwordViewController = navController.TopViewController as LockPasswordViewController;
|
|
||||||
|
|
||||||
if(addSiteController != null)
|
if(addSiteController != null)
|
||||||
{
|
{
|
||||||
addSiteController.Context = Context;
|
addSiteController.Context = Context;
|
||||||
addSiteController.Parent = this;
|
addSiteController.Parent = this;
|
||||||
}
|
}
|
||||||
else if(fingerprintViewController != null)
|
|
||||||
{
|
|
||||||
fingerprintViewController.Context = Context;
|
|
||||||
}
|
|
||||||
else if(pinViewController != null)
|
|
||||||
{
|
|
||||||
pinViewController.Context = Context;
|
|
||||||
}
|
|
||||||
else if(passwordViewController != null)
|
|
||||||
{
|
|
||||||
passwordViewController.Context = Context;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue