Skip to content

epau/iOS-SecureEntrySDK

Repository files navigation

Introduction

SecureEntryView

The main view integrating the PDF417 into 3rd party applications is the SecureEntryView. It inherits from UIView and gives access to methods for controlling the underlying data and animation color.

Class definition for the view:

/**
* View displaying a rotating PDF417 or static PDF417 ticket.
*/
public final class SecureEntryView: UIView {}

Installation

Cocoapods

  1. Add the following to your PodFile
pod 'iOS-SecureEntrySDK', :git => 'https://github.com/ticketmaster/iOS-SecureEntrySDK.git'
  1. Then run:
pod install
-- or --
pod update

Manually

  1. Clone SecureEntrySDK from the git repository: https://github.com/ticketmaster/iOS-SecureEntrySDK
git clone https://github.com/ticketmaster/iOS-SecureEntrySDK
  1. Add the SecureEntryView.xcodeproj from the cloned repository in your own Xcode project.
  2. Link Presence.framework with your target
  3. Add Copy Files Build Phase to include the framework to your application bundle

Usage

Storyboard Example Result
Storyboard Screenshot

Adding the view

Simply include a UIView within your storyboard, and override it's class type to SecureEntryView, and link it to your code using an outlet:

@IBOutlet weak var secureEntryView: Presence.SecureEntryView!

or you may add it to a ViewController programmatically:

import Presence

...

var secureEntryView = Presence.SecureEntryView(frame: frameRect)
self.addSubview(secureEntryView)

Position and size

The size of the rendered PDF417 displayed within the SecureEntryView is determined by the width of the view, however the height will be fixed at an aspect of 5:1, so to avoid any unexpected cropping or overlap with other elements, you should set the size, position, and aspect ratio of your SecureEntryView accordingly.

Since the SecureEntryView inherits from a standard UIView, you may use any methods associated with a view to alter its appearance, such as setFrame, etc.


Syncing the time

SecureEntryView.syncTime

This method is used to begin a background time sync. This method is provided to allow apps to initiate a time sync before a SecureEntryView is ever instantiated/displayed.

Note: This is a static/singleton method, and must be called on the SecureEntryView class, and not a class instance.

// Initiates a background time sync 
SecureEntryView.syncTime()

Applying the token

setToken

This method is used to apply a ticket's 'secure token' to the view. This will trigger a re-render of the view using the new token's data.

Note: You must call this method otherwise the view will remain blank/empty.

// set the token on the view 
secureEntryView.setToken(token: String)
secureEntryView.setToken(token: String, errorText: String)
Parameters
  • token (String): The token object obtained when fetching the user's tickets.
  • errorText (String): An optional error message to display when an error occurs processing the provided token.

Change the branding color

setBrandingColor

Sets the branding color to the specified color value. This color is typically associated with a particular brand or team. Currently the branding color affects only the animation.

secureEntryView.setBrandingColor(color: UIColor)
Parameters
  • color (UIColor): A color value to apply to the view.

Custom error handling

showError

Shows a custom error string to display within the view (this may be any arbitrary error provided by the client app).

secureEntryView.showError(text: String)
secureEntryView.showError(text: String, icon: UIImage)
Parameters
  • text (String): The text to display when an error occurs.
  • icon (String): An optional icon to display along with the error. If none provided a default icon will be used.

Acknowledgements

SecureEntrySDK depends on the following open-source projects:

This product includes software developed by "Marcin Krzyzanowski" (http://krzyzanowskim.com/).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages