This is an iOS app for validating pretix tickets.
Library containing all business logic for interacting with pretix.
Communcation with the API, and caching data in the DataStore
is based on the Model
protocol: A collection of enum based models and parsing code to and from JSON. See Model
for a detailed description.
Holds key-value pairs for configuration. Passed around in the app as the source of truth for configuration, and also for accessing any other manager entities. See ConfigStore
for a detailed description.
Provides these manager entities:
DataStore
APIClient
TicketValidator
(switched based on theasyncModeEnabled
property)SyncManager
Abstracts all local data caching and sends notifications when data changes.
Manages requests to and responses from the Pretix REST API.
Exposes methods to check the validity of tickets and show event status. ConfigStore
will intantiate a fitting implementation of TicketValidator
depending on the asyncModeEnabled
property. This might be OnlineTicketValidator
, which uses the APIClient directly to check the validity of tickets and does not add anything to DataStore's queue, but instead throws errors if no network available, or AsyncTicketValidator
, which uses the DataStore to check the validity of tickets, and adds new checkins to DataStore's upload queue.
Downloads all data from the API using APIClient
and peridically updates the data using incremental updates. Manages a queue of changes to be uploaded to the API.
The actual app that uses LibPretixSync
Initialises a ConfigStore
instance and passes it on to ValidateTicketViewController
, which is the root view controller for the application. ValidateTicketViewController
will pass the instance on to any sub view controllers that request them using the Configurable
protocol.
ValidateTicketViewController
is implementing the AppCoordinator
protocol. Classes that are marked as AppCoordinatorReceiver
will get their appcoordinator
property set when they are instantiated via a segue. Use the appCoordinator
property for anything that needs to be a singleton, like getting to the ConfigStore
.
The app uses storbyboards and segues for navigation. Segue identifiers, in case you need to trigger segues manually, are in Segues.swift
. but most segues should be triggered by the storyboard.
Configurable
and ConfiguredNavigationController
: If a UIViewController is marked as implementing the Configurable protocol it will automatially get assigned a ConfigStore when it gets pushed from ValidateTicketViewController
.
Unit Tests are available to make sure models parse correctly.
To build the HTML documentation, install jazzy by running sudo gem install jazzy
(requirements: current macOS and Xcode is installed). Documentation will be auto-generated each time the project is built. You can also run jazzy
manually from the project root folder. Find generated documentation files in the docs/
directory. Documentation configuration lives in .jazzy.yml
.
To check for linting errors, install swiftlint by running brew install swiftlint
(requirements: current macOS and homebrew). Code will be linted and warnings and errors generated each time the project is built.
The code in this repository is published under the terms of the Apache License. See the LICENSE file for the complete license text.
- FMDB MIT Licence
- SwiftMessages MIT License
- Tink Keychain MIT Licence