Skip to content

Commit

Permalink
PR feedback - remove CoreLocation implimentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxdesmarais committed Aug 29, 2023
1 parent 3274d5a commit af8a0e0
Showing 1 changed file with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import UIKit
import CoreLocation
import BraintreeDataCollector
import BraintreeCore

class BraintreeDemoBTDataCollectorViewController: BraintreeDemoPaymentButtonBaseViewController {

let locationManager = CLLocationManager()
var dataLabel = UILabel()

override func viewDidLoad() {
super.viewDidLoad()
title = "Braintree Data Collector"
createLocationPermissionButton()
}

override func createPaymentButton() -> UIView! {
Expand Down Expand Up @@ -58,31 +55,4 @@ class BraintreeDemoBTDataCollectorViewController: BraintreeDemoPaymentButtonBase
self.progressBlock("Collected all device data!")
}
}

@objc func tappedRequestLocationAuthorization() {
let locationStatus = locationManager.authorizationStatus

switch locationStatus {
case .notDetermined:
locationManager.requestWhenInUseAuthorization()

default:
progressBlock("Location authorization requested previously. Update authorization in Settings app.")
}
}

private func createLocationPermissionButton() {
let obtainLocationPermissionButton = UIButton(type: .system)
obtainLocationPermissionButton.setTitle("Obtain Location Permission", for: .normal)
obtainLocationPermissionButton.setTitleColor(.blue, for: .normal)
obtainLocationPermissionButton.addTarget(self, action: #selector(tappedRequestLocationAuthorization), for: .touchUpInside)
obtainLocationPermissionButton.translatesAutoresizingMaskIntoConstraints = false

view.addSubview(obtainLocationPermissionButton)

NSLayoutConstraint.activate([
obtainLocationPermissionButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -10),
obtainLocationPermissionButton.centerXAnchor.constraint(equalTo: view.centerXAnchor)
])
}
}

0 comments on commit af8a0e0

Please sign in to comment.