Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ios 13 UX tweaks #1699

Merged
merged 4 commits into from
Jan 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Provenance/Emulator/PVEmulatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,14 @@ extension NSNumber {

extension GCController {
func setupPauseHandler(onPause: @escaping () -> Void) {
// Use buttonHome for iOS/tvOS14 and later
if let buttonHome = buttonHome {
buttonHome.pressedChangedHandler = { _, _, isPressed in
if isPressed {
onPause()
}
}
}
// Using buttonMenu is the recommended way for iOS/tvOS13 and later
if let buttonMenu = buttonMenu {
buttonMenu.pressedChangedHandler = { _, _, isPressed in
Expand All @@ -887,7 +895,8 @@ extension GCController {
}
} else {
// Fallback to the old method
controllerPausedHandler = { _ in onPause()
controllerPausedHandler = { _ in
onPause()
}
}
}
Expand All @@ -902,4 +911,11 @@ extension GCController {
}
return nil
}

private var buttonHome: GCControllerButtonInput? {
if #available(iOS 14.0, tvOS 14.0, *) {
return extendedGamepad?.buttonHome
}
return nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ open class QuickTableViewController: UIViewController, UITableViewDataSource, UI
open var clearsSelectionOnViewWillAppear = true

/// Returns the table view managed by the controller object.
open var tableView: UITableView = UITableView(frame: .zero, style: .grouped)
#if os(iOS) || os(macOS)
open var tableView: UITableView = {
if #available(iOS 13.0, *) {
return UITableView(frame: .zero, style: .insetGrouped)
} else {
return UITableView(frame: .zero, style: .grouped)
}
}()
#else
open var tableView: UITableView = UITableView(frame: .zero, style: .grouped)
#endif

/// The layout of sections and rows to display in the table view.
open var tableContents: [Section] = [] {
Expand Down
2 changes: 2 additions & 0 deletions Provenance/Provenance-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@
</array>
<key>UISupportsDocumentBrowser</key>
<true/>
<key>UIUserInterfaceStyle</key>
<string>Dark</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
Expand Down