Giter Site home page Giter Site logo

swiftpasscodelock's People

Contributors

antonigiske avatar maximbilan avatar szappanyos avatar yankodimitrov avatar ziogaschr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftpasscodelock's Issues

Memory leak when passcodes don't match.

I noticed that PasscodeLock adds a new UIVisualEffectView each time the passcodes don't match, which means that if I fail to match the passcodes while setting a new passcode the app will keep adding subviews until it runs out of memory.

Can you please check it out?
Thanks.

Error while running carthage update

I have opened the app and I got the following error:

Module file was created by an older version of the compiler; rebuild 'PasscodeLock' and try again: /Users/UserName/Documents/xcode/AppName/AppName/PasscodeLock.framework/Modules/PasscodeLock.swiftmodule/i386.swiftmodule

So I try to rebuild doing this:
carthage update

But I got the following errors:

/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:74:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:75:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:110:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:111:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:74:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:75:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:110:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:111:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:74:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:75:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:110:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:111:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:74:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignButton.swift:75:33: warning: use '#selector' instead of explicitly constructing a 'Selector'
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:110:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead
/Users/UserName/Documents/xcode/AppName/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLockViewController.swift:111:57: warning: use of string literal for Objective-C selectors is deprecated; use '#selector' instead

Carthage build issue on swift 3.1

I installed the Carthage of PasscodeLock in my project (xcode 8.0 swift 3.0.1) , i update my xcode 8.0 to xcode 8.3 . Now it showing the error "module compiled with swift 3.0.1 cannot be imported in swift 3.1 "

Interface Builder couldn't/wouldn't recognize the PasscodeSignPlaceholderView or PasscodeSignButton classes

I don't now if this is an Xcode 7 beta issue, or if I'm the only one... But when I tried implementing a custom xib file, as described here:

"PasscodeLock comes with two view components: PasscodeSignPlaceholderView and PasscodeSignButton that you can use to create your own custom designs. Both classes are @IBDesignable and @IBInspectable, so you can see their appearance and change their properties right inside the interface builder"

Interface Builder couldn't/wouldn't recognize the PasscodeSignPlaceholderView or PasscodeSignButton classes when I tried associating them with UIButtons, UIViews, etc.

Code signing identity

The code signing identity on the project is set, would probably be better to set it to none so it runs out of the box

add a background image to passcodelockview.xib

Hello
great app its amazing
but I'mfacing a prob when i want to add a background image to PasscodeLockView.xib it wont appear when i run the project and it says in the debugger description could not load "background image referenced from a nib in the bundle with identifier .....
any clue how to show the background image.
thank you
/MM

UML diagram needs update

There is no reference to PasscodeLockPresenter. It might be nice to include it in the UML.

Have you found an automated way for creating the UMLs in Xcode?

Again Custom Design Error

Now I have another error with custom PasscodeLockView.xib when tap on on any number
fatal error: NSArray element failed to match the Swift Array Element type
Install from cocoapods and add PasscodeSignButton.swift, PasscodeSignPlaceholderView.swift files to project
I can't install from carthage, got a many errors like
could not build module 'UIKit'

Keyboard show

The text with keyboard is not working.

When i return the screen is locked but the keyboard is visible.

Suggestion

It would be great to see this implemented with keychain

[Question] How to implement PasscodeLockTypeDelegate?

I want to know when passcodeLockDidSucceed happens. I tried adding PasscodeLockTypeDelegate to my viewController, but for some reason none of these delegate functions are being triggered:

func passcodeLockDidSucceed(lock: PasscodeLockType)
func passcodeLockDidFail(lock: PasscodeLockType)
func passcodeLockDidChangeState(lock: PasscodeLockType)
func passcodeLock(lock: PasscodeLockType, addedSignAtIndex index: Int)
func passcodeLock(lock: PasscodeLockType, removedSignAtIndex index: Int)

New Repository

@ziogaschr, @waltermvp, @venj, @kiokumicu, @guidelfrate, @gblotter, @karlml, @twofish187

Look guys, I just don't know what's happened with @yankodimitrov and I hope that everything is just going fine and he simply became very-very rich and threw out his laptop

But anyway, this great project needs an evolution, so I propose to continue work on this project somewhere else

I've made a fork of this project and merged a @ziogaschr outstanding commits into it, so you can fork it and start to make things happen

Thank you

P. S. https://github.com/velikanov/SwiftPasscodeLock

Presenting PasscodeLock without animation

When presenting PasscodeLock in AppDelegate applicationWillEnterForeground:

lazy var passcodeLockPresenter: PasscodeLockPresenter = {
    let configuration = PasscodeLockConfiguration()
    let presenter = PasscodeLockPresenter(mainWindow:self.window, configuration:configuration)
    return presenter
}()  

func applicationWillEnterForeground(application: UIApplication) {
    passcodeLockPresenter.presentPasscodeLock()
} 

the UIViewController that was present before entering background appears. Is it possible to present PasscodeLock without animation and avoid appearing of that UIViewController?

Thanks!

@antonigiske
@ziogaschr
@szappanyos
@yankodimitrov
@maximbilan

Bug: TouchID not showing when Passcode enabled

If I toggle the passcode switch to 'on', set a passcode, and then leave the app. Upon returning, I'm greeted with the new passcode, but no touchID authentication modal. I have to kill the app, and then enter it to get the touchID authentication modal to present.

Statusbar Color in Custom Xib

Could there be an option or enum to edit the xib statusbar color as well for dark backgrounds?

Currently an option that exists is to use a function like the one below for the view controller, which is ok for a temporary solution

override public func preferredStatusBarStyle() -> UIStatusBarStyle {
return UIStatusBarStyle.LightContent
}

screen shot 2016-03-08 at 5 26 09 pm

Incorrect highlighting or placeholders after wrong PIN entry.

One issue we have found is that after entering an incorrect PIN, there is some issues with which placeholder is shown highlighted. If the user taps quickly on another number button after entering the fourth key, the animation shows the first placeholder show highlighted during the animation, then when another selection is made after the animation the second placeholder is highlighted, and the first is not. Issue is that even though there is a check to enter the text until after the animation you need to first disable after an entry, and keep it disabled until after the animation when the 4th character is entered.

Fail to dismiss code entry screen when deactivating

Hi there,

I was just testing your app. it's pretty awesome :)

In the demo, when I run the app, set a passcode, close the app, type in my passcode and then click the switch to turn the passcode off the screen pops up to type my passcode in. When I do that (type in the passcode), nothing happens . The screen just stays there and I have to click cancel. When the view closes.

Any Ideas?

Support of passcodes longer than 4 digits

Great repository, thanks for sharing! ๐Ÿ‘

Do you have any plans for supporting passcodes longer than 4 digits? i.e. would be great.

If not, do you want to give me some pointers on how to do it?

Thanks!
:panos

PasscodeLockViewController must have a successCallback

I have the need to set a successCallback to PasscodeLockViewController.
I see that there are two options:

  1. add a public var successCallback: ((lock: PasscodeLockType) -> Void)? which is then set as passcodeLockVC.successCallback
  2. make the passcodeLockVC a public var.

p.s.: Why the successCallback passes the lock: PasscodeLockType. Can you give me a good example? I might benefit from that.

Make `PasscodeViewController` a Singleton instance

It might be helpful to make PasscodeViewController a singleton so as we can easily ask for the Lock screen in a single line when needed.
Also it will be easier to support methods like isLockscreenDisplayed.

All this are easy to be handled in an app, but I was wondering if you like them in the lib, so as it will be easier for smaller projects to handle things.

PasscodeLock App Delegate preventing SVProgressHUD from showing

Hi, great framework, its the only one that was able to work nicely. However, I am facing an issue with the code found in the app delegate, its preventing my SVProgressHUD from displaying anywhere on the app. Any ideas on why this is so? I used the same code from the example project in the app delegate:

import PasscodeLock

//PassCode Lock Code
    lazy var passcodeLockPresenter: PasscodeLockPresenter = {

        let configuration = PasscodeLockConfiguration()
        let presenter = PasscodeLockPresenter(mainWindow: self.window, configuration: configuration)

        return presenter
    }()

    func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {

        passcodeLockPresenter.present()

        return true
    }

 func applicationDidEnterBackground(_ application: UIApplication) {

        passcodeLockPresenter.present()
    }




Cancel and Delete buttons are not localizable

I made a translation of PasscodeLock.strings to Russian, but found that "Cancel" and "Delete" buttons on keypad are still in English. It's strange that this behavior hasn't got an attention yet. Localization should be supported for them. However, there is a workaround using custom PasscodeLockViewController:

class LocalizedPasscodeViewController: PasscodeLockViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        cancelButton?.setTitle(NSLocalizedString("passcode_cancel_button", comment: "Passcode screen cancel button"), forState: .Normal)
        deleteSignButton?.setTitle(NSLocalizedString("passcode_delete_button", comment: "Passcode screen delete button"), forState: .Normal)
    }
}

AlertController wrong position change after unlock

When I leave an alertcontroller open and close the app or leave the phone in standby, when I return to the app and unlock it, the alertcontroller is misplaced in top of the screen.
This happens for all the alertcontrollers.

Console warning: "Unbalanced calls to begin/end appearance transitions" on App start

When a passcode is set, and you start the app, the following warning appears in the console:

2015-09-03 08:31:41.141 PasscodeLockDemo[2751:663098] Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x12f6517b0>.

After doing some research, this issue is caused from line 21 on the PasscodeLockPresenter.swift file. When creating a UIViewController() w/o specifying the nib file to pass in to the initializer, it is causing an animation when it's added to the window, but there are other animations already currently taking place via the normal startup means on the mainWindow object (best I can tell.)

Pre-set password?

Can we have a pre-set password that the developers sets instead of having the user set it to make the app accessible to few people?

Support for multiple passcodes (multiple users)

I'm trying to use SwiftPasscodeLock in a system where multiple users can use an app in a shop environment.

The user needs to identify themselves using a PIN before they can use the system - this PIN maps to an identity token that is used in API requests.

I have a map of PIN code -> token in the keychain, so the PIN code effectively acts like a username.

It doesn't seem possible to use SwiftPasscodeLock in this scenario because it assumes there is only one PIN.

Looking at the code, I can think of various ways of implementing this but for now, it looks like the simplest change that would get me where I want to be is to change the PasscodeRepositoryType protocol so it doesn't return a passcode, but has a query method instead:

protocol PasscodeRepositoryType {
    ...
    func checkPasscode(passcode: [String]) -> Bool
}

The passcode checkin EnterPasscodeState.acceptPasscode() would need to change from:

        guard let currentPasscode = lock.repository.passcode else {
            return
        }

        if passcode == currentPasscode {

To:

        if lock.repository.checkPasscode(passcode) {

I can then implement this function however I want and in my case, check whether the PIN exists in the keychain (amongst many).

The downside is this is not backwards compatible, but a transitional API might be to not remove the var passcode { get } declaration and provide a default implementation of checkPasscode in the protocol:

func checkPasscode(passcode: [String]) -> Bool {
    guard let currentPasscode = passcode else {
            return false
    }

    return currentPasscode == passcode
}

Any thoughts?

Make the touchId reason runtime settable

Hi

I have an app that requires the user to authenticate against a server with user credentials before accessing the app. I am using a combination of Pin and/or TouchId depending on device capabilities so that the user doesn't have to manually enter their credentials each time.

When using this control with TouchId, I'd like to have a way of injecting at run time the reason that will show up when TouchId is triggered. I can't use the static .strings file because I need to include data in the reason that I'll only know at run time.

Carthage installation

I've been having issues installing this with carthage. The files download to /Checkouts but then fails to build:

** BUILD FAILED **


The following build commands failed:
    CompileSwift normal x86_64 /Users/Christo/Developer/Screen/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLock/SetPasscodeState.swift
    CompileSwift normal x86_64 /Users/Christo/Developer/Screen/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLock/ChangePasscodeState.swift
    CompileSwift normal x86_64 /Users/Christo/Developer/Screen/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/PasscodeLock/ConfirmPasscodeState.swift
    CompileSwift normal x86_64 /Users/Christo/Developer/Screen/Carthage/Checkouts/SwiftPasscodeLock/PasscodeLock/Views/PasscodeSignPlaceholderView.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(5 failures)

Any ideas?

Custom Design

Hi!
I compile framework with Carthage, and add PasscodeLockView.xib, PasscodeSignButton.swift, PasscodeSignPlaceholderView.swift to project.
For PasscodeLockView.xib set owner PasscodeLockViewController class.
After compile passcode show normal, but after tap on number pad got error "PasscodeLock was compiled with optimization - stepping may behave oddly; variables may not be available."
What am i doing wrong ?

Biometrics authentication presented even if !hasPasscode

Scenario:
When user logs in and set the passcode, then logs out and app deletes the passcode from defaults, if user closes and opens the app, biometrics authentication is presented. It can be canceled and user can continue using the app.

Fixable by:

private func authenticateWithBiometrics() {

    if !self.passcodeConfiguration.repository.hasPasscode { return }
    if passcodeConfiguration.shouldRequestTouchIDImmediately && passcodeLock.isTouchIDAllowed {

        passcodeLock.authenticateWithBiometrics()
    }
}

[Question] How to "kill" the PasscodeViewController

First of all, great stuff!

Second, I have the scenario where a user reaches the max number of passcode attempts.
When this happens, I want to delete all the sensitive information of the app and destroy the PasscodeViewController.

How can I do the latter?

Thanks!
:panos

How to verify if passcode was successfully entered

I'm displaying the passcode presenter if touchID is not available and if the passcode is successfully entered I want to login to my parse database using the keychain username and password stored.

But if the passcode is not entered correctly I don't want to login using the keychain information.

After passcodeLockPresenter.presentPasscodeLock()

How do I verify if it was successfully entered or not?

LAContext() support for iOS 7

I have been working in a project and I used this library for passcode lock. It is running smoothly in iOS 8. But when I try to change the device to IOS 7, app is crashed in this line :
let context = LAContext - (PasscodeViewController) due to no support for iOS 7. So what is the strategy that I could use instead?

Problem with PasscodeView.xib

Hi, i tried importing your project into mine.
When i open PasscodeView.xib it gives my 70 warnings.

PasscodeView.xib: warning: IB Designables: Ignoring user defined runtime attribute for key path "activeColor" on instance of "UIView". Hit an exception when attempting to set its value: [<UIView 0x7fd81acd87d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key activeColor.

I tried finding a solution on google, but i couldn't find one, maybe you know the answer?
Please reply soon, thanks in advance.

Thomas

Support for max number of attempts

Add the option to specify the maximum number of attempts M to enter a PIN. If specified, and when this number of attempts M is reached, the App will be informed of this. In our app, we would e.g. erase the App data.

Nice to have: option to additionally specify the number of attempts N after which new PIN entry will be disabled for 2^(A-N+1) seconds - i.e. with exponential back off - where A is the current attempt.

Conflicts with SVProgressHUD

SVProgressHUD shows the hud on UIWindowLevelNormal (which is 0). So, if we pass the app's main window to PasscodeLockPresenter(mainWindow:configuration:), its window level will be set (by PasscodeLockPresenter) to 1, causing SVProgressHUD never displays.

And if we pass nil, passcodeLockWindow will keep covering the app's main window after dismissing, make everything untouchable.

Here is my workaround, for your information:

  public func presentPasscodeLock() {

        guard passcodeConfiguration.repository.hasPasscode else { return }
        guard !isPasscodePresented else { return }

        isPasscodePresented = true
        passcodeLockWindow.windowLevel = 2
        passcodeLockWindow.hidden = false // add this line

        let passcodeLockVC = PasscodeLockViewController(state: .EnterPasscode, configuration: passcodeConfiguration)

        passcodeLockVC.dismissCompletionCallback = { [weak self] in

            self?.dismissPasscodeLock()
        }

        passcodeLockWindow.rootViewController = passcodeLockVC
    }

    private func dismissPasscodeLock() {

        isPasscodePresented = false
        mainWindow?.windowLevel = 1
        mainWindow?.makeKeyAndVisible()

        UIView.animateWithDuration(
            0.5,
            delay: 0,
            usingSpringWithDamping: 1,
            initialSpringVelocity: 0,
            options: [.CurveEaseInOut],
            animations: { [weak self] in

                self?.passcodeLockWindow.alpha = 0
            },
            completion: { [weak self] _ in

                self?.passcodeLockWindow.windowLevel = 0
                self?.passcodeLockWindow.rootViewController = nil
                self?.passcodeLockWindow.alpha = 1
                self?.passcodeLockWindow.hidden = true // add this line
            }
        )
    }

Use of TouchID

Hi

How to use the touch ID functionality with the passcode. Any help is much appreciated.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.