Displays Touch/Touch Screen instead of iPhone/iPad when using touch controls
This commit is contained in:
parent
ed5f0174d7
commit
066993db67
@ -188,6 +188,8 @@
|
||||
D54A4BB329E4D27E004C7D57 /* FeatureDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54A4BB229E4D27E004C7D57 /* FeatureDetailView.swift */; };
|
||||
D54F710229E89DCB009C069A /* SettingsUserInfoKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54F710129E89DCB009C069A /* SettingsUserInfoKey.swift */; };
|
||||
D54F710429E89DFC009C069A /* NotificationName+Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54F710329E89DFC009C069A /* NotificationName+Settings.swift */; };
|
||||
D55917D82B51CF7D007B7DC0 /* ProcessInfo+visionOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55917D72B51CF7D007B7DC0 /* ProcessInfo+visionOS.swift */; };
|
||||
D55917DA2B51D097007B7DC0 /* LocalDeviceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55917D92B51D097007B7DC0 /* LocalDeviceController.swift */; };
|
||||
D55C468F29E761C000EA6DE9 /* AnyFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55C468E29E761C000EA6DE9 /* AnyFeature.swift */; };
|
||||
D55C469129E7631000EA6DE9 /* AnyOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55C469029E7631000EA6DE9 /* AnyOption.swift */; };
|
||||
D560BD8629EDC45600289847 /* ExternalDisplaySceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D560BD8529EDC45600289847 /* ExternalDisplaySceneDelegate.swift */; };
|
||||
@ -462,6 +464,8 @@
|
||||
D54F710129E89DCB009C069A /* SettingsUserInfoKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsUserInfoKey.swift; sourceTree = "<group>"; };
|
||||
D54F710329E89DFC009C069A /* NotificationName+Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NotificationName+Settings.swift"; sourceTree = "<group>"; };
|
||||
D554C3822A58D89700E93359 /* Delta 7.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Delta 7.xcdatamodel"; sourceTree = "<group>"; };
|
||||
D55917D72B51CF7D007B7DC0 /* ProcessInfo+visionOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProcessInfo+visionOS.swift"; sourceTree = "<group>"; };
|
||||
D55917D92B51D097007B7DC0 /* LocalDeviceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalDeviceController.swift; sourceTree = "<group>"; };
|
||||
D55C468E29E761C000EA6DE9 /* AnyFeature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyFeature.swift; sourceTree = "<group>"; };
|
||||
D55C469029E7631000EA6DE9 /* AnyOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyOption.swift; sourceTree = "<group>"; };
|
||||
D560BD8529EDC45600289847 /* ExternalDisplaySceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalDisplaySceneDelegate.swift; sourceTree = "<group>"; };
|
||||
@ -571,6 +575,7 @@
|
||||
D5CDCCEA2A8593FC00E22131 /* UserDefaults+Delta.swift */,
|
||||
AC1AE30B2A6A068F00956EB9 /* Bundle+AppIconImage.swift */,
|
||||
D5D39E782AF2D624004BE3F7 /* GameView+AirPlay.swift */,
|
||||
D55917D72B51CF7D007B7DC0 /* ProcessInfo+visionOS.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
@ -581,6 +586,7 @@
|
||||
BF11734F1DA32CF600047DF8 /* ControllersSettingsViewController.swift */,
|
||||
BF616A121F08184A0077F8B2 /* ControllerInputsViewController.swift */,
|
||||
BF8DDD231F4F6C880088A21B /* InputCalloutView.swift */,
|
||||
D55917D92B51D097007B7DC0 /* LocalDeviceController.swift */,
|
||||
);
|
||||
path = Controllers;
|
||||
sourceTree = "<group>";
|
||||
@ -1553,6 +1559,7 @@
|
||||
BF59427C1E09BC830051894B /* Cheat.swift in Sources */,
|
||||
BFBAB2E31EB685A2004E0B0E /* DeltaCoreProtocol+Delta.swift in Sources */,
|
||||
D5CDCCF22A859E7500E22131 /* RepairDatabaseViewController.swift in Sources */,
|
||||
D55917D82B51CF7D007B7DC0 /* ProcessInfo+visionOS.swift in Sources */,
|
||||
BF3540081C5DAFAD00C1184C /* PauseTransitionCoordinator.swift in Sources */,
|
||||
BF525EEA1FF6CD12004AA849 /* DeepLink.swift in Sources */,
|
||||
AC1C991029F8B8C30020E6E4 /* ToastNotificationOptions.swift in Sources */,
|
||||
@ -1669,6 +1676,7 @@
|
||||
D56F7ABC2B05988700490ACB /* AttributedHeaderFooterView.swift in Sources */,
|
||||
BFAB9F7D219A43380080EC7D /* SyncManager.swift in Sources */,
|
||||
BFCEA67E1D56FF640061A534 /* UIViewControllerContextTransitioning+Conveniences.swift in Sources */,
|
||||
D55917DA2B51D097007B7DC0 /* LocalDeviceController.swift in Sources */,
|
||||
BF1173501DA32CF600047DF8 /* ControllersSettingsViewController.swift in Sources */,
|
||||
BFFC461E1D59823500AF2CC6 /* GamesPresentationController.swift in Sources */,
|
||||
BF99A5971DC2F9C400468E9E /* ControllerSkinTableViewCell.swift in Sources */,
|
||||
|
||||
25
Delta/Extensions/ProcessInfo+visionOS.swift
Normal file
25
Delta/Extensions/ProcessInfo+visionOS.swift
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// ProcessInfo+visionOS.swift
|
||||
// Delta
|
||||
//
|
||||
// Created by Riley Testut on 1/12/24.
|
||||
// Copyright © 2024 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import LocalAuthentication
|
||||
|
||||
extension ProcessInfo
|
||||
{
|
||||
var isRunningOnVisionPro: Bool {
|
||||
// Returns true even when running on iOS :/
|
||||
// guard #available(visionOS 1, *) else { return false }
|
||||
// return true
|
||||
|
||||
let context = LAContext()
|
||||
_ = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) // Sets .biometryType when called.
|
||||
|
||||
// Can't reference `.opticID` due to bug with #available, so check if .biometryType isn't one of the other types instead.
|
||||
return context.biometryType != .faceID && context.biometryType != .touchID && context.biometryType != .none
|
||||
}
|
||||
}
|
||||
@ -22,22 +22,6 @@ extension ControllersSettingsViewController
|
||||
}
|
||||
}
|
||||
|
||||
private class LocalDeviceController: NSObject, GameController
|
||||
{
|
||||
var name: String {
|
||||
return UIDevice.current.name
|
||||
}
|
||||
|
||||
var playerIndex: Int? {
|
||||
set { Settings.localControllerPlayerIndex = newValue }
|
||||
get { return Settings.localControllerPlayerIndex }
|
||||
}
|
||||
|
||||
let inputType: GameControllerInputType = .standard
|
||||
|
||||
var defaultInputMapping: GameControllerInputMappingProtocol?
|
||||
}
|
||||
|
||||
class ControllersSettingsViewController: UITableViewController
|
||||
{
|
||||
var playerIndex: Int! {
|
||||
|
||||
32
Delta/Settings/Controllers/LocalDeviceController.swift
Normal file
32
Delta/Settings/Controllers/LocalDeviceController.swift
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// LocalDeviceController.swift
|
||||
// Delta
|
||||
//
|
||||
// Created by Riley Testut on 1/12/24.
|
||||
// Copyright © 2024 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import DeltaCore
|
||||
|
||||
class LocalDeviceController: NSObject, GameController
|
||||
{
|
||||
var name: String {
|
||||
if ProcessInfo.processInfo.isRunningOnVisionPro
|
||||
{
|
||||
return NSLocalizedString("Touch", comment: "")
|
||||
}
|
||||
else
|
||||
{
|
||||
return NSLocalizedString("Touch Screen", comment: "")
|
||||
}
|
||||
}
|
||||
|
||||
var playerIndex: Int? {
|
||||
set { Settings.localControllerPlayerIndex = newValue }
|
||||
get { return Settings.localControllerPlayerIndex }
|
||||
}
|
||||
|
||||
let inputType: GameControllerInputType = .standard
|
||||
|
||||
var defaultInputMapping: GameControllerInputMappingProtocol?
|
||||
}
|
||||
@ -442,7 +442,7 @@ extension SettingsViewController
|
||||
case .controllers:
|
||||
if indexPath.row == Settings.localControllerPlayerIndex
|
||||
{
|
||||
cell.detailTextLabel?.text = UIDevice.current.name
|
||||
cell.detailTextLabel?.text = LocalDeviceController().name
|
||||
}
|
||||
else if let index = ExternalGameControllerManager.shared.connectedControllers.firstIndex(where: { $0.playerIndex == indexPath.row })
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user