Delete obsolete OTPScannerController
This commit is contained in:
parent
97368eb8a8
commit
c48fe3755e
3 changed files with 11 additions and 216 deletions
|
|
@ -22,7 +22,6 @@
|
|||
61326CDA7A73757FB68DCB04 /* Pods_passKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAB3F5541E51ADC8C6B56642 /* Pods_passKit.framework */; };
|
||||
A20691F41F2A3D0E0096483D /* SecurePasteboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20691F31F2A3D0E0096483D /* SecurePasteboard.swift */; };
|
||||
A2168A7F1EFD40D5005EA873 /* OnePasswordExtensionConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2168A7E1EFD40D5005EA873 /* OnePasswordExtensionConstants.swift */; };
|
||||
A217ACE21E9AB17C00A1A6CF /* OTPScannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A217ACE11E9AB17C00A1A6CF /* OTPScannerController.swift */; };
|
||||
A217ACE41E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A217ACE31E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift */; };
|
||||
A2367B9C1EEFE2E500C8FE8B /* SwiftyUserDefaults.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCA049951E3357E000522E8F /* SwiftyUserDefaults.framework */; };
|
||||
A2367BA01EF0387000C8FE8B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A2367B9F1EF0387000C8FE8B /* Assets.xcassets */; };
|
||||
|
|
@ -201,7 +200,6 @@
|
|||
7E088A9255B6CB576EF757C1 /* Pods-passKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-passKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-passKit/Pods-passKit.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
A20691F31F2A3D0E0096483D /* SecurePasteboard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecurePasteboard.swift; sourceTree = "<group>"; };
|
||||
A2168A7E1EFD40D5005EA873 /* OnePasswordExtensionConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnePasswordExtensionConstants.swift; sourceTree = "<group>"; };
|
||||
A217ACE11E9AB17C00A1A6CF /* OTPScannerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTPScannerController.swift; sourceTree = "<group>"; };
|
||||
A217ACE31E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = GitConfigSettingTableViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
A2227D4C1EEE5E25002A69A9 /* libObjectivePGP.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libObjectivePGP.a; path = "Pods/../build/Debug-iphoneos/ObjectivePGP/libObjectivePGP.a"; sourceTree = "<group>"; };
|
||||
A2227D4E1EEE5E31002A69A9 /* libPods-pass.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-pass.a"; path = "Pods/../build/Debug-iphoneos/libPods-pass.a"; sourceTree = "<group>"; };
|
||||
|
|
@ -578,7 +576,6 @@
|
|||
DCA049991E335CC800522E8F /* GitServerSettingTableViewController.swift */,
|
||||
DCC441531E916382008A90C4 /* GitSSHKeyArmorSettingTableViewController.swift */,
|
||||
DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */,
|
||||
A217ACE11E9AB17C00A1A6CF /* OTPScannerController.swift */,
|
||||
DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */,
|
||||
DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */,
|
||||
DC5734AD1E439AD400D09270 /* PasswordsViewController.swift */,
|
||||
|
|
@ -1216,7 +1213,6 @@
|
|||
DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */,
|
||||
DC5F385B1E56AADB00C69ACA /* PGPKeyArmorSettingTableViewController.swift in Sources */,
|
||||
DCAAF7451E2FA66800AB94BC /* SettingsTableViewController.swift in Sources */,
|
||||
A217ACE21E9AB17C00A1A6CF /* OTPScannerController.swift in Sources */,
|
||||
DCFB77A71E502DF9008DE471 /* EditPasswordTableViewController.swift in Sources */,
|
||||
DCA0499A1E335CC800522E8F /* GitServerSettingTableViewController.swift in Sources */,
|
||||
DCDDEAB31E4896BF00F68193 /* PasswordDetailTitleTableViewCell.swift in Sources */,
|
||||
|
|
@ -1712,7 +1708,7 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = pass/pass.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEFINES_MODULE = NO;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="YoR-iB-XAd">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="YoR-iB-XAd">
|
||||
<device id="retina5_5" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
|
@ -667,7 +667,7 @@
|
|||
<!--Scan OTP QR Codes-->
|
||||
<scene sceneID="AuR-rQ-G3V">
|
||||
<objects>
|
||||
<viewController id="A9p-Qb-WmU" customClass="OTPScannerController" customModule="pass" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController id="A9p-Qb-WmU" customClass="QRScannerController" customModule="pass" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="75M-B3-rK2"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="eYa-Io-fXF"/>
|
||||
|
|
@ -694,13 +694,7 @@
|
|||
<constraint firstItem="lOI-p4-BGb" firstAttribute="centerX" secondItem="a0T-JY-UcS" secondAttribute="centerX" id="IVH-ax-fJ3"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Scan OTP QR Codes" id="Hlb-5I-bfE">
|
||||
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="KBZ-N2-OGE">
|
||||
<connections>
|
||||
<action selector="pressCancel:" destination="A9p-Qb-WmU" id="SYK-Qh-Cs7"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<navigationItem key="navigationItem" title="Scan OTP QR Codes" id="Hlb-5I-bfE"/>
|
||||
<connections>
|
||||
<outlet property="scannerOutput" destination="lOI-p4-BGb" id="LZa-eC-1Lc"/>
|
||||
</connections>
|
||||
|
|
@ -1548,92 +1542,14 @@ Cgo
|
|||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="14" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO">
|
||||
<tabStops>
|
||||
<textTab alignment="left" location="28">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="56">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="84">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="112">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="140">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="168">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="196">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="224">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="252">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="280">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="308">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="336">
|
||||
<options/>
|
||||
</textTab>
|
||||
</tabStops>
|
||||
</paragraphStyle>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment content=" $ cat ~/.ssh/id_rsa">
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="13" name="Menlo-Regular"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO">
|
||||
<tabStops>
|
||||
<textTab alignment="left" location="28">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="56">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="84">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="112">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="140">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="168">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="196">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="224">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="252">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="280">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="308">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="336">
|
||||
<options/>
|
||||
</textTab>
|
||||
</tabStops>
|
||||
</paragraphStyle>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment>
|
||||
|
|
@ -1643,46 +1559,7 @@ The clipboard will be cleared 45s after pasting.</string>
|
|||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="14" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO">
|
||||
<tabStops>
|
||||
<textTab alignment="left" location="28">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="56">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="84">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="112">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="140">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="168">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="196">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="224">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="252">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="280">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="308">
|
||||
<options/>
|
||||
</textTab>
|
||||
<textTab alignment="left" location="336">
|
||||
<options/>
|
||||
</textTab>
|
||||
</tabStops>
|
||||
</paragraphStyle>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
|
|
@ -1987,11 +1864,11 @@ The clipboard will be cleared 45s after pasting.</string>
|
|||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Lock" width="25" height="25"/>
|
||||
<image name="Settings" width="25" height="25"/>
|
||||
<image name="Lock" width="75" height="75"/>
|
||||
<image name="Settings" width="75" height="75"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="iCM-Fy-hkk"/>
|
||||
<segue reference="UfP-k3-XeR"/>
|
||||
<segue reference="yyD-4H-pLE"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
//
|
||||
// QRScannerController.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Yishi Lin on 10/4/17.
|
||||
// Copyright © 2017 Yishi Lin. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import AVFoundation
|
||||
import passKit
|
||||
|
||||
class OTPScannerController: QRScannerController {
|
||||
|
||||
var scannedOTP: String?
|
||||
|
||||
@IBAction func pressCancel(_ sender: UIBarButtonItem) {
|
||||
navigationController?.popViewController(animated: true)
|
||||
}
|
||||
// MARK: - AVCaptureMetadataOutputObjectsDelegate Methods
|
||||
func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!) {
|
||||
|
||||
if let metadataObj = metadataObjects.first as? AVMetadataMachineReadableCodeObject,
|
||||
supportedCodeTypes.contains(metadataObj.type),
|
||||
let barCodeObject = videoPreviewLayer?.transformedMetadataObject(for: metadataObj) {
|
||||
|
||||
// draw a bounds on the found QR code
|
||||
qrCodeFrameView?.frame = barCodeObject.bounds
|
||||
|
||||
// check whether it is a valid result
|
||||
if let scannedString = metadataObj.stringValue {
|
||||
if let (accept, message) = delegate?.checkScannedOutput(line: scannedString) {
|
||||
scannerOutput.text = message
|
||||
if accept == true {
|
||||
captureSession?.stopRunning()
|
||||
scannedOTP = scannedString
|
||||
presentSaveAlert()
|
||||
}
|
||||
} else {
|
||||
// no delegate, show the scanned result
|
||||
scannerOutput.text = scannedString
|
||||
}
|
||||
} else {
|
||||
scannerOutput.text = "No string value"
|
||||
}
|
||||
|
||||
} else {
|
||||
qrCodeFrameView?.frame = CGRect.zero
|
||||
scannerOutput.text = "No QR code detected"
|
||||
}
|
||||
}
|
||||
|
||||
private func presentSaveAlert() {
|
||||
// initialize alert
|
||||
// XXX: use Password class for now, we need to come up a better structure to oranize this
|
||||
let password = Password(name: "empty", url: URL(string: ".")!, plainText: scannedOTP!)
|
||||
let (title, content) = password.getOtpStrings()!
|
||||
let alert = UIAlertController(title: "Success", message: "\(title): \(content)", preferredStyle: UIAlertControllerStyle.alert)
|
||||
alert.addAction(UIAlertAction(title: "Save", style: UIAlertActionStyle.default, handler: {[unowned self] (action) -> Void in
|
||||
self.delegate?.handleScannedOutput(line: self.scannedOTP!)
|
||||
self.navigationController?.popViewController(animated: true)
|
||||
}))
|
||||
|
||||
if password.otpType == .hotp {
|
||||
// hotp, no need to refresh
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
} else if password.otpType == .totp {
|
||||
// totp, refresh otp
|
||||
self.present(alert, animated: true) {
|
||||
let alertController = self.presentedViewController as! UIAlertController
|
||||
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) {_ in
|
||||
let (title, content) = password.getOtpStrings()!
|
||||
alertController.message = "\(title): \(content)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue