diff --git a/PocketTrailer Today Extension/Info.plist b/PocketTrailer Today Extension/Info.plist
index 51f20dd9..453948de 100644
--- a/PocketTrailer Today Extension/Info.plist
+++ b/PocketTrailer Today Extension/Info.plist
@@ -17,11 +17,11 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 1.6.10
+ 1.6.11
CFBundleSignature
????
CFBundleVersion
- 1476
+ 1477
NSExtension
NSExtensionMainStoryboard
diff --git a/PocketTrailer Today Extension/TodayViewController.swift b/PocketTrailer Today Extension/TodayViewController.swift
index 0b85f602..75aa0078 100644
--- a/PocketTrailer Today Extension/TodayViewController.swift
+++ b/PocketTrailer Today Extension/TodayViewController.swift
@@ -11,42 +11,42 @@ final class TodayViewController: UIViewController, NCWidgetProviding {
@IBOutlet private weak var prImage: UIImageView!
@IBOutlet private weak var issueImage: UIImageView!
- private var linkButton = UIButton(type: UIButtonType.custom)
+ private var linkButton = UIButton(type: .custom)
private let paragraph = NSMutableParagraphStyle()
- private var titleAttributes: [NSAttributedStringKey : Any] {
+ private var titleAttributes: [NSAttributedString.Key : Any] {
return [
- NSAttributedStringKey.foregroundColor: UIColor.black,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
- NSAttributedStringKey.paragraphStyle: paragraph ]
+ NSAttributedString.Key.foregroundColor: UIColor.black,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
+ NSAttributedString.Key.paragraphStyle: paragraph ]
}
- private var normalAttributes: [NSAttributedStringKey : Any] {
+ private var normalAttributes: [NSAttributedString.Key : Any] {
return [
- NSAttributedStringKey.foregroundColor: UIColor.darkGray,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
- NSAttributedStringKey.paragraphStyle: paragraph ]
+ NSAttributedString.Key.foregroundColor: UIColor.darkGray,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
+ NSAttributedString.Key.paragraphStyle: paragraph ]
}
- private var dimAttributes: [NSAttributedStringKey : Any] {
+ private var dimAttributes: [NSAttributedString.Key : Any] {
return [
- NSAttributedStringKey.foregroundColor: UIColor.gray,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
- NSAttributedStringKey.paragraphStyle: paragraph ]
+ NSAttributedString.Key.foregroundColor: UIColor.gray,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
+ NSAttributedString.Key.paragraphStyle: paragraph ]
}
- private var redAttributes: [NSAttributedStringKey : Any] {
+ private var redAttributes: [NSAttributedString.Key : Any] {
return [
- NSAttributedStringKey.foregroundColor: UIColor.red,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
- NSAttributedStringKey.paragraphStyle: paragraph ]
+ NSAttributedString.Key.foregroundColor: UIColor.red,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.systemFontSize+2.0),
+ NSAttributedString.Key.paragraphStyle: paragraph ]
}
- private var smallAttributes: [NSAttributedStringKey : Any] {
+ private var smallAttributes: [NSAttributedString.Key : Any] {
return [
- NSAttributedStringKey.foregroundColor: UIColor.gray,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
- NSAttributedStringKey.paragraphStyle: paragraph ]
+ NSAttributedString.Key.foregroundColor: UIColor.gray,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
+ NSAttributedString.Key.paragraphStyle: paragraph ]
}
override func viewDidLoad() {
diff --git a/PocketTrailer WatchKit App/Base.lproj/Interface.storyboard b/PocketTrailer WatchKit App/Base.lproj/Interface.storyboard
index 29d9f9fe..02b03cef 100644
--- a/PocketTrailer WatchKit App/Base.lproj/Interface.storyboard
+++ b/PocketTrailer WatchKit App/Base.lproj/Interface.storyboard
@@ -1,27 +1,27 @@
-
+
-
-
+
+
-
+
-
+
-
+
@@ -168,7 +168,7 @@
-
+
@@ -189,23 +189,17 @@
-
+
@@ -213,7 +207,7 @@
-
+
@@ -263,14 +257,14 @@
-
+
-
+
@@ -356,14 +350,14 @@
-
+
-
+
@@ -380,7 +374,7 @@
-
+
-
+
diff --git a/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/Contents.json b/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/Contents.json
index 913692d4..6d607473 100644
--- a/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/Contents.json
+++ b/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -43,8 +43,16 @@
"idiom" : "watch",
"filename" : "TrailerWatch44@2x.png",
"scale" : "2x",
- "role" : "longLook",
- "subtype" : "42mm"
+ "role" : "appLauncher",
+ "subtype" : "40mm"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "watch",
+ "filename" : "watch100.png",
+ "scale" : "2x",
+ "role" : "appLauncher",
+ "subtype" : "44mm"
},
{
"size" : "86x86",
@@ -62,6 +70,14 @@
"role" : "quickLook",
"subtype" : "42mm"
},
+ {
+ "size" : "108x108",
+ "idiom" : "watch",
+ "filename" : "watch216.png",
+ "scale" : "2x",
+ "role" : "quickLook",
+ "subtype" : "44mm"
+ },
{
"size" : "1024x1024",
"idiom" : "watch-marketing",
diff --git a/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/watch100.png b/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/watch100.png
new file mode 100644
index 00000000..dacbf0c3
Binary files /dev/null and b/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/watch100.png differ
diff --git a/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/watch216.png b/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/watch216.png
new file mode 100644
index 00000000..fe3795f4
Binary files /dev/null and b/PocketTrailer WatchKit App/Images.xcassets/AppIcon.appiconset/watch216.png differ
diff --git a/PocketTrailer WatchKit App/Images.xcassets/Contents.json b/PocketTrailer WatchKit App/Images.xcassets/Contents.json
new file mode 100644
index 00000000..da4a164c
--- /dev/null
+++ b/PocketTrailer WatchKit App/Images.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/PocketTrailer WatchKit App/Images.xcassets/GlanceIssues.imageset/Contents.json b/PocketTrailer WatchKit App/Images.xcassets/GlanceIssues.imageset/Contents.json
index 81baaf76..e38274d1 100644
--- a/PocketTrailer WatchKit App/Images.xcassets/GlanceIssues.imageset/Contents.json
+++ b/PocketTrailer WatchKit App/Images.xcassets/GlanceIssues.imageset/Contents.json
@@ -4,16 +4,6 @@
"idiom" : "watch",
"filename" : "GlanceIssues.png",
"scale" : "2x"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : "<=145"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : ">145"
}
],
"info" : {
diff --git a/PocketTrailer WatchKit App/Images.xcassets/GlancePrs.imageset/Contents.json b/PocketTrailer WatchKit App/Images.xcassets/GlancePrs.imageset/Contents.json
index 2118e140..ea9187b9 100644
--- a/PocketTrailer WatchKit App/Images.xcassets/GlancePrs.imageset/Contents.json
+++ b/PocketTrailer WatchKit App/Images.xcassets/GlancePrs.imageset/Contents.json
@@ -4,16 +4,6 @@
"idiom" : "watch",
"filename" : "GlacePrs.png",
"scale" : "2x"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : "<=145"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : ">145"
}
],
"info" : {
diff --git a/PocketTrailer WatchKit App/Info.plist b/PocketTrailer WatchKit App/Info.plist
index e721c43b..5eaea4f2 100644
--- a/PocketTrailer WatchKit App/Info.plist
+++ b/PocketTrailer WatchKit App/Info.plist
@@ -17,11 +17,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.6.10
+ 1.6.11
CFBundleSignature
????
CFBundleVersion
- 1476
+ 1477
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
diff --git a/PocketTrailer WatchKit Extension/ComplicationDataSource.swift b/PocketTrailer WatchKit Extension/ComplicationDataSource.swift
index 1875be73..4914669c 100644
--- a/PocketTrailer WatchKit Extension/ComplicationDataSource.swift
+++ b/PocketTrailer WatchKit Extension/ComplicationDataSource.swift
@@ -82,6 +82,7 @@ final class ComplicationDataSource: NSObject, CLKComplicationDataSource {
t.line1ImageProvider = CLKImageProvider(onePieceImage: UIImage(named: issues ? "ComplicationIssues" : "ComplicationPrs")!)
t.line2TextProvider = CLKSimpleTextProvider(text: count(issues ? issueCount : prCount, unit: nil))
return t
+
case .modularLarge:
let t = CLKComplicationTemplateModularLargeStandardBody()
t.headerImageProvider = CLKImageProvider(onePieceImage: UIImage(named: "ComplicationPrs")!)
@@ -89,6 +90,7 @@ final class ComplicationDataSource: NSObject, CLKComplicationDataSource {
t.body1TextProvider = CLKSimpleTextProvider(text: count(prCount, unit: "Pull Request"))
t.body2TextProvider = CLKSimpleTextProvider(text: count(issueCount, unit: "Issue"))
return t
+
case .extraLarge:
let t = CLKComplicationTemplateExtraLargeColumnsText()
t.row1Column2TextProvider = CLKSimpleTextProvider(text: "\(issues ? (issueCount ?? 0) : (prCount ?? 0))")
@@ -98,28 +100,100 @@ final class ComplicationDataSource: NSObject, CLKComplicationDataSource {
t.column2Alignment = .trailing
t.highlightColumn2 = commentCount > 0
return t
+
case .utilitarianSmallFlat, .utilitarianSmall:
let t = CLKComplicationTemplateUtilitarianSmallFlat()
t.imageProvider = CLKImageProvider(onePieceImage: UIImage(named: issues ? "ComplicationIssues" : "ComplicationPrs")!)
t.textProvider = CLKSimpleTextProvider(text: count(issues ? issueCount : prCount, unit: nil))
return t
+
case .utilitarianLarge:
let t = CLKComplicationTemplateUtilitarianLargeFlat()
if commentCount > 0 {
t.textProvider = CLKSimpleTextProvider(text: count(commentCount, unit: "New Comment"))
} else if issues {
- t.imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "ComplicationIssues")!)
t.textProvider = CLKSimpleTextProvider(text: count(issueCount, unit: "Issue"))
} else {
- t.imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "ComplicationPrs")!)
t.textProvider = CLKSimpleTextProvider(text: count(prCount, unit: "Pull Request"))
}
return t
+
case .circularSmall:
let t = CLKComplicationTemplateCircularSmallStackImage()
t.line1ImageProvider = CLKImageProvider(onePieceImage: UIImage(named: issues ? "ComplicationIssues" : "ComplicationPrs")!)
t.line2TextProvider = CLKSimpleTextProvider(text: count(issues ? issueCount : prCount, unit: nil))
return t
+
+ case .graphicCorner:
+ if #available(watchOSApplicationExtension 5.0, *) {
+ let t = CLKComplicationTemplateGraphicCornerTextImage()
+ t.imageProvider = CLKFullColorImageProvider(fullColorImage: UIImage(named: issues ? "IssuesCorner" : "PrsCorner")!)
+ if commentCount > 0 {
+ t.textProvider = CLKSimpleTextProvider(text: count(commentCount, unit: "Comment"))
+ t.textProvider.tintColor = .red
+ } else if issues {
+ t.textProvider = CLKSimpleTextProvider(text: count(issueCount, unit: "Issue"))
+ } else {
+ t.textProvider = CLKSimpleTextProvider(text: count(prCount, unit: "PR"))
+ }
+ return t
+ } else {
+ abort()
+ }
+
+ case .graphicBezel:
+ if #available(watchOSApplicationExtension 5.0, *) {
+ let t = CLKComplicationTemplateGraphicBezelCircularText()
+ let img = CLKComplicationTemplateGraphicCircularImage()
+ img.imageProvider = CLKFullColorImageProvider(fullColorImage: UIImage(named: issues ? "ComplicationIssues" : "ComplicationPrs")!)
+ if commentCount > 0 {
+ t.textProvider = CLKSimpleTextProvider(text: count(commentCount, unit: "New Comment"))
+ } else if issues {
+ t.textProvider = CLKSimpleTextProvider(text: count(issueCount, unit: "Issue"))
+ } else {
+ t.textProvider = CLKSimpleTextProvider(text: count(prCount, unit: "Pull Request"))
+ }
+ t.circularTemplate = img
+ return t
+ } else {
+ abort()
+ }
+
+ case .graphicCircular:
+ if #available(watchOSApplicationExtension 5.0, *) {
+ let t = CLKComplicationTemplateGraphicCircularClosedGaugeText()
+ var fill = false
+ if commentCount > 0 {
+ fill = true
+ t.centerTextProvider = CLKSimpleTextProvider(text: String(commentCount))
+ t.centerTextProvider.tintColor = .red
+ } else if issues {
+ t.centerTextProvider = CLKSimpleTextProvider(text: String(issueCount ?? 0))
+ } else {
+ t.centerTextProvider = CLKSimpleTextProvider(text: String(prCount ?? 0))
+ }
+ if fill {
+ t.gaugeProvider = CLKSimpleGaugeProvider(style: .fill, gaugeColor: .red, fillFraction: 1)
+ } else {
+ t.gaugeProvider = CLKSimpleGaugeProvider(style: .fill, gaugeColor: .white, fillFraction: 0)
+ }
+ return t
+ } else {
+ abort()
+ }
+
+ case .graphicRectangular:
+ if #available(watchOSApplicationExtension 5.0, *) {
+ let t = CLKComplicationTemplateGraphicRectangularStandardBody()
+ t.headerImageProvider = CLKFullColorImageProvider(fullColorImage: UIImage(named: "ComplicationPrs")!)
+ t.headerTextProvider = CLKSimpleTextProvider(text: count(commentCount, unit: "Comment"))
+ t.headerTextProvider.tintColor = commentCount > 0 ? .red : .white
+ t.body1TextProvider = CLKSimpleTextProvider(text: count(prCount, unit: "Pull Request"))
+ t.body2TextProvider = CLKSimpleTextProvider(text: count(issueCount, unit: "Issue"))
+ return t
+ } else {
+ abort()
+ }
}
}
}
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/Contents.json b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/Contents.json
index 81baaf76..e38274d1 100644
--- a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/Contents.json
+++ b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/Contents.json
@@ -4,16 +4,6 @@
"idiom" : "watch",
"filename" : "GlanceIssues.png",
"scale" : "2x"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : "<=145"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : ">145"
}
],
"info" : {
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/GlanceIssues.png b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/GlanceIssues.png
index 12937df7..d117c590 100644
Binary files a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/GlanceIssues.png and b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationIssues.imageset/GlanceIssues.png differ
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/Contents.json b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/Contents.json
index 2118e140..ea9187b9 100644
--- a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/Contents.json
+++ b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/Contents.json
@@ -4,16 +4,6 @@
"idiom" : "watch",
"filename" : "GlacePrs.png",
"scale" : "2x"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : "<=145"
- },
- {
- "idiom" : "watch",
- "scale" : "2x",
- "screen-width" : ">145"
}
],
"info" : {
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/GlacePrs.png b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/GlacePrs.png
index 7a36a070..f0f4eb3c 100644
Binary files a/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/GlacePrs.png and b/PocketTrailer WatchKit Extension/Images.xcassets/ComplicationPrs.imageset/GlacePrs.png differ
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/IssuesCorner.imageset/Contents.json b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesCorner.imageset/Contents.json
new file mode 100644
index 00000000..c7800182
--- /dev/null
+++ b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesCorner.imageset/Contents.json
@@ -0,0 +1,13 @@
+{
+ "images" : [
+ {
+ "idiom" : "watch",
+ "filename" : "IssuesCorner.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/IssuesCorner.imageset/IssuesCorner.png b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesCorner.imageset/IssuesCorner.png
new file mode 100644
index 00000000..e346f653
Binary files /dev/null and b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesCorner.imageset/IssuesCorner.png differ
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/IssuesSmall.imageset/Contents.json b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesSmall.imageset/Contents.json
new file mode 100644
index 00000000..0a0540c1
--- /dev/null
+++ b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesSmall.imageset/Contents.json
@@ -0,0 +1,13 @@
+{
+ "images" : [
+ {
+ "idiom" : "watch",
+ "filename" : "IssuesSmall.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/IssuesSmall.imageset/IssuesSmall.png b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesSmall.imageset/IssuesSmall.png
new file mode 100644
index 00000000..f94becac
Binary files /dev/null and b/PocketTrailer WatchKit Extension/Images.xcassets/IssuesSmall.imageset/IssuesSmall.png differ
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/PrsCorner.imageset/Contents.json b/PocketTrailer WatchKit Extension/Images.xcassets/PrsCorner.imageset/Contents.json
new file mode 100644
index 00000000..1c855def
--- /dev/null
+++ b/PocketTrailer WatchKit Extension/Images.xcassets/PrsCorner.imageset/Contents.json
@@ -0,0 +1,13 @@
+{
+ "images" : [
+ {
+ "idiom" : "watch",
+ "filename" : "PrsCorner.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/PrsCorner.imageset/PrsCorner.png b/PocketTrailer WatchKit Extension/Images.xcassets/PrsCorner.imageset/PrsCorner.png
new file mode 100644
index 00000000..8095d558
Binary files /dev/null and b/PocketTrailer WatchKit Extension/Images.xcassets/PrsCorner.imageset/PrsCorner.png differ
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/PrsSmall.imageset/Contents.json b/PocketTrailer WatchKit Extension/Images.xcassets/PrsSmall.imageset/Contents.json
new file mode 100644
index 00000000..0736d5eb
--- /dev/null
+++ b/PocketTrailer WatchKit Extension/Images.xcassets/PrsSmall.imageset/Contents.json
@@ -0,0 +1,13 @@
+{
+ "images" : [
+ {
+ "idiom" : "watch",
+ "filename" : "PrsSmall.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/PocketTrailer WatchKit Extension/Images.xcassets/PrsSmall.imageset/PrsSmall.png b/PocketTrailer WatchKit Extension/Images.xcassets/PrsSmall.imageset/PrsSmall.png
new file mode 100644
index 00000000..1df42ced
Binary files /dev/null and b/PocketTrailer WatchKit Extension/Images.xcassets/PrsSmall.imageset/PrsSmall.png differ
diff --git a/PocketTrailer WatchKit Extension/Info.plist b/PocketTrailer WatchKit Extension/Info.plist
index 815dfdf7..d33e1502 100644
--- a/PocketTrailer WatchKit Extension/Info.plist
+++ b/PocketTrailer WatchKit Extension/Info.plist
@@ -17,22 +17,26 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 1.6.10
+ 1.6.11
CFBundleSignature
????
CFBundleVersion
- 1476
+ 1477
CLKComplicationPrincipalClass
$(PRODUCT_MODULE_NAME).ComplicationDataSource
CLKComplicationSupportedFamilies
- CLKComplicationFamilyModularSmall
+ CLKComplicationFamilyCircularSmall
+ CLKComplicationFamilyExtraLarge
+ CLKComplicationFamilyGraphicBezel
+ CLKComplicationFamilyGraphicCircular
+ CLKComplicationFamilyGraphicCorner
+ CLKComplicationFamilyGraphicRectangular
CLKComplicationFamilyModularLarge
- CLKComplicationFamilyUtilitarianSmall
+ CLKComplicationFamilyModularSmall
CLKComplicationFamilyUtilitarianLarge
- CLKComplicationFamilyCircularSmall
+ CLKComplicationFamilyUtilitarianSmall
CLKComplicationFamilyUtilitarianSmallFlat
- CLKComplicationFamilyExtraLarge
NSExtension
diff --git a/PocketTrailer WatchKit Extension/PRDetailController.swift b/PocketTrailer WatchKit Extension/PRDetailController.swift
index 885950c3..e29769d9 100644
--- a/PocketTrailer WatchKit Extension/PRDetailController.swift
+++ b/PocketTrailer WatchKit Extension/PRDetailController.swift
@@ -16,7 +16,7 @@ final class PRDetailController: CommonController {
_table = table
let c = context as! [AnyHashable : Any]
- itemId = c[ITEM_KEY] as! String
+ itemId = (c[ITEM_KEY] as! String)
super.awake(withContext: context)
}
diff --git a/PocketTrailer WatchKit Extension/PRListController.swift b/PocketTrailer WatchKit Extension/PRListController.swift
index ca2b2b6b..a6699055 100644
--- a/PocketTrailer WatchKit Extension/PRListController.swift
+++ b/PocketTrailer WatchKit Extension/PRListController.swift
@@ -25,9 +25,9 @@ final class PRListController: CommonController {
override func awake(withContext context: Any?) {
let c = context as! [AnyHashable : Any]
- sectionIndex = c[SECTION_KEY] as! Int64
- type = c[TYPE_KEY] as! String
- onlyUnread = c[UNREAD_KEY] as! Bool
+ sectionIndex = (c[SECTION_KEY] as! Int64)
+ type = (c[TYPE_KEY] as! String)
+ onlyUnread = (c[UNREAD_KEY] as! Bool)
let g = c[GROUP_KEY] as! String
groupLabel = g
diff --git a/PocketTrailer/AboutTrailerViewController.swift b/PocketTrailer/AboutTrailerViewController.swift
index 1627cf68..576bb680 100644
--- a/PocketTrailer/AboutTrailerViewController.swift
+++ b/PocketTrailer/AboutTrailerViewController.swift
@@ -14,7 +14,7 @@ final class AboutTrailerViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
licenseText.contentOffset = CGPoint.zero
- licenseText.textContainerInset = UIEdgeInsetsMake(0, 10, 10, 10)
+ licenseText.textContainerInset = UIEdgeInsets(top: 0, left: 10, bottom: 10, right: 10)
}
@IBAction private func linkSelected() {
diff --git a/PocketTrailer/AdvancedSettingsViewController.swift b/PocketTrailer/AdvancedSettingsViewController.swift
index ece94f3b..9e5d955d 100644
--- a/PocketTrailer/AdvancedSettingsViewController.swift
+++ b/PocketTrailer/AdvancedSettingsViewController.swift
@@ -342,7 +342,7 @@ final class AdvancedSettingsViewController: UITableViewController, PickerViewCon
override func viewDidLoad() {
super.viewDidLoad()
- tableView.rowHeight = UITableViewAutomaticDimension
+ tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 120
let searchController = UISearchController(searchResultsController: nil)
@@ -409,9 +409,9 @@ final class AdvancedSettingsViewController: UITableViewController, PickerViewCon
l.attributedText = NSAttributedString(
string: message,
attributes: [
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
- NSAttributedStringKey.foregroundColor: UIColor.lightGray,
- NSAttributedStringKey.paragraphStyle: p,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
+ NSAttributedString.Key.foregroundColor: UIColor.lightGray,
+ NSAttributedString.Key.paragraphStyle: p,
])
l.numberOfLines = 0
return l
diff --git a/PocketTrailer/CommentBlacklistViewController.swift b/PocketTrailer/CommentBlacklistViewController.swift
index d9a21f44..f937c535 100644
--- a/PocketTrailer/CommentBlacklistViewController.swift
+++ b/PocketTrailer/CommentBlacklistViewController.swift
@@ -26,7 +26,7 @@ final class CommentBlacklistViewController: UITableViewController {
return cell
}
- override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
+ override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
var blackList = Settings.commentAuthorBlacklist
blackList.remove(at: indexPath.row)
diff --git a/PocketTrailer/CustomReposViewController.swift b/PocketTrailer/CustomReposViewController.swift
index 49f2d16e..82bdc723 100644
--- a/PocketTrailer/CustomReposViewController.swift
+++ b/PocketTrailer/CustomReposViewController.swift
@@ -15,7 +15,7 @@ final class CustomReposViewController: UIViewController, UITableViewDelegate, UI
super.viewDidLoad()
navigationItem.largeTitleDisplayMode = .automatic
- sizer = table.dequeueReusableCell(withIdentifier: "CustomRepoCellId") as! CustomRepoCell
+ sizer = table.dequeueReusableCell(withIdentifier: "CustomRepoCellId") as? CustomRepoCell
NotificationCenter.default.addObserver(self, selector: #selector(updateRepos), name: RefreshEndedNotification, object: nil)
}
@@ -38,11 +38,11 @@ final class CustomReposViewController: UIViewController, UITableViewDelegate, UI
return repos.count
}
- func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
+ func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
return .delete
}
- func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
+ func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
let r = repos[indexPath.row]
DataManager.main.delete(r)
DataManager.saveDB()
@@ -106,7 +106,7 @@ final class CustomReposViewController: UIViewController, UITableViewDelegate, UI
return
}
- let a = UIActivityIndicatorView(activityIndicatorStyle: .gray)
+ let a = UIActivityIndicatorView(style: .gray)
a.startAnimating()
addButton.customView = a
diff --git a/PocketTrailer/DetailViewController.swift b/PocketTrailer/DetailViewController.swift
index 43eb675d..cdafb850 100644
--- a/PocketTrailer/DetailViewController.swift
+++ b/PocketTrailer/DetailViewController.swift
@@ -107,7 +107,7 @@ final class DetailViewController: UIViewController, WKNavigationDelegate {
}
override var keyCommands: [UIKeyCommand]? {
- let ff = UIKeyCommand(input: UIKeyInputLeftArrow, modifierFlags: .command, action: #selector(focusOnMaster), discoverabilityTitle: "Focus keyboard on item list")
+ let ff = UIKeyCommand(input: UIKeyCommand.inputLeftArrow, modifierFlags: .command, action: #selector(focusOnMaster), discoverabilityTitle: "Focus keyboard on item list")
let s = UIKeyCommand(input: "o", modifierFlags: .command, action: #selector(keyOpenInSafari), discoverabilityTitle: "Open in Safari")
return [ff,s]
}
diff --git a/PocketTrailer/Info.plist b/PocketTrailer/Info.plist
index c0994106..2e470e83 100644
--- a/PocketTrailer/Info.plist
+++ b/PocketTrailer/Info.plist
@@ -39,7 +39,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.6.10
+ 1.6.11
CFBundleSignature
????
CFBundleURLTypes
@@ -54,7 +54,7 @@
CFBundleVersion
- 1476
+ 1477
CoreSpotlightContinuation
ITSAppUsesNonExemptEncryption
@@ -135,6 +135,8 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
+ LSSupportsOpeningDocumentsInPlace
+
UTExportedTypeDeclarations
diff --git a/PocketTrailer/MasterViewController.swift b/PocketTrailer/MasterViewController.swift
index 8283692f..721c1741 100644
--- a/PocketTrailer/MasterViewController.swift
+++ b/PocketTrailer/MasterViewController.swift
@@ -177,7 +177,7 @@ UITableViewDragDelegate {
refreshControl?.addTarget(self, action: #selector(refreshControlChanged(_:)), for: .valueChanged)
- tableView.rowHeight = UITableViewAutomaticDimension
+ tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 160
tableView.register(UINib(nibName: "SectionHeaderView", bundle: nil), forHeaderFooterViewReuseIdentifier: "SectionHeaderView")
clearsSelectionOnViewWillAppear = false
@@ -281,12 +281,12 @@ UITableViewDragDelegate {
let nt = UIKeyCommand(input: "\t", modifierFlags: .alternate, action: #selector(moveToNextTab), discoverabilityTitle: "Move to next tab")
let pt = UIKeyCommand(input: "\t", modifierFlags: [.alternate, .shift], action: #selector(moveToPreviousTab), discoverabilityTitle: "Move to previous tab")
let sp = UIKeyCommand(input: " ", modifierFlags: [], action: #selector(keyShowSelectedItem), discoverabilityTitle: "Display current item")
- let d = UIKeyCommand(input: UIKeyInputDownArrow, modifierFlags: [], action: #selector(keyMoveToNextItem), discoverabilityTitle: "Next item")
- let u = UIKeyCommand(input: UIKeyInputUpArrow, modifierFlags: [], action: #selector(keyMoveToPreviousItem), discoverabilityTitle: "Previous item")
- let dd = UIKeyCommand(input: UIKeyInputDownArrow, modifierFlags: .alternate, action: #selector(keyMoveToNextSection), discoverabilityTitle: "Move to the next section")
- let uu = UIKeyCommand(input: UIKeyInputUpArrow, modifierFlags: .alternate, action: #selector(keyMoveToPreviousSection), discoverabilityTitle: "Move to the previous section")
- let fd = UIKeyCommand(input: UIKeyInputRightArrow, modifierFlags: .command, action: #selector(keyFocusDetailView), discoverabilityTitle: "Focus keyboard on detail view")
- let fm = UIKeyCommand(input: UIKeyInputLeftArrow, modifierFlags: .command, action: #selector(becomeFirstResponder), discoverabilityTitle: "Focus keyboard on list view")
+ let d = UIKeyCommand(input: UIKeyCommand.inputDownArrow, modifierFlags: [], action: #selector(keyMoveToNextItem), discoverabilityTitle: "Next item")
+ let u = UIKeyCommand(input: UIKeyCommand.inputUpArrow, modifierFlags: [], action: #selector(keyMoveToPreviousItem), discoverabilityTitle: "Previous item")
+ let dd = UIKeyCommand(input: UIKeyCommand.inputDownArrow, modifierFlags: .alternate, action: #selector(keyMoveToNextSection), discoverabilityTitle: "Move to the next section")
+ let uu = UIKeyCommand(input: UIKeyCommand.inputUpArrow, modifierFlags: .alternate, action: #selector(keyMoveToPreviousSection), discoverabilityTitle: "Move to the previous section")
+ let fd = UIKeyCommand(input: UIKeyCommand.inputRightArrow, modifierFlags: .command, action: #selector(keyFocusDetailView), discoverabilityTitle: "Focus keyboard on detail view")
+ let fm = UIKeyCommand(input: UIKeyCommand.inputLeftArrow, modifierFlags: .command, action: #selector(becomeFirstResponder), discoverabilityTitle: "Focus keyboard on list view")
return [u,d,uu,dd,nt,pt,fd,fm,sp,f,r,a,m,o,s]
}
diff --git a/PocketTrailer/OpenInSafariActivity.swift b/PocketTrailer/OpenInSafariActivity.swift
index 88c031f0..e159ac3e 100644
--- a/PocketTrailer/OpenInSafariActivity.swift
+++ b/PocketTrailer/OpenInSafariActivity.swift
@@ -6,8 +6,8 @@ final class OpenInSafariActivity: UIActivity {
private var _URL: URL?
- override var activityType: UIActivityType {
- return UIActivityType("OpenInSafariActivity")
+ override var activityType: UIActivity.ActivityType {
+ return UIActivity.ActivityType("OpenInSafariActivity")
}
override var activityTitle: String? {
diff --git a/PocketTrailer/PRCell.swift b/PocketTrailer/PRCell.swift
index 3ccb4139..42ccd003 100644
--- a/PocketTrailer/PRCell.swift
+++ b/PocketTrailer/PRCell.swift
@@ -1,15 +1,15 @@
import UIKit
-let statusAttributes: [NSAttributedStringKey : Any] = {
+let statusAttributes: [NSAttributedString.Key : Any] = {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.paragraphSpacing = 6.0
paragraphStyle.lineSpacing = 1
paragraphStyle.headIndent = 19
return [
- NSAttributedStringKey.font: UIFont(name: "Menlo-Regular", size: 10)!,
- NSAttributedStringKey.paragraphStyle: paragraphStyle
+ NSAttributedString.Key.font: UIFont(name: "Menlo-Regular", size: 10)!,
+ NSAttributedString.Key.paragraphStyle: paragraphStyle
]
}()
@@ -112,7 +112,7 @@ final class PRCell: UITableViewCell {
statusText = NSMutableAttributedString()
for status in statusItems {
var lineAttributes = statusAttributes
- lineAttributes[NSAttributedStringKey.foregroundColor] = status.colorForDisplay
+ lineAttributes[NSAttributedString.Key.foregroundColor] = status.colorForDisplay
statusText?.append(NSAttributedString(string: status.displayText, attributes: lineAttributes))
statusCount -= 1
if statusCount > 0 {
diff --git a/PocketTrailer/RespositoriesViewController.swift b/PocketTrailer/RespositoriesViewController.swift
index aa142e8b..1ebb6dc3 100644
--- a/PocketTrailer/RespositoriesViewController.swift
+++ b/PocketTrailer/RespositoriesViewController.swift
@@ -235,7 +235,7 @@ final class RespositoriesViewController: UITableViewController, UISearchResultsU
let repo = fetchedResultsController.object(at: atIndexPath)
let titleColor: UIColor = repo.shouldSync ? .black : .lightGray
- let titleAttributes = [ NSAttributedStringKey.foregroundColor: titleColor ]
+ let titleAttributes = [ NSAttributedString.Key.foregroundColor: titleColor ]
let title = NSMutableAttributedString(attributedString: NSAttributedString(string: S(repo.fullName), attributes: titleAttributes))
title.append(NSAttributedString(string: "\n", attributes: titleAttributes))
@@ -264,7 +264,7 @@ final class RespositoriesViewController: UITableViewController, UISearchResultsU
return h
}
configureCell(sizer!, atIndexPath: indexPath)
- let h = sizer!.systemLayoutSizeFitting(CGSize(width: tableView.bounds.width, height: UILayoutFittingCompressedSize.height),
+ let h = sizer!.systemLayoutSizeFitting(CGSize(width: tableView.bounds.width, height: 0),
withHorizontalFittingPriority: .required,
verticalFittingPriority: .fittingSizeLevel).height
heightCache[indexPath] = h
@@ -276,7 +276,7 @@ final class RespositoriesViewController: UITableViewController, UISearchResultsU
let fullName = S(repo.fullName)
let text = repo.inaccessible ? "\(fullName) (inaccessible)" : fullName
let color: UIColor = repo.shouldSync ? .darkText : .lightGray
- return NSAttributedString(string: text, attributes: [ NSAttributedStringKey.foregroundColor: color ])
+ return NSAttributedString(string: text, attributes: [ NSAttributedString.Key.foregroundColor: color ])
}
private func prTitleForRepo(repo: Repo) -> NSAttributedString {
@@ -294,13 +294,13 @@ final class RespositoriesViewController: UITableViewController, UISearchResultsU
private func groupTitleForRepo(repo: Repo) -> NSAttributedString {
if let l = repo.groupLabel {
return NSAttributedString(string: "Group: \(l)", attributes: [
- NSAttributedStringKey.foregroundColor : UIColor.darkGray,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)
+ NSAttributedString.Key.foregroundColor : UIColor.darkGray,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)
])
} else {
return NSAttributedString(string: "Ungrouped", attributes: [
- NSAttributedStringKey.foregroundColor : UIColor.lightGray,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)
+ NSAttributedString.Key.foregroundColor : UIColor.lightGray,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)
])
}
}
@@ -311,17 +311,17 @@ final class RespositoriesViewController: UITableViewController, UISearchResultsU
return NSAttributedString(string: policy.name, attributes: attributes(for: policy))
}
- private func attributes(for policy: RepoDisplayPolicy) -> [NSAttributedStringKey : Any] {
+ private func attributes(for policy: RepoDisplayPolicy) -> [NSAttributedString.Key : Any] {
return [
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize-1.0),
- NSAttributedStringKey.foregroundColor: policy.color
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize-1.0),
+ NSAttributedString.Key.foregroundColor: policy.color
]
}
- private func attributes(for policy: RepoHidingPolicy) -> [NSAttributedStringKey : Any] {
+ private func attributes(for policy: RepoHidingPolicy) -> [NSAttributedString.Key : Any] {
return [
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize-1.0),
- NSAttributedStringKey.foregroundColor: policy.color
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize-1.0),
+ NSAttributedString.Key.foregroundColor: policy.color
]
}
diff --git a/PocketTrailer/ServerDetailViewController.swift b/PocketTrailer/ServerDetailViewController.swift
index 8118d834..d69b5a30 100644
--- a/PocketTrailer/ServerDetailViewController.swift
+++ b/PocketTrailer/ServerDetailViewController.swift
@@ -37,8 +37,8 @@ final class ServerDetailViewController: UIViewController, UITextFieldDelegate {
if UIDevice.current.userInterfaceIdiom != UIUserInterfaceIdiom.pad {
let n = NotificationCenter.default
- n.addObserver(self, selector: #selector(keyboardWillShow), name: .UIKeyboardWillShow, object: nil)
- n.addObserver(self, selector: #selector(keyboardWillHide), name: .UIKeyboardWillHide, object: nil)
+ n.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
+ n.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
}
}
@@ -179,7 +179,7 @@ final class ServerDetailViewController: UIViewController, UITextFieldDelegate {
@objc private func keyboardWillShow(notification: NSNotification) {
if focusedField?.superview == nil { return }
- if let info = notification.userInfo, let keyboardFrameValue = info[UIKeyboardFrameEndUserInfoKey] as? NSValue {
+ if let info = notification.userInfo, let keyboardFrameValue = info[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue {
let keyboardFrame = keyboardFrameValue.cgRectValue
let keyboardHeight = max(0, view.bounds.size.height-keyboardFrame.origin.y)
let firstResponderFrame = view.convert(focusedField!.frame, from: focusedField!.superview)
diff --git a/PocketTrailer/ServersViewController.swift b/PocketTrailer/ServersViewController.swift
index 608c0f74..3bcda73a 100644
--- a/PocketTrailer/ServersViewController.swift
+++ b/PocketTrailer/ServersViewController.swift
@@ -70,8 +70,8 @@ final class ServersViewController: UITableViewController {
return true
}
- override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
- if editingStyle == UITableViewCellEditingStyle.delete {
+ override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
+ if editingStyle == UITableViewCell.EditingStyle.delete {
let a = allServers[indexPath.row]
allServers.remove(at: indexPath.row)
DataManager.main.delete(a)
diff --git a/PocketTrailer/WatchlistSettingsViewController.swift b/PocketTrailer/WatchlistSettingsViewController.swift
index bf24e176..f7e0f2e3 100644
--- a/PocketTrailer/WatchlistSettingsViewController.swift
+++ b/PocketTrailer/WatchlistSettingsViewController.swift
@@ -17,7 +17,7 @@ final class WatchlistSettingsViewController: UITableViewController, PickerViewCo
super.viewDidLoad()
navigationItem.largeTitleDisplayMode = .automatic
tableView.estimatedRowHeight = 100
- tableView.rowHeight = UITableViewAutomaticDimension
+ tableView.rowHeight = UITableView.automaticDimension
rescanCell.detailTextLabel?.text = Settings.newRepoCheckPeriodHelp
autoAddCell.detailTextLabel?.text = Settings.automaticallyAddNewReposFromWatchlistHelp
autoRemoveCell.detailTextLabel?.text = Settings.automaticallyRemoveDeletedReposFromWatchlistHelp
diff --git a/PocketTrailer/iOS_AppDelegate.swift b/PocketTrailer/iOS_AppDelegate.swift
index 47521305..5ca88a51 100644
--- a/PocketTrailer/iOS_AppDelegate.swift
+++ b/PocketTrailer/iOS_AppDelegate.swift
@@ -8,7 +8,7 @@ final class iOS_AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat
var window: UIWindow?
private var lastUpdateFailed = false
- private var backgroundTask = UIBackgroundTaskInvalid
+ private var backgroundTask = UIBackgroundTaskIdentifier.invalid
private var watchManager: WatchManager?
private var refreshTimer: Timer?
private var backgroundCallback: ((UIBackgroundFetchResult) -> Void)?
@@ -18,7 +18,7 @@ final class iOS_AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat
watchManager?.updateContext()
}
- func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
+ func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
app = self
bootUp()
@@ -41,7 +41,7 @@ final class iOS_AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat
completionHandler()
}
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
DataManager.postProcessAllItems()
@@ -95,7 +95,7 @@ final class iOS_AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat
}
}
- func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
+ func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if let c = URLComponents(url: url, resolvingAgainstBaseURL: false) {
if let scheme = c.scheme {
if scheme == "pockettrailer" {
@@ -108,7 +108,7 @@ final class iOS_AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat
return false
}
- func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
+ func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
return NotificationManager.handleUserActivity(activity: userActivity)
}
@@ -250,9 +250,9 @@ final class iOS_AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificat
}
private func endBGTask() {
- if backgroundTask != UIBackgroundTaskInvalid {
+ if backgroundTask != .invalid {
UIApplication.shared.endBackgroundTask(backgroundTask)
- backgroundTask = UIBackgroundTaskInvalid
+ backgroundTask = .invalid
}
}
diff --git a/Shared/API.swift b/Shared/API.swift
index 603ffb10..8ecf885e 100644
--- a/Shared/API.swift
+++ b/Shared/API.swift
@@ -191,7 +191,6 @@ final class API {
///////////////////////////////////////////////////////// Images
private static func expireOldImageCacheEntries() {
-
let now = Date()
let fileManager = FileManager.default
for f in try! fileManager.contentsOfDirectory(atPath: cacheDirectory) {
@@ -201,7 +200,7 @@ final class API {
let attributes = try fileManager.attributesOfItem(atPath: path)
let date = attributes[.creationDate] as! Date
if now.timeIntervalSince(date) > (3600.0*24.0) {
- try! fileManager.removeItem(atPath: path)
+ try? fileManager.removeItem(atPath: path)
}
} catch {
DLog("File error when cleaning old cached image: %@", error.localizedDescription)
@@ -277,7 +276,7 @@ final class API {
#if os(iOS)
if let d = data, let i = UIImage(data: d, scale: GLOBAL_SCREEN_SCALE) {
result = i
- if let imageData = UIImageJPEGRepresentation(i, 1.0) {
+ if let imageData = i.jpegData(compressionQuality: 1) {
try? imageData.write(to: URL(fileURLWithPath: cachePath), options: .atomic)
}
}
@@ -1725,7 +1724,7 @@ final class API {
#if os(iOS)
private static var networkIndicationCount = 0
- private static var networkBGTask = UIBackgroundTaskInvalid
+ private static var networkBGTask = UIBackgroundTaskIdentifier.invalid
private static let networkBGEndPopTimer = { ()->PopTimer in
return PopTimer(timeInterval: 1.0) {
endNetworkBGTask()
@@ -1752,9 +1751,9 @@ final class API {
}
private static func endNetworkBGTask() {
- if networkBGTask != UIBackgroundTaskInvalid {
+ if networkBGTask != UIBackgroundTaskIdentifier.invalid {
UIApplication.shared.endBackgroundTask(networkBGTask)
- networkBGTask = UIBackgroundTaskInvalid
+ networkBGTask = UIBackgroundTaskIdentifier.invalid
}
}
diff --git a/Shared/ListableItem.swift b/Shared/ListableItem.swift
index 7fda12b3..8a9b836b 100644
--- a/Shared/ListableItem.swift
+++ b/Shared/ListableItem.swift
@@ -540,9 +540,9 @@ class ListableItem: DataItem {
let p = NSMutableParagraphStyle()
p.paragraphSpacing = 1.0
- let titleAttributes = [NSAttributedStringKey.font: font,
- NSAttributedStringKey.foregroundColor: titleColor,
- NSAttributedStringKey.paragraphStyle: p]
+ let titleAttributes = [NSAttributedString.Key.font: font,
+ NSAttributedString.Key.foregroundColor: titleColor,
+ NSAttributedString.Key.paragraphStyle: p]
let _title = NSMutableAttributedString()
if let t = title {
@@ -557,14 +557,14 @@ class ListableItem: DataItem {
let lp = NSMutableParagraphStyle()
#if os(iOS)
lp.lineHeightMultiple = 1.15
- let labelAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: labelFont,
- NSAttributedStringKey.baselineOffset: 2.0,
- NSAttributedStringKey.paragraphStyle: lp]
+ let labelAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: labelFont,
+ NSAttributedString.Key.baselineOffset: 2.0,
+ NSAttributedString.Key.paragraphStyle: lp]
#elseif os(OSX)
lp.minimumLineHeight = labelFont.pointSize + 4
- let labelAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: labelFont,
- NSAttributedStringKey.baselineOffset: 2.0,
- NSAttributedStringKey.paragraphStyle: lp]
+ let labelAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: labelFont,
+ NSAttributedString.Key.baselineOffset: 2.0,
+ NSAttributedString.Key.paragraphStyle: lp]
#endif
func isDark(color: COLOR_CLASS) -> Bool {
@@ -580,8 +580,8 @@ class ListableItem: DataItem {
for l in sorted {
var a = labelAttributes
let color = l.colorForDisplay
- a[NSAttributedStringKey.backgroundColor] = color
- a[NSAttributedStringKey.foregroundColor] = isDark(color: color) ? COLOR_CLASS.white : COLOR_CLASS.black
+ a[NSAttributedString.Key.backgroundColor] = color
+ a[NSAttributedString.Key.foregroundColor] = isDark(color: color) ? COLOR_CLASS.white : COLOR_CLASS.black
let name = l.name!.replacingOccurrences(of: " ", with: "\u{a0}")
_title.append(NSAttributedString(string: "\u{a0}\(name)\u{a0}", attributes: a))
if count < labelCount-1 {
@@ -613,9 +613,9 @@ class ListableItem: DataItem {
let approvers = reviews.filter { $0.state == Review.State.APPROVED.rawValue }
if approvers.count > 0 {
- let a = [NSAttributedStringKey.font: labelFont,
- NSAttributedStringKey.foregroundColor: COLOR_CLASS(red: 0, green: 0.5, blue: 0, alpha: 1.0),
- NSAttributedStringKey.paragraphStyle: lp]
+ let a = [NSAttributedString.Key.font: labelFont,
+ NSAttributedString.Key.foregroundColor: COLOR_CLASS(red: 0, green: 0.5, blue: 0, alpha: 1.0),
+ NSAttributedString.Key.paragraphStyle: lp]
_title.append(NSAttributedString(string: "\n", attributes: a))
@@ -633,9 +633,9 @@ class ListableItem: DataItem {
let requesters = reviews.filter { $0.state == Review.State.CHANGES_REQUESTED.rawValue }
if requesters.count > 0 {
- let a = [NSAttributedStringKey.font: labelFont,
- NSAttributedStringKey.foregroundColor: COLOR_CLASS(red: 0.7, green: 0, blue: 0, alpha: 1.0),
- NSAttributedStringKey.paragraphStyle: lp]
+ let a = [NSAttributedString.Key.font: labelFont,
+ NSAttributedString.Key.foregroundColor: COLOR_CLASS(red: 0.7, green: 0, blue: 0, alpha: 1.0),
+ NSAttributedString.Key.paragraphStyle: lp]
_title.append(NSAttributedString(string: "\n", attributes: a))
@@ -655,9 +655,9 @@ class ListableItem: DataItem {
let otherReviewers = p.reviewers.components(separatedBy: ",").filter({ !($0.isEmpty || approverNames.contains($0) || requesterNames.contains($0)) })
if otherReviewers.count > 0 {
- let a = [NSAttributedStringKey.font: labelFont,
- NSAttributedStringKey.foregroundColor: COLOR_CLASS(red: 0.7, green: 0.7, blue: 0, alpha: 1.0),
- NSAttributedStringKey.paragraphStyle: lp]
+ let a = [NSAttributedString.Key.font: labelFont,
+ NSAttributedString.Key.foregroundColor: COLOR_CLASS(red: 0.7, green: 0.7, blue: 0, alpha: 1.0),
+ NSAttributedString.Key.paragraphStyle: lp]
_title.append(NSAttributedString(string: "\n", attributes: a))
@@ -684,9 +684,9 @@ class ListableItem: DataItem {
p.lineHeightMultiple = 1.3
#endif
- let lightSubtitle = [NSAttributedStringKey.foregroundColor: lightColor,
- NSAttributedStringKey.font: font,
- NSAttributedStringKey.paragraphStyle: p]
+ let lightSubtitle = [NSAttributedString.Key.foregroundColor: lightColor,
+ NSAttributedString.Key.font: font,
+ NSAttributedString.Key.paragraphStyle: p]
#if os(iOS)
let separator = NSAttributedString(string:"\n", attributes: lightSubtitle)
@@ -695,7 +695,7 @@ class ListableItem: DataItem {
#endif
var darkSubtitle = lightSubtitle
- darkSubtitle[NSAttributedStringKey.foregroundColor] = darkColor
+ darkSubtitle[NSAttributedString.Key.foregroundColor] = darkColor
if Settings.showReposInName, let n = repo.fullName {
_subtitle.append(NSAttributedString(string: n, attributes: darkSubtitle))
@@ -755,14 +755,14 @@ class ListableItem: DataItem {
p.alignment = .center
#if os(OSX)
return NSAttributedString(string: message, attributes: [
- NSAttributedStringKey.foregroundColor: color,
- NSAttributedStringKey.paragraphStyle: p
+ NSAttributedString.Key.foregroundColor: color,
+ NSAttributedString.Key.paragraphStyle: p
])
#elseif os(iOS)
return NSAttributedString(string: message, attributes: [
- NSAttributedStringKey.foregroundColor: color,
- NSAttributedStringKey.paragraphStyle: p,
- NSAttributedStringKey.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)])
+ NSAttributedString.Key.foregroundColor: color,
+ NSAttributedString.Key.paragraphStyle: p,
+ NSAttributedString.Key.font: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)])
#endif
}
diff --git a/Trailer.xcodeproj/project.pbxproj b/Trailer.xcodeproj/project.pbxproj
index 59d9e09c..952a611e 100644
--- a/Trailer.xcodeproj/project.pbxproj
+++ b/Trailer.xcodeproj/project.pbxproj
@@ -926,7 +926,7 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
- LastUpgradeCheck = 0930;
+ LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "";
TargetAttributes = {
1618527A1AB2CB9000526D81 = {
@@ -1471,10 +1471,9 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D DEBUG";
- PRODUCT_MODULE_NAME = Trailer;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
name = Debug;
@@ -1524,12 +1523,11 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../Frameworks";
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
- PRODUCT_MODULE_NAME = Trailer;
SEPARATE_STRIP = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_DISABLE_SAFETY_CHECKS = YES;
SWIFT_REFLECTION_METADATA_LEVEL = none;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
name = Release;
diff --git a/Trailer.xcodeproj/xcshareddata/xcschemes/PocketTrailer Today Extension.xcscheme b/Trailer.xcodeproj/xcshareddata/xcschemes/PocketTrailer Today Extension.xcscheme
index 4cfc2a5b..1025354c 100644
--- a/Trailer.xcodeproj/xcshareddata/xcschemes/PocketTrailer Today Extension.xcscheme
+++ b/Trailer.xcodeproj/xcshareddata/xcschemes/PocketTrailer Today Extension.xcscheme
@@ -1,6 +1,6 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.6.10
+ 1.6.11
CFBundleSignature
????
CFBundleVersion
- 1476
+ 1477
LSApplicationCategoryType
public.app-category.developer-tools
LSMinimumSystemVersion
diff --git a/Trailer/MenuBarSet.swift b/Trailer/MenuBarSet.swift
index cb38301a..b4c92510 100644
--- a/Trailer/MenuBarSet.swift
+++ b/Trailer/MenuBarSet.swift
@@ -1,8 +1,8 @@
final class MenuBarSet {
- private let prMenuController = NSWindowController(windowNibName:NSNib.Name(rawValue: "MenuWindow"))
- private let issuesMenuController = NSWindowController(windowNibName:NSNib.Name(rawValue: "MenuWindow"))
+ private let prMenuController = NSWindowController(windowNibName:NSNib.Name("MenuWindow"))
+ private let issuesMenuController = NSWindowController(windowNibName:NSNib.Name("MenuWindow"))
let prMenu: MenuWindow
let issuesMenu: MenuWindow
@@ -79,11 +79,11 @@ final class MenuBarSet {
}
}
- private static let redText = [ NSAttributedStringKey.font: NSFont.boldSystemFont(ofSize: 10),
- NSAttributedStringKey.foregroundColor: NSColor(red: 0.8, green: 0.0, blue: 0.0, alpha: 1.0) ]
+ private static let redText = [ NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 10),
+ NSAttributedString.Key.foregroundColor: NSColor(red: 0.8, green: 0.0, blue: 0.0, alpha: 1.0) ]
- private static let normalText = [ NSAttributedStringKey.font: NSFont.menuBarFont(ofSize: 10),
- NSAttributedStringKey.foregroundColor: NSColor.controlTextColor ]
+ private static let normalText = [ NSAttributedString.Key.font: NSFont.menuBarFont(ofSize: 10),
+ NSAttributedString.Key.foregroundColor: NSColor.controlTextColor ]
private func updateMenu(of type: ListableItem.Type,
menu: MenuWindow,
@@ -123,7 +123,7 @@ final class MenuBarSet {
if !(compare(dictionary: siv.textAttributes, to: attributes) && siv.statusLabel == countString && siv.grayOut == shouldGray) {
// Info has changed, update
DLog("Updating \(type) status item")
- siv.icon = NSImage(named: NSImage.Name(rawValue: "\(type)Icon"))!
+ siv.icon = NSImage(named: NSImage.Name("\(type)Icon"))!
siv.textAttributes = attributes
siv.labelOffset = lengthOffset
siv.highlighted = menu.isVisible
diff --git a/Trailer/MenuWindow.swift b/Trailer/MenuWindow.swift
index a0338d35..869e4730 100644
--- a/Trailer/MenuWindow.swift
+++ b/Trailer/MenuWindow.swift
@@ -1,5 +1,5 @@
-final class MenuWindow: NSWindow {
+final class MenuWindow: NSWindow, NSControlTextEditingDelegate {
@IBOutlet weak var scrollView: NSScrollView!
@IBOutlet private weak var header: ViewAllowsVibrancy!
@@ -49,12 +49,21 @@ final class MenuWindow: NSWindow {
NotificationCenter.default.addObserver(self, selector: #selector(refreshUpdate), name: SyncProgressUpdateNotification, object: nil)
}
- override func controlTextDidChange(_ obj: Notification) {
+ func controlTextDidChange(_ obj: Notification) {
app.controlTextDidChange(obj)
}
func updateVibrancy() {
- appearance = NSAppearance(named: app.darkMode ? .vibrantDark : .vibrantLight)
+ switch app.theme {
+ case .light:
+ appearance = NSAppearance(named: .vibrantLight)
+ case .darkLegacy:
+ appearance = NSAppearance(named: .vibrantDark)
+ case .dark:
+ if #available(OSX 10.14, *) {
+ appearance = NSAppearance(named: .darkAqua)
+ }
+ }
}
var showStatusItem: StatusItemView {
diff --git a/Trailer/MenuWindow.xib b/Trailer/MenuWindow.xib
index c9f7b2d9..8259c8cb 100644
--- a/Trailer/MenuWindow.xib
+++ b/Trailer/MenuWindow.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -13,7 +13,7 @@
-
+
@@ -29,14 +29,14 @@
-
+
-
+
diff --git a/Trailer/OSX_AppDelegate.swift b/Trailer/OSX_AppDelegate.swift
index cbbc2548..4e554fe7 100644
--- a/Trailer/OSX_AppDelegate.swift
+++ b/Trailer/OSX_AppDelegate.swift
@@ -1,6 +1,10 @@
+enum Theme {
+ case light, darkLegacy, dark
+}
+
@NSApplicationMain
-final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSUserNotificationCenterDelegate, NSOpenSavePanelDelegate {
+final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSUserNotificationCenterDelegate, NSOpenSavePanelDelegate, NSControlTextEditingDelegate {
// Globals
var refreshTimer: Timer?
@@ -14,9 +18,11 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
private var keyDownMonitor: Any?
private var mouseIgnoreTimer: PopTimer!
+ private let themeDetector = NSView()
+
func setupWindows() {
- darkMode = currentSystemDarkMode
+ theme = currentTheme
for d in menuBarSets {
d.throwAway()
@@ -67,6 +73,8 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
NSTextField.cellClass = CenterTextFieldCell.self
}
+ private var themeCheck: Timer!
+
func applicationDidFinishLaunching(_ notification: Notification) {
if DataManager.main.persistentStoreCoordinator == nil {
@@ -74,7 +82,12 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
return
}
- DistributedNotificationCenter.default().addObserver(self, selector: #selector(updateDarkModeDelayed), name: AppleInterfaceThemeChangedNotification, object: nil)
+ themeCheck = Timer(repeats: true, interval: 2) { [weak self] in
+ guard let s = self else { return }
+ if s.theme != s.currentTheme {
+ s.applyTheme()
+ }
+ }
DataManager.postProcessAllItems()
@@ -82,7 +95,7 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
app.isManuallyScrolling = false
}
- updateDarkMode() // also sets up windows
+ applyTheme() // also sets up windows
API.updateLimitsFromServer()
@@ -129,7 +142,6 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
DLog("System woke up")
systemSleeping = false
delay(1, self) { S in
- S.updateDarkMode()
S.startRefreshIfItIsDue()
}
}
@@ -515,7 +527,7 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
}
}
- override func controlTextDidChange(_ n: Notification) {
+ func controlTextDidChange(_ n: Notification) {
guard let obj = n.object as? NSSearchField, let w = obj.window as? MenuWindow, let menuBarSet = menuBarSet(for: w) else { return }
if obj === menuBarSet.prMenu.filter {
@@ -1059,7 +1071,7 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
private var startupAssistantController: NSWindowController?
private func startupAssistant() {
if startupAssistantController == nil {
- startupAssistantController = NSWindowController(windowNibName:NSNib.Name(rawValue: "SetupAssistant"))
+ startupAssistantController = NSWindowController(windowNibName:NSNib.Name("SetupAssistant"))
if let w = startupAssistantController!.window as? SetupAssistant {
w.level = .floating
w.center()
@@ -1074,7 +1086,7 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
private var aboutWindowController: NSWindowController?
func showAboutWindow() {
if aboutWindowController == nil {
- aboutWindowController = NSWindowController(windowNibName:NSNib.Name(rawValue: "AboutWindow"))
+ aboutWindowController = NSWindowController(windowNibName:NSNib.Name("AboutWindow"))
}
if let w = aboutWindowController!.window as? AboutWindow {
w.level = .floating
@@ -1091,7 +1103,7 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
private var preferencesWindow: PreferencesWindow?
func showPreferencesWindow(andSelect selectTab: Int?) {
if preferencesWindowController == nil {
- preferencesWindowController = NSWindowController(windowNibName:NSNib.Name(rawValue: "PreferencesWindow"))
+ preferencesWindowController = NSWindowController(windowNibName:NSNib.Name("PreferencesWindow"))
}
if let w = preferencesWindowController!.window as? PreferencesWindow {
w.level = .floating
@@ -1150,25 +1162,20 @@ final class OSX_AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
//////////////////////// Dark mode
- var darkMode = false
- @objc private func updateDarkModeDelayed() {
- delay(0.1, self) { S in
- S.updateDarkMode()
- }
- }
- private func updateDarkMode() {
+ var theme = Theme.light
+ private func applyTheme() {
if !systemSleeping {
- if menuBarSets.count == 0 || darkMode != currentSystemDarkMode {
+ if menuBarSets.count == 0 || theme != currentTheme {
setupWindows()
}
}
}
- private var currentSystemDarkMode: Bool {
- if let appearance = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") {
- return appearance == "Dark"
+ private var currentTheme: Theme {
+ if #available(OSX 10.14, *) {
+ return UserDefaults.standard.string(forKey: "AppleInterfaceStyle") == "Dark" ? .dark : .light
} else {
- return false
+ return UserDefaults.standard.string(forKey: "AppleInterfaceStyle") == "Dark" ? .darkLegacy : .light
}
}
diff --git a/Trailer/PrTable.swift b/Trailer/PrTable.swift
index b926ca09..a9e1f0a4 100644
--- a/Trailer/PrTable.swift
+++ b/Trailer/PrTable.swift
@@ -38,8 +38,8 @@ final class PrTable: NSTableView, NSPasteboardItemDataProvider {
if let origin = dragOrigin {
func fastDistance(_ a: CGFloat, _ b: CGFloat) -> CGFloat {
- let dx = fabs(a)
- let dy = fabs(b)
+ let dx = abs(a)
+ let dy = abs(b)
return (dx < dy) ? dy + 0.337 * dx : dx + 0.337 * dy
}
diff --git a/Trailer/PreferencesWindow.swift b/Trailer/PreferencesWindow.swift
index 30cbbccd..b97dccee 100644
--- a/Trailer/PreferencesWindow.swift
+++ b/Trailer/PreferencesWindow.swift
@@ -1,7 +1,7 @@
import Foundation
-final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate, NSTableViewDataSource, NSTabViewDelegate {
+final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate, NSTableViewDataSource, NSTabViewDelegate, NSControlTextEditingDelegate {
private var deferredUpdateTimer: PopTimer!
private var serversDirty = false
@@ -1142,7 +1142,7 @@ final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate,
private func color(button: NSButton, withColor: NSColor) {
let title = button.attributedTitle.mutableCopy() as! NSMutableAttributedString
- title.addAttribute(NSAttributedStringKey.foregroundColor, value: withColor, range: NSRange(location: 0, length: title.length))
+ title.addAttribute(NSAttributedString.Key.foregroundColor, value: withColor, range: NSRange(location: 0, length: title.length))
button.attributedTitle = title
}
@@ -1315,7 +1315,7 @@ final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate,
app.closedPreferencesWindow()
}
- override func controlTextDidChange(_ n: Notification) {
+ func controlTextDidChange(_ n: Notification) {
if let obj = n.object as? NSTextField {
if obj===defaultOpenLinks {
@@ -1407,7 +1407,7 @@ final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate,
let repoName = S(r.fullName)
let title = r.inaccessible ? "\(repoName) (inaccessible)" : repoName
let textColor = (row == tv.selectedRow) ? .selectedControlTextColor : (r.shouldSync ? .textColor : NSColor.textColor.withAlphaComponent(0.4))
- cell.attributedStringValue = NSAttributedString(string: title, attributes: [NSAttributedStringKey.foregroundColor: textColor])
+ cell.attributedStringValue = NSAttributedString(string: title, attributes: [NSAttributedString.Key.foregroundColor: textColor])
} else if let menuCell = cell as? NSTextFieldCell {
if tableColumn?.identifier.rawValue == "group" {
let r = repos[row]
@@ -1427,8 +1427,8 @@ final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate,
for policy in RepoHidingPolicy.policies {
let m = NSMenuItem()
m.attributedTitle = NSAttributedString(string: policy.name, attributes: [
- NSAttributedStringKey.font: count==0 ? NSFont.systemFont(ofSize: fontSize) : NSFont.boldSystemFont(ofSize: fontSize),
- NSAttributedStringKey.foregroundColor: policy.color,
+ NSAttributedString.Key.font: count==0 ? NSFont.systemFont(ofSize: fontSize) : NSFont.boldSystemFont(ofSize: fontSize),
+ NSAttributedString.Key.foregroundColor: policy.color,
])
menuCell.menu?.addItem(m)
count += 1
@@ -1438,8 +1438,8 @@ final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate,
for policy in RepoDisplayPolicy.policies {
let m = NSMenuItem()
m.attributedTitle = NSAttributedString(string: policy.name, attributes: [
- NSAttributedStringKey.font: count==0 ? NSFont.systemFont(ofSize: fontSize) : NSFont.boldSystemFont(ofSize: fontSize),
- NSAttributedStringKey.foregroundColor: policy.color,
+ NSAttributedString.Key.font: count==0 ? NSFont.systemFont(ofSize: fontSize) : NSFont.boldSystemFont(ofSize: fontSize),
+ NSAttributedString.Key.foregroundColor: policy.color,
])
menuCell.menu?.addItem(m)
count += 1
@@ -1785,7 +1785,7 @@ final class PreferencesWindow : NSWindow, NSWindowDelegate, NSTableViewDelegate,
private var advancedReposWindow: AdvancedReposWindow?
@IBAction private func advancedSelected(_ sender: NSButton) {
if advancedReposWindowController == nil {
- advancedReposWindowController = NSWindowController(windowNibName:NSNib.Name(rawValue: "AdvancedReposWindow"))
+ advancedReposWindowController = NSWindowController(windowNibName:NSNib.Name("AdvancedReposWindow"))
}
if let w = advancedReposWindowController?.window as? AdvancedReposWindow {
w.prefs = self
diff --git a/Trailer/SectionHeader.swift b/Trailer/SectionHeader.swift
index ece68d87..9b565690 100644
--- a/Trailer/SectionHeader.swift
+++ b/Trailer/SectionHeader.swift
@@ -25,8 +25,8 @@ final class SectionHeader: NSTableRowView {
let x = W-120-AVATAR_SIZE-LEFTPADDING
titleView = CenterTextField(frame: CGRect(x: 12, y: 4, width: x, height: titleHeight))
titleView.attributedStringValue = NSAttributedString(string: title, attributes: [
- NSAttributedStringKey.font: NSFont.boldSystemFont(ofSize: 14),
- NSAttributedStringKey.foregroundColor: NSColor.controlShadowColor.withAlphaComponent(0.7)])
+ NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 14),
+ NSAttributedString.Key.foregroundColor: NSColor.secondaryLabelColor])
addSubview(titleView)
}
diff --git a/Trailer/SetupAssistant.swift b/Trailer/SetupAssistant.swift
index 7e8755a2..c6c27197 100644
--- a/Trailer/SetupAssistant.swift
+++ b/Trailer/SetupAssistant.swift
@@ -1,5 +1,5 @@
-final class SetupAssistant: NSWindow, NSWindowDelegate {
+final class SetupAssistant: NSWindow, NSWindowDelegate, NSControlTextEditingDelegate {
@IBOutlet private weak var quickstart: NSTextField!
@IBOutlet private weak var buttonLink: NSButton!
@@ -37,7 +37,7 @@ final class SetupAssistant: NSWindow, NSWindowDelegate {
openLink(URL(string: address)!)
}
- override func controlTextDidChange(_ obj: Notification) {
+ func controlTextDidChange(_ obj: Notification) {
if let t = obj.object as? NSTextField {
completeSetup.isEnabled = !t.stringValue.isEmpty
}
diff --git a/Trailer/StatusItemView.swift b/Trailer/StatusItemView.swift
index 5e179f0d..84a8451e 100644
--- a/Trailer/StatusItemView.swift
+++ b/Trailer/StatusItemView.swift
@@ -4,7 +4,7 @@ final class StatusItemView: NSView {
private let tappedCallback: Completion
var icon: NSImage!
- var textAttributes = [NSAttributedStringKey : Any]()
+ var textAttributes = [NSAttributedString.Key : Any]()
var statusLabel = ""
var labelOffset: CGFloat = 0
var title: String?
@@ -57,18 +57,22 @@ final class StatusItemView: NSView {
if highlighted {
foreground = .selectedMenuItemTextColor
- countAttributes[NSAttributedStringKey.foregroundColor] = foreground
- } else if app.darkMode {
+ countAttributes[NSAttributedString.Key.foregroundColor] = foreground
+ } else if app.theme != .light {
foreground = .selectedMenuItemTextColor
- if countAttributes[NSAttributedStringKey.foregroundColor] as! NSColor == NSColor.controlTextColor {
- countAttributes[NSAttributedStringKey.foregroundColor] = foreground
+ if countAttributes[NSAttributedString.Key.foregroundColor] as! NSColor == NSColor.controlTextColor {
+ countAttributes[NSAttributedString.Key.foregroundColor] = foreground
}
} else {
foreground = .controlTextColor
}
if grayOut {
- countAttributes[NSAttributedStringKey.foregroundColor] = NSColor.disabledControlTextColor
+ if app.theme == .dark {
+ countAttributes[NSAttributedString.Key.foregroundColor] = NSColor.secondaryLabelColor
+ } else {
+ countAttributes[NSAttributedString.Key.foregroundColor] = NSColor.disabledControlTextColor
+ }
}
if(Settings.hideMenubarCounts) {
@@ -78,7 +82,7 @@ final class StatusItemView: NSView {
}
}
- private func drawStandard(titleColor: NSColor, countAttributes: [NSAttributedStringKey : Any], inRect: NSRect) {
+ private func drawStandard(titleColor: NSColor, countAttributes: [NSAttributedString.Key : Any], inRect: NSRect) {
let imagePoint = CGPoint(x: StatusItemView.padding, y: 0)
var labelRect = CGRect(x: bounds.size.height + labelOffset, y: -5, width: bounds.size.width, height: bounds.size.height)
@@ -93,9 +97,9 @@ final class StatusItemView: NSView {
p.alignment = .center
p.lineBreakMode = .byTruncatingMiddle
t.draw(in: r, withAttributes: [
- NSAttributedStringKey.foregroundColor: titleColor,
- NSAttributedStringKey.font: NSFont.menuFont(ofSize: 6),
- NSAttributedStringKey.paragraphStyle: p
+ NSAttributedString.Key.foregroundColor: titleColor,
+ NSAttributedString.Key.font: NSFont.menuFont(ofSize: 6),
+ NSAttributedString.Key.paragraphStyle: p
])
img.draw(in: CGRect(x: imagePoint.x+3, y: imagePoint.y, width: img.size.width-6, height: img.size.height-6))
@@ -106,9 +110,9 @@ final class StatusItemView: NSView {
statusLabel.draw(in: labelRect, withAttributes: countAttributes)
}
- private func drawIconOnly(titleColor: NSColor, countAttributes: [NSAttributedStringKey : Any], inRect: NSRect) {
+ private func drawIconOnly(titleColor: NSColor, countAttributes: [NSAttributedString.Key : Any], inRect: NSRect) {
- let foreground = countAttributes[NSAttributedStringKey.foregroundColor] as! NSColor
+ let foreground = countAttributes[NSAttributedString.Key.foregroundColor] as! NSColor
if let t = title {
@@ -117,9 +121,9 @@ final class StatusItemView: NSView {
p.alignment = .center
p.lineBreakMode = .byTruncatingMiddle
t.draw(in: r, withAttributes: [
- NSAttributedStringKey.foregroundColor: titleColor,
- NSAttributedStringKey.font: NSFont.menuFont(ofSize: 6),
- NSAttributedStringKey.paragraphStyle: p
+ NSAttributedString.Key.foregroundColor: titleColor,
+ NSAttributedString.Key.font: NSFont.menuFont(ofSize: 6),
+ NSAttributedString.Key.paragraphStyle: p
])
if statusLabel == "X" {
diff --git a/Trailer/TrailerCell.swift b/Trailer/TrailerCell.swift
index ff458189..69bb2912 100644
--- a/Trailer/TrailerCell.swift
+++ b/Trailer/TrailerCell.swift
@@ -1,20 +1,20 @@
class TrailerCell: NSTableCellView {
- private static let statusAttributes: [NSAttributedStringKey : Any] = {
+ private static let statusAttributes: [NSAttributedString.Key : Any] = {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.headIndent = 17
return [
- NSAttributedStringKey.font: NSFont(name: "Monaco", size: 9)!,
- NSAttributedStringKey.paragraphStyle: paragraphStyle
+ NSAttributedString.Key.font: NSFont(name: "Monaco", size: 9)!,
+ NSAttributedString.Key.paragraphStyle: paragraphStyle
]
}()
private let detailFont = NSFont.menuFont(ofSize: 10.0)
- private let titleFont = NSFont.menuFont(ofSize: 13.0)
+ private let titleFont = NSFont.menuBarFont(ofSize: 14.0)
private let dataItemId: NSManagedObjectID
@@ -127,15 +127,10 @@ class TrailerCell: NSTableCellView {
}
private func updateText(for item: ListableItem) {
-
- let dark = app.darkMode
- let unselectedTitleColor: NSColor = dark ? .controlHighlightColor : .controlTextColor
- let titleColor = (selected && dark) ? .darkGray : unselectedTitleColor
- title.attributedStringValue = item.title(with: titleFont, labelFont: detailFont, titleColor: titleColor)
-
- let unselectedRepoColor: NSColor = dark ? .lightGray : .darkGray
- let repoColor = (selected && dark) ? .darkGray: unselectedRepoColor
- subtitle.attributedStringValue = item.subtitle(with: detailFont, lightColor: .gray, darkColor: repoColor)
+ let light: NSColor = .secondaryLabelColor
+ let strong: NSColor = .controlTextColor
+ title.attributedStringValue = item.title(with: titleFont, labelFont: detailFont, titleColor: strong)
+ subtitle.attributedStringValue = item.subtitle(with: detailFont, lightColor: light, darkColor: strong)
}
var selected = false {
@@ -351,9 +346,9 @@ class TrailerCell: NSTableCellView {
pCenter.alignment = .center
let countString = NSAttributedString(string: itemCountFormatter.string(for: total)!, attributes: [
- NSAttributedStringKey.font: NSFont.menuFont(ofSize: 11),
- NSAttributedStringKey.foregroundColor: app.darkMode ? NSColor.controlLightHighlightColor : NSColor.controlTextColor,
- NSAttributedStringKey.paragraphStyle: pCenter])
+ NSAttributedString.Key.font: NSFont.menuFont(ofSize: 11),
+ NSAttributedString.Key.foregroundColor: NSColor.controlTextColor,
+ NSAttributedString.Key.paragraphStyle: pCenter])
var height: CGFloat = 20
var width = max(height, countString.size().width+10)
@@ -376,9 +371,9 @@ class TrailerCell: NSTableCellView {
let alertText = unread==0 ? "!" : itemCountFormatter.string(for: unread)!
let alertString = NSAttributedString(string: alertText, attributes: [
- NSAttributedStringKey.font: NSFont.menuFont(ofSize: 8),
- NSAttributedStringKey.foregroundColor: NSColor.white,
- NSAttributedStringKey.paragraphStyle: pCenter])
+ NSAttributedString.Key.font: NSFont.menuFont(ofSize: 8),
+ NSAttributedString.Key.foregroundColor: NSColor.white,
+ NSAttributedString.Key.paragraphStyle: pCenter])
bottom += height
height = 14
@@ -405,17 +400,22 @@ class TrailerCell: NSTableCellView {
private func highlight(_ on: Bool) {
if let c = countBackground {
var color: NSColor
- if app.darkMode {
- color = on ? .black : NSColor(red: 0.94, green: 0.94, blue: 0.94, alpha: 1.0)
- c.backgroundColor = on ? NSColor.white.withAlphaComponent(DISABLED_FADE) : NSColor.black.withAlphaComponent(0.2)
- newBackground?.backgroundColor = NSColor(red: 1.0, green: 0.1, blue: 0.1, alpha: 1.0)
- } else {
+ switch app.theme {
+ case .light:
color = .controlTextColor
c.backgroundColor = NSColor(red: 0.92, green: 0.92, blue: 0.92, alpha: 1.0)
newBackground?.backgroundColor = NSColor(red: 1.0, green: 0.4, blue: 0.4, alpha: 1.0)
+ case .dark:
+ color = on ? .black : NSColor(red: 0.94, green: 0.94, blue: 0.94, alpha: 1.0)
+ c.backgroundColor = on ? NSColor.white.withAlphaComponent(DISABLED_FADE) : NSColor.black
+ newBackground?.backgroundColor = NSColor(red: 1.0, green: 0.1, blue: 0.1, alpha: 1.0)
+ case .darkLegacy:
+ color = on ? .black : NSColor(red: 0.94, green: 0.94, blue: 0.94, alpha: 1.0)
+ c.backgroundColor = on ? NSColor.white.withAlphaComponent(DISABLED_FADE) : NSColor.black
+ newBackground?.backgroundColor = NSColor(red: 1.0, green: 0.1, blue: 0.1, alpha: 1.0)
}
if let a = countView?.attributedStringValue.mutableCopy() as? NSMutableAttributedString {
- a.addAttribute(NSAttributedStringKey.foregroundColor, value: color, range: NSRange(location: 0, length: a.length))
+ a.addAttribute(NSAttributedString.Key.foregroundColor, value: color, range: NSRange(location: 0, length: a.length))
countView?.attributedStringValue = a
}
}