Skip to content

Commit

Permalink
Scrolling issue corrected for Sierra
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsochantaris committed Oct 19, 2016
1 parent cb8a0b8 commit eba35ee
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 23 deletions.
9 changes: 5 additions & 4 deletions Shared/Globals.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

////////////////////// Global variables

#if os(iOS)

import UIKit
import CoreData

weak var app: iOS_AppDelegate!

Expand Down Expand Up @@ -30,12 +33,10 @@ typealias IMAGE_CLASS = NSImage

#endif

////////////////////// Global variables

var appIsRefreshing = false
var preferencesDirty = false
var lastRepoCheck = Date.distantPast
let autoSnoozeDate = Date.distantFuture.addingTimeInterval(-1)
let autoSnoozeSentinelDate = Date.distantFuture.addingTimeInterval(-1)
let stringDrawingOptions: NSStringDrawingOptions = [.usesLineFragmentOrigin, .usesFontLeading]
let LISTABLE_URI_KEY = "listableUriKey"
let COMMENT_ID_KEY = "commentIdKey"
Expand All @@ -44,7 +45,6 @@ let NOTIFICATION_URL_KEY = "urlKey"
////////////////////////// Utilities

#if os(iOS)
import CoreData

func showMessage(_ title: String, _ message: String?) {
var viewController = app.window?.rootViewController
Expand All @@ -56,6 +56,7 @@ func showMessage(_ title: String, _ message: String?) {
a.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
viewController?.present(a, animated: true, completion: nil)
}

#endif

func existingObject(with id: NSManagedObjectID) -> NSManagedObject? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand Down
4 changes: 2 additions & 2 deletions Trailer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.5.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1385</string>
<string>1387</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions Trailer/ListableItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class ListableItem: DataItem {
let d = TimeInterval(Settings.autoSnoozeDuration)
if d > 0 && !wasAwokenFromSnooze && updatedAt != .distantPast, let snoozeByDate = updatedAt?.addingTimeInterval(86400.0*d) {
if snoozeByDate < Date() {
snoozeUntil = autoSnoozeDate
snoozeUntil = autoSnoozeSentinelDate
return true
}
}
Expand All @@ -253,7 +253,7 @@ class ListableItem: DataItem {
}

final func wakeIfAutoSnoozed() {
if snoozeUntil == autoSnoozeDate {
if snoozeUntil == autoSnoozeSentinelDate {
snoozeUntil = nil
wasAwokenFromSnooze = false
snoozingPreset = nil
Expand Down
30 changes: 15 additions & 15 deletions Trailer/TrailerCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TrailerCell: NSTableCellView {

private let dataItemId: NSManagedObjectID!
private let isDark: Bool
private var trackingArea: NSTrackingArea!
private var trackingArea: NSTrackingArea?

init(frame frameRect: NSRect, item: ListableItem) {

Expand Down Expand Up @@ -123,7 +123,7 @@ class TrailerCell: NSTableCellView {

if let snooze = item.snoozeUntil {
let title: String
if snooze == .distantFuture || snooze == autoSnoozeDate {
if snooze == .distantFuture || snooze == autoSnoozeSentinelDate {
title = String(format: "Wake")
} else {
title = String(format: "Wake (auto: %@)", itemDateFormatter.string(from: snooze))
Expand Down Expand Up @@ -220,21 +220,21 @@ class TrailerCell: NSTableCellView {
}

override func updateTrackingAreas() {
if trackingArea != nil { removeTrackingArea(trackingArea) }

trackingArea = NSTrackingArea(rect: bounds,
options: [.mouseEnteredAndExited, .activeInKeyWindow],
owner: self,
userInfo: nil)

addTrackingArea(trackingArea)
if let t = trackingArea {
removeTrackingArea(t)
}

let mouseLocation = convert(window?.mouseLocationOutsideOfEventStream ?? NSZeroPoint, from: nil)
let t = NSTrackingArea(rect: bounds, options: [.mouseEnteredAndExited, .activeInKeyWindow], owner: self, userInfo: nil)
addTrackingArea(t)
trackingArea = t

if NSPointInRect(mouseLocation, bounds) {
mouseEntered(with: nil)
} else if !selected {
mouseExited(with: nil)
if let mouseLocation = window?.mouseLocationOutsideOfEventStream {
let localLocation = convert(mouseLocation, to: self)
if NSPointInRect(localLocation, bounds) && !selected {
mouseEntered(with: nil)
} else if selected {
mouseExited(with: nil)
}
}
}

Expand Down

0 comments on commit eba35ee

Please sign in to comment.