Skip to content

Commit

Permalink
Disable arkit button for non-compatible devices
Browse files Browse the repository at this point in the history
  • Loading branch information
dantheli committed Feb 22, 2018
1 parent 0f05476 commit 076b844
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Eatery Watch App Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
2 changes: 1 addition & 1 deletion Eatery Watch App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
5 changes: 5 additions & 0 deletions Eatery/Controllers/ARViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import UIKit
import ARCL
import ARKit
import SceneKit
import CoreLocation
import DiningStack
Expand All @@ -21,6 +22,10 @@ class ARViewController: UIViewController, CLLocationManagerDelegate, SceneLocati
case none
}

static func isSupported() -> Bool {
return ARWorldTrackingConfiguration.isSupported
}

override func viewDidLoad() {
super.viewDidLoad()

Expand Down
7 changes: 5 additions & 2 deletions Eatery/Controllers/EateriesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class EateriesViewController: UIViewController, MenuButtonsDelegate, CLLocationM

let mapButton = UIBarButtonItem(image: #imageLiteral(resourceName: "mapIcon"), style: .done, target: self, action: #selector(mapButtonPressed))
mapButton.imageInsets = UIEdgeInsets(top: 0.0, left: 8.0, bottom: 4.0, right: 8.0)
navigationItem.rightBarButtonItems = [mapButton]

if #available(iOS 11.0, *) {
navigationController?.navigationBar.prefersLargeTitles = true
Expand All @@ -86,8 +87,10 @@ class EateriesViewController: UIViewController, MenuButtonsDelegate, CLLocationM

self.appDevLogo = logo

let arButton = UIBarButtonItem(title: "AR", style: .done, target: self, action: #selector(arButtonPressed))
navigationItem.rightBarButtonItems = [mapButton, UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil), arButton]
if ARViewController.isSupported() {
let arButton = UIBarButtonItem(title: "AR", style: .done, target: self, action: #selector(arButtonPressed))
navigationItem.rightBarButtonItems?.append(contentsOf: [UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil), arButton])
}
} else {
navigationItem.rightBarButtonItems = [mapButton]
}
Expand Down
2 changes: 1 addition & 1 deletion Eatery/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down

0 comments on commit 076b844

Please sign in to comment.