Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Make the project build on M1
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelurb committed Nov 20, 2020
1 parent 071ab0f commit f77b605
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 209 deletions.
11 changes: 2 additions & 9 deletions Kiosk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1140,21 +1140,18 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Kiosk/Pods-Kiosk-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Keys/Keys.framework",
"${BUILT_PRODUCTS_DIR}/ARAnalytics/ARAnalytics.framework",
"${BUILT_PRODUCTS_DIR}/ARCollectionViewMasonryLayout/ARCollectionViewMasonryLayout.framework",
"${BUILT_PRODUCTS_DIR}/ARTiledImageView/ARTiledImageView.framework",
"${BUILT_PRODUCTS_DIR}/Action/Action.framework",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/Analytics/Analytics.framework",
"${BUILT_PRODUCTS_DIR}/Artsy+OSSUIFonts/Artsy_UIFonts.framework",
"${BUILT_PRODUCTS_DIR}/Artsy+UIColors/Artsy_UIColors.framework",
"${BUILT_PRODUCTS_DIR}/Artsy+UIFonts/Artsy_UIFonts.framework",
"${BUILT_PRODUCTS_DIR}/Artsy+UILabels/Artsy_UILabels.framework",
"${BUILT_PRODUCTS_DIR}/Artsy-UIButtons/Artsy_UIButtons.framework",
"${PODS_ROOT}/CardFlight-v4/CardFlight.framework",
"${BUILT_PRODUCTS_DIR}/DZNWebViewController/DZNWebViewController.framework",
"${BUILT_PRODUCTS_DIR}/ECPhoneNumberFormatter/ECPhoneNumberFormatter.framework",
"${BUILT_PRODUCTS_DIR}/FLKAutoLayout/FLKAutoLayout.framework",
"${BUILT_PRODUCTS_DIR}/HockeySDK-Source/HockeySDK_Source.framework",
"${BUILT_PRODUCTS_DIR}/ISO8601DateFormatter/ISO8601DateFormatter.framework",
"${BUILT_PRODUCTS_DIR}/Moya/Moya.framework",
"${BUILT_PRODUCTS_DIR}/NJKWebViewProgress/NJKWebViewProgress.framework",
Expand All @@ -1176,21 +1173,17 @@
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Keys.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ARAnalytics.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ARCollectionViewMasonryLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ARTiledImageView.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Action.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Analytics.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Artsy_UIColors.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Artsy_UIFonts.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Artsy_UIColors.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Artsy_UILabels.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Artsy_UIButtons.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CardFlight.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DZNWebViewController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ECPhoneNumberFormatter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLKAutoLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HockeySDK_Source.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ISO8601DateFormatter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NJKWebViewProgress.framework",
Expand Down
3 changes: 0 additions & 3 deletions Kiosk/App/AppDelegate+GlobalActions.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import UIKit
import QuartzCore
import ARAnalytics
import RxSwift
import Action

Expand Down Expand Up @@ -145,7 +144,6 @@ private extension AppDelegate {

func showRegistration() -> Observable<Void> {
return Observable.create { observer in
ARAnalytics.event("Register To Bid Tapped")

let storyboard = UIStoryboard.fulfillment()
let containerController = storyboard.instantiateInitialViewController() as! FulfillmentContainerViewController
Expand Down Expand Up @@ -212,7 +210,6 @@ private extension AppDelegate {
let nav = UINavigationController(rootViewController: webController)
nav.modalPresentationStyle = .formSheet

ARAnalytics.event("Show Web View", withProperties: ["url" : address])
self.window?.rootViewController?.present(nav, animated: true) {
sendDispatchCompleted(to: observer)
}
Expand Down
8 changes: 0 additions & 8 deletions Kiosk/App/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import UIKit
import ARAnalytics
import SDWebImage
import RxSwift
import Keys
Expand Down Expand Up @@ -53,17 +52,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Stripe.setDefaultPublishableKey(keys.stripeProductionPublishableKey)
}

ARAnalytics.setup(withAnalytics: [
ARHockeyAppBetaID: keys.hockeyBetaSecret,
ARHockeyAppLiveID: keys.hockeyProductionSecret,
ARSegmentioWriteKey: keys.segmentWriteKey
])

setupHelpButton()
setupUserAgent()

logger.log("App Started")
ARAnalytics.event("Session Started")
return true
}

Expand Down
161 changes: 25 additions & 136 deletions Kiosk/App/CardHandler.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
import UIKit
import RxSwift
import CardFlight

class CardHandler: NSObject, CFTTransactionDelegate {
internal final class DummyCard: NSObject {

internal init(token: String, cardInfo: DummyCard.DummyCardInfo) {
self.token = token
self.cardInfo = cardInfo
}

let token: String
let cardInfo: DummyCardInfo

internal final class DummyCardInfo: NSObject {

internal init(cardholderName: String, lastFour: String) {
self.cardholderName = cardholderName
self.lastFour = lastFour
}

let cardholderName: String
let lastFour: String
}
}

class CardHandler: NSObject {

private let _cardStatus = PublishSubject<String>()
private let _userMessages = PublishSubject<String>()
private var cardReader: CFTCardReaderInfo?

var transaction: CFTTransaction?

var card: DummyCard?

var cardStatus: Observable<String> {
return _cardStatus.asObservable()
Expand All @@ -27,15 +47,6 @@ class CardHandler: NSObject, CFTTransactionDelegate {
}
}

var cardFlightCredentials: CFTCredentials {
let credentials = CFTCredentials()
credentials.setup(apiKey: self.APIKey, accountToken: self.APIToken, completion: nil)
return credentials
}

var card: (cardInfo: CFTCardInfo, token: String)?


let APIKey: String
let APIToken: String

Expand All @@ -44,8 +55,6 @@ class CardHandler: NSObject, CFTTransactionDelegate {
APIToken = accountToken

super.init()

self.transaction = CFTTransaction(delegate: self)
}

deinit {
Expand All @@ -54,128 +63,8 @@ class CardHandler: NSObject, CFTTransactionDelegate {

func startSearching() {
_cardStatus.onNext("Starting search...")
let tokenizationParameters = CFTTokenizationParameters(customerId: nil, credentials: self.cardFlightCredentials)
self.transaction?.beginTokenizing(tokenizationParameters: tokenizationParameters)
}

func end() {
transaction?.select(processOption: CFTProcessOption.abort)
transaction = nil
}

func transaction(_ transaction: CFTTransaction, didUpdate state: CFTTransactionState, error: Error?) {
switch state {
case .completed:
_cardStatus.onNext("Transaction completed")
case .processing:
_cardStatus.onNext("Transaction processing")
case .deferred:
_cardStatus.onNext("Transaction deferred")
case .pendingCardInput:
_cardStatus.onNext("Pending card input")
transaction.select(cardReaderInfo: cardReader, cardReaderModel: cardReader?.cardReaderModel ?? .unknown)
case .pendingTransactionParameters:
_cardStatus.onNext("Pending transaction parameters")
case .unknown:
_cardStatus.onNext("Unknown transactionstate")
case .pendingProcessOption:
break
}
}

func transaction(_ transaction: CFTTransaction, didComplete historicalTransaction: CFTHistoricalTransaction) {
if let cardInfo = historicalTransaction.cardInfo, let token = historicalTransaction.cardToken {
self.card = (cardInfo: cardInfo, token: token)
_cardStatus.onNext("Got Card")
_cardStatus.onCompleted()
} else {
_cardStatus.onNext("Card Flight Error – could not retrieve card data.");
if let error = historicalTransaction.error {
_cardStatus.onNext("response Error \(error)");
logger.log("CardReader got a response it cannot handle")
}
startSearching()
}
}

func transaction(_ transaction: CFTTransaction, didReceive cardReaderEvent: CFTCardReaderEvent, cardReaderInfo: CFTCardReaderInfo?) {
_cardStatus.onNext(cardReaderEvent.statusMessage)
}

func transaction(_ transaction: CFTTransaction, didUpdate cardReaderArray: [CFTCardReaderInfo]) {
self.cardReader = cardReaderArray.first
_cardStatus.onNext("Received new card reader availability, number of readers: \(cardReaderArray.count)")
}

func transaction(_ transaction: CFTTransaction, didRequestProcessOption cardInfo: CFTCardInfo) {
logger.log("Received request for processing option, will process transaction.")
_cardStatus.onNext("Request for process option, automatically processing...")
// We auto-accept the process option on the user's behalf because the prompt doesn't make sense in a
// tokenization flow. See comments in `userMessages` property above.
transaction.select(processOption: .process)
}

func transaction(_ transaction: CFTTransaction, didRequestDisplay message: CFTMessage) {
let message = message.primary ?? message.secondary ?? ""
_userMessages.onNext(message)
logger.log("Received request to display message: \(message)")
_cardStatus.onNext("Received message for user: \(message)")
}
}

typealias UnhandledDelegateCallbacks = CardHandler
/// We don't expect any of these functions to be called, but they are required for the delegate protocol.
extension UnhandledDelegateCallbacks {
func transaction(_ transaction: CFTTransaction, didDefer transactionData: Data) {
logger.log("Transaction has been deferred.")
_cardStatus.onNext("Transaction deferred")
}

public func transaction(_ transaction: CFTTransaction, didRequest cvm: CFTCVM) {
if cvm == CFTCVM.signature {
logger.log("Transaction requested signature from user, which should not occur for tokenization.")
_cardStatus.onNext("Ignoring user signature request from CardFlight")
}
}
}

extension CFTCardReaderEvent {
var statusMessage: String {
switch self {
case .unknown:
return "Unknown card event"
case .disconnected:
return "Reader is disconnected"
case .connected:
return "Reader is connected"
case .connectionErrored:
return "Connection error occurred"
case .cardSwiped:
return "Card swiped"
case .cardSwipeErrored:
return "Card swipe error"
case .cardInserted:
return "Card inserted"
case .cardInsertErrored:
return "Card insertion error"
case .cardRemoved:
return "Card removed"
case .cardTapped:
return "Card tapped"
case .cardTapErrored:
return "Card tap error"
case .updateStarted:
return "Update started"
case .updateCompleted:
return "Updated completed"
case .audioRecordingPermissionNotGranted:
return "iOS audio permissions no granted"
case .fatalError:
return "Fatal error"
case .connecting:
return "Connecting"
case .batteryStatusUpdated:
return "Battery status updated"
}
}
}
3 changes: 0 additions & 3 deletions Kiosk/Auction Listings/ListingsViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import UIKit
import SystemConfiguration
import ARAnalytics
import RxSwift
import ARCollectionViewMasonryLayout
import NSObject_Rx
Expand Down Expand Up @@ -133,7 +132,6 @@ class ListingsViewController: UIViewController {
let detailsViewController = segue.destination as! SaleArtworkDetailsViewController
detailsViewController.saleArtwork = saleArtwork
detailsViewController.provider = provider
ARAnalytics.event("Show Artwork Details", withProperties: ["id": saleArtwork?.artwork.id as Any])
}
}

Expand Down Expand Up @@ -204,7 +202,6 @@ private extension ListingsViewController {

func showDetails(forSaleArtwork saleArtwork: SaleArtwork) {

ARAnalytics.event("Artwork Details Tapped", withProperties: ["id": saleArtwork.artwork.id])
self.performSegue(withIdentifier: SegueIdentifier.ShowSaleArtworkDetails.rawValue, sender: saleArtwork)
}

Expand Down
2 changes: 0 additions & 2 deletions Kiosk/Bid Fulfillment/LoadingViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import UIKit
import Artsy_UILabels
import ARAnalytics
import RxSwift

class LoadingViewController: UIViewController {
Expand Down Expand Up @@ -110,7 +109,6 @@ extension LoadingViewController {
logger.log("Bidding process result: reserveNotMet \(reserveNotMet), isHighestBidder \(isHighestBidder), bidIsResolved \(bidIsResolved), createdNewbidder \(createdNewBidder)")

if placingBid {
ARAnalytics.event("Placed a bid", withProperties: ["top_bidder" : isHighestBidder, "sale_artwork": viewModel.bidDetails.saleArtwork?.artwork.id ?? ""])

if bidIsResolved {

Expand Down
4 changes: 0 additions & 4 deletions Kiosk/Bid Fulfillment/LoadingViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import ARAnalytics
import RxSwift

protocol LoadingViewModelType {
Expand Down Expand Up @@ -66,13 +65,10 @@ class LoadingViewModel: NSObject, LoadingViewModelType {
.flatMap { [weak self] provider -> Observable<(String, AuthorizedNetworking)> in
guard let me = self else { return .empty() }
guard me.placingBid else {
ARAnalytics.event("Registered New User Only")
// Skipping all further actions, since we're not placing a bid.
return .empty()
}

ARAnalytics.event("Started Placing Bid", withProperties: ["id": me.bidDetails.saleArtwork?.artwork.id ?? ""])

return me
.placeBidNetworkModel
.bid(provider)
Expand Down
1 change: 0 additions & 1 deletion Kiosk/Supporting Files/PodsBridgingHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#import <ECPhoneNumberFormatter/ECPhoneNumberFormatter.h>

#import <ARAnalytics/ARAnalytics.h>
#import <SDWebImage/UIImageView+WebCache.h>

// Fonts can come from one of two Pods, but each has the same module/header name.
Expand Down
2 changes: 0 additions & 2 deletions Kiosk/UIViewController+Bidding.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import UIKit
import ARAnalytics

extension UIViewController {
func bid(auctionID: String, saleArtwork: SaleArtwork, allowAnimations: Bool, provider: Networking) {
ARAnalytics.event("Bid Button Tapped", withProperties: ["id": saleArtwork.artwork.id])

let storyboard = UIStoryboard.fulfillment()
let containerController = storyboard.instantiateInitialViewController() as! FulfillmentContainerViewController
Expand Down
6 changes: 0 additions & 6 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ target 'Kiosk' do
pod 'ARCollectionViewMasonryLayout', '~> 2.0.0'
pod 'SDWebImage', '~> 3.7'
pod 'SVProgressHUD'

# Required as a workaround for https://github.com/bitstadium/HockeySDK-iOS/pull/421
pod 'HockeySDK-Source', git: 'https://github.com/bitstadium/HockeySDK-iOS.git'
pod 'ARAnalytics/Segmentio'
pod 'ARAnalytics/HockeyApp'

pod 'CardFlight-v4'
pod 'Stripe', '14.0.1'
pod 'ECPhoneNumberFormatter'
pod 'UIImageViewAligned', :git => 'https://github.com/ashfurrow/UIImageViewAligned.git'
Expand Down
Loading

0 comments on commit f77b605

Please sign in to comment.