Review nits

This commit is contained in:
Florent Vilmart
2018-08-20 08:35:18 -04:00
parent ce61d554fc
commit 6390237082
3 changed files with 16 additions and 18 deletions

View File

@@ -95,7 +95,7 @@ final class RootNavigationManager: GitHubSessionListener {
let issues = IssuesViewController(client: client, model: issue, scrollToBottom: true)
issues.addMenuDoneButton(left: true)
let nav = UINavigationController(rootViewController: issues)
tabBarController?.present(nav, animated: true, completion: nil)
tabBarController?.present(nav, animated: trueUnlessReduceMotionEnabled, completion: nil)
}
@discardableResult

View File

@@ -11,20 +11,16 @@ import UIKit
extension UIViewController {
func addMenuDoneButton(left: Bool = false) {
let buttonItem = UIBarButtonItem(
barButtonSystemItem: .done,
target: self,
action: #selector(onMenuDone)
)
buttonItem.tintColor = Styles.Colors.Gray.light.color
if left {
navigationItem.leftBarButtonItem = UIBarButtonItem(
barButtonSystemItem: .done,
target: self,
action: #selector(onMenuDone)
)
navigationItem.leftBarButtonItem?.tintColor = Styles.Colors.Gray.light.color
navigationItem.leftBarButtonItem = buttonItem
} else {
navigationItem.rightBarButtonItem = UIBarButtonItem(
barButtonSystemItem: .done,
target: self,
action: #selector(onMenuDone)
)
navigationItem.rightBarButtonItem?.tintColor = Styles.Colors.Gray.light.color
navigationItem.rightBarButtonItem = buttonItem
}
}

View File

@@ -9,13 +9,15 @@
import UIKit
import MobileCoreServices
class ActionRequestHandler: NSObject, NSExtensionRequestHandling {
private let stringUTTypePropertyList = String(kUTTypePropertyList)
final class ActionRequestHandler: NSObject, NSExtensionRequestHandling {
var extensionContext: NSExtensionContext?
func beginRequest(with context: NSExtensionContext) {
// Do not call super in an Action extension with no user interface
self.extensionContext = context
extensionContext = context
var found = false
// Find the item containing the results from the JavaScript preprocessing.
@@ -23,8 +25,8 @@ class ActionRequestHandler: NSObject, NSExtensionRequestHandling {
for item in context.inputItems as! [NSExtensionItem] {
if let attachments = item.attachments {
for itemProvider in attachments as! [NSItemProvider] {
if itemProvider.hasItemConformingToTypeIdentifier(String(kUTTypePropertyList)) {
itemProvider.loadItem(forTypeIdentifier: String(kUTTypePropertyList), options: nil, completionHandler: { (item, error) in
if itemProvider.hasItemConformingToTypeIdentifier(stringUTTypePropertyList) {
itemProvider.loadItem(forTypeIdentifier: stringUTTypePropertyList, options: nil, completionHandler: { (item, error) in
let dictionary = item as! [String: Any]
OperationQueue.main.addOperation {
self.itemLoadCompletedWithPreprocessingResults(dictionary[NSExtensionJavaScriptPreprocessingResultsKey] as! [String: Any]? ?? [:])
@@ -54,7 +56,7 @@ class ActionRequestHandler: NSObject, NSExtensionRequestHandling {
let host = url.host,
host.contains("github.com") else {
self.doneWithResults(["error": "Unable to open on GitHawk"])
self.doneWithResults(["error": NSLocalizedString("Unable to open in GitHawk", comment: "")])
return
}