Skip to content

Commit 2818095

Browse files
committed
Integrated preferences views with new title bar layout
1 parent b9c73b3 commit 2818095

8 files changed

+46
-20
lines changed

WWDC.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
F4FB069F2A2148EA00799F84 /* ExploreTabRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB069E2A2148EA00799F84 /* ExploreTabRootView.swift */; };
218218
F4FB06A12A21493B00799F84 /* PreviewSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB06A02A21493B00799F84 /* PreviewSupport.swift */; };
219219
F4FB06BF2A216C1F00799F84 /* RemoteGlyph.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB06BE2A216C1F00799F84 /* RemoteGlyph.swift */; };
220-
F4FB06C12A2178C000799F84 /* WWDCMainWindowContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB06C02A2178C000799F84 /* WWDCMainWindowContentViewController.swift */; };
220+
F4FB06C12A2178C000799F84 /* WWDCWindowContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB06C02A2178C000799F84 /* WWDCWindowContentViewController.swift */; };
221221
/* End PBXBuildFile section */
222222

223223
/* Begin PBXContainerItemProxy section */
@@ -528,7 +528,7 @@
528528
F4FB069E2A2148EA00799F84 /* ExploreTabRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreTabRootView.swift; sourceTree = "<group>"; };
529529
F4FB06A02A21493B00799F84 /* PreviewSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewSupport.swift; sourceTree = "<group>"; };
530530
F4FB06BE2A216C1F00799F84 /* RemoteGlyph.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteGlyph.swift; sourceTree = "<group>"; };
531-
F4FB06C02A2178C000799F84 /* WWDCMainWindowContentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WWDCMainWindowContentViewController.swift; sourceTree = "<group>"; };
531+
F4FB06C02A2178C000799F84 /* WWDCWindowContentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WWDCWindowContentViewController.swift; sourceTree = "<group>"; };
532532
/* End PBXFileReference section */
533533

534534
/* Begin PBXFrameworksBuildPhase section */
@@ -993,7 +993,7 @@
993993
DD7F385E1EABD631002D8C00 /* WWDCTabViewController.swift */,
994994
4DA25DCB21064B4800762BBD /* WWDCTabViewControllerTabBar.swift */,
995995
4DA25DC721063CD500762BBD /* TitleBarViewController.swift */,
996-
F4FB06C02A2178C000799F84 /* WWDCMainWindowContentViewController.swift */,
996+
F4FB06C02A2178C000799F84 /* WWDCWindowContentViewController.swift */,
997997
);
998998
name = Base;
999999
sourceTree = "<group>";
@@ -1634,7 +1634,7 @@
16341634
4DA25DC821063CD500762BBD /* TitleBarViewController.swift in Sources */,
16351635
4D5EB0F820598E6000D4BC52 /* SessionRowProvider.swift in Sources */,
16361636
DD7E28FF247FE69400A58370 /* ScheduleContainerViewController.swift in Sources */,
1637-
F4FB06C12A2178C000799F84 /* WWDCMainWindowContentViewController.swift in Sources */,
1637+
F4FB06C12A2178C000799F84 /* WWDCWindowContentViewController.swift in Sources */,
16381638
DDEDFCF11ED927A4002477C8 /* ToggleFilter.swift in Sources */,
16391639
DD7F38801EAC15B4002D8C00 /* RxNil.swift in Sources */,
16401640
DDFA10BF1EBEAAAD001DCF66 /* DownloadManager.swift in Sources */,

WWDC/GeneralPreferencesViewController.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension NSStoryboard.SceneIdentifier {
1919
static let generalPreferencesViewController = NSStoryboard.SceneIdentifier("GeneralPreferencesViewController")
2020
}
2121

22-
class GeneralPreferencesViewController: NSViewController {
22+
final class GeneralPreferencesViewController: WWDCWindowContentViewController {
2323

2424
#if ICLOUD
2525
weak var userDataSyncEngine: UserDataSyncEngine? {
@@ -40,6 +40,8 @@ class GeneralPreferencesViewController: NSViewController {
4040
return vc
4141
}
4242

43+
@IBOutlet weak var downloadsStackView: NSStackView?
44+
4345
@IBOutlet weak var searchInTranscriptsSwitch: NSSwitch!
4446
@IBOutlet weak var searchInBookmarksSwitch: NSSwitch!
4547
@IBOutlet weak var refreshPeriodicallySwitch: NSSwitch!
@@ -66,6 +68,8 @@ class GeneralPreferencesViewController: NSViewController {
6668
@IBOutlet weak var dividerC: NSBox!
6769
@IBOutlet weak var dividerE: NSBox!
6870
@IBOutlet weak var dividerF: NSBox!
71+
72+
override var viewForWindowTopSafeAreaConstraint: NSView? { downloadsStackView }
6973

7074
override func viewDidLoad() {
7175
super.viewDidLoad()

WWDC/PlaybackPreferencesViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ extension NSStoryboard.SceneIdentifier {
1212
static let playbackPreferencesViewController = NSStoryboard.SceneIdentifier("PlaybackPreferencesViewController")
1313
}
1414

15-
final class PlaybackPreferencesViewController: NSViewController {
15+
final class PlaybackPreferencesViewController: WWDCWindowContentViewController {
1616

1717
static func loadFromStoryboard() -> PlaybackPreferencesViewController {
1818
// swiftlint:disable:next force_cast
1919
return NSStoryboard(name: .preferences, bundle: nil).instantiateController(withIdentifier: .playbackPreferencesViewController) as! PlaybackPreferencesViewController
2020
}
2121

22+
@IBOutlet weak var skipIntroStackView: NSStackView?
2223
@IBOutlet private var skipIntroSwitch: NSSwitch!
2324
@IBOutlet private var skipBackAndForwardBy30SecondsSwitch: NSSwitch!
2425
@IBOutlet weak var includeAppBannerInClipsSwitch: NSSwitch!
2526

27+
override var viewForWindowTopSafeAreaConstraint: NSView? { skipIntroSwitch }
28+
2629
override func viewDidLoad() {
2730
super.viewDidLoad()
2831

WWDC/Preferences.storyboard

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
66
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
77
</dependencies>
88
<scenes>
@@ -255,7 +255,7 @@
255255
</textFieldCell>
256256
</textField>
257257
<button horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ORc-5v-yfb">
258-
<rect key="frame" x="344" y="1" width="18" height="19"/>
258+
<rect key="frame" x="344" y="0.0" width="18" height="19"/>
259259
<buttonCell key="cell" type="help" bezelStyle="helpButton" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WPm-F8-kUH">
260260
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
261261
<font key="font" metaFont="smallSystem"/>
@@ -377,7 +377,7 @@
377377
<constraint firstAttribute="trailing" secondItem="OZk-0e-tyQ" secondAttribute="trailing" id="XjQ-NC-K2O"/>
378378
<constraint firstItem="Yew-yF-ZWD" firstAttribute="trailing" secondItem="YmL-o7-wzA" secondAttribute="trailing" id="Y8B-RI-3h4"/>
379379
<constraint firstItem="gSp-wk-rap" firstAttribute="top" secondItem="GJT-d9-qvO" secondAttribute="bottom" constant="19" id="YEj-fP-BPe"/>
380-
<constraint firstItem="jme-OU-7GG" firstAttribute="top" secondItem="scn-7e-mlv" secondAttribute="top" constant="29" id="YsL-oL-7FX"/>
380+
<constraint firstItem="jme-OU-7GG" firstAttribute="top" secondItem="scn-7e-mlv" secondAttribute="top" constant="29" placeholder="YES" id="YsL-oL-7FX"/>
381381
<constraint firstItem="YmL-o7-wzA" firstAttribute="top" secondItem="jme-OU-7GG" secondAttribute="top" constant="-2" id="cfW-zf-bJk"/>
382382
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Gny-ev-Via" secondAttribute="bottom" constant="20" symbolic="YES" id="ekP-Wn-wjY"/>
383383
<constraint firstItem="Yew-yF-ZWD" firstAttribute="top" secondItem="N9Z-iX-jvK" secondAttribute="top" constant="-2" id="fxi-jB-18m"/>
@@ -398,6 +398,7 @@
398398
<outlet property="dividerF" destination="Ljr-be-BXp" id="rRz-AP-0Dd"/>
399399
<outlet property="downloadsFolderIntroLabel" destination="YmL-o7-wzA" id="qdP-fS-wMy"/>
400400
<outlet property="downloadsFolderLabel" destination="eKi-p7-aRV" id="9xi-lk-ZjI"/>
401+
<outlet property="downloadsStackView" destination="jme-OU-7GG" id="sIY-CY-bkM"/>
401402
<outlet property="enableUserDataSyncLabel" destination="goO-DA-n9P" id="juP-k6-qjZ"/>
402403
<outlet property="enableUserDataSyncSwitch" destination="SF8-ZN-I8k" id="e7r-tv-jPV"/>
403404
<outlet property="enableWWDCAgentSwitch" destination="Vk1-ZC-mPn" id="u9F-PR-puc"/>
@@ -519,7 +520,7 @@
519520
<constraints>
520521
<constraint firstItem="MB9-co-AOw" firstAttribute="leading" secondItem="CYB-Js-nMq" secondAttribute="leading" id="96z-R2-U73"/>
521522
<constraint firstAttribute="trailing" secondItem="4tF-Jf-uRi" secondAttribute="trailing" id="KpR-vb-ubQ"/>
522-
<constraint firstItem="EB1-cz-f3w" firstAttribute="top" secondItem="5hl-wi-FfU" secondAttribute="top" constant="22" id="L10-pu-XBx"/>
523+
<constraint firstItem="EB1-cz-f3w" firstAttribute="top" secondItem="5hl-wi-FfU" secondAttribute="top" constant="22" placeholder="YES" id="L10-pu-XBx"/>
523524
<constraint firstItem="4tF-Jf-uRi" firstAttribute="leading" secondItem="5hl-wi-FfU" secondAttribute="leading" constant="39" id="R85-Mx-vUo"/>
524525
<constraint firstItem="CYB-Js-nMq" firstAttribute="top" secondItem="jzw-u5-Zjs" secondAttribute="bottom" constant="19" id="Y9R-1o-KAR"/>
525526
<constraint firstItem="MB9-co-AOw" firstAttribute="top" secondItem="4tF-Jf-uRi" secondAttribute="bottom" constant="19" id="gXK-Yz-Lbr"/>
@@ -534,6 +535,7 @@
534535
<connections>
535536
<outlet property="includeAppBannerInClipsSwitch" destination="Xtm-cF-96x" id="TMN-ja-MJe"/>
536537
<outlet property="skipBackAndForwardBy30SecondsSwitch" destination="JEt-pq-hrP" id="CqT-YK-nZZ"/>
538+
<outlet property="skipIntroStackView" destination="EB1-cz-f3w" id="dKH-G5-mrm"/>
537539
<outlet property="skipIntroSwitch" destination="yfb-Pt-KGS" id="ZvD-Nu-XWb"/>
538540
</connections>
539541
</viewController>
@@ -558,7 +560,7 @@
558560
<constraint firstAttribute="width" constant="231" id="D34-Ex-Ec6"/>
559561
</constraints>
560562
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="jHp-TC-67d">
561-
<font key="font" metaFont="system" size="12"/>
563+
<font key="font" metaFont="cellTitle"/>
562564
<string key="title">This will run an agent in the background that gives other apps the opportunity to access your content from the WWDC app. Currently, this is supported by the Raycast app. If you'd like to integrate WWDC content into your app, open an issue on Github describing your app and what you'd like to do.</string>
563565
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
564566
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -570,7 +572,7 @@
570572
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I1j-2K-qhm" customClass="ActionLabel" customModule="WWDC" customModuleProvider="target">
571573
<rect key="frame" x="-2" y="23" width="49" height="15"/>
572574
<textFieldCell key="cell" lineBreakMode="clipping" title="Raycast" id="x44-Wc-9ts">
573-
<font key="font" metaFont="system" size="12"/>
575+
<font key="font" metaFont="cellTitle"/>
574576
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
575577
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
576578
</textFieldCell>
@@ -581,7 +583,7 @@
581583
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6PJ-m2-K7t" customClass="ActionLabel" customModule="WWDC" customModuleProvider="target">
582584
<rect key="frame" x="-2" y="0.0" width="104" height="15"/>
583585
<textFieldCell key="cell" lineBreakMode="clipping" title="WWDC on Github" id="IBm-XP-HKb">
584-
<font key="font" metaFont="system" size="12"/>
586+
<font key="font" metaFont="cellTitle"/>
585587
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
586588
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
587589
</textFieldCell>

WWDC/ScheduleContainerViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Cocoa
1010
import RxSwift
1111
import RxCocoa
1212

13-
final class ScheduleContainerViewController: WWDCMainWindowContentViewController {
13+
final class ScheduleContainerViewController: WWDCWindowContentViewController {
1414

1515
let splitViewController: SessionsSplitViewController
1616

WWDC/SessionDetailsViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Cocoa
1010
import RxSwift
1111
import RxCocoa
1212

13-
final class SessionDetailsViewController: WWDCMainWindowContentViewController {
13+
final class SessionDetailsViewController: WWDCWindowContentViewController {
1414

1515
private struct Metrics {
1616
static let padding: CGFloat = 46

WWDC/WWDCTabViewController.swift

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,21 @@ class WWDCTabViewController<Tab: WWDCTab>: NSTabViewController where Tab.RawValu
5151
}
5252
}
5353

54-
let tab = Tab(rawValue: selectedTabViewItemIndex)!
54+
guard let tab = Tab(rawValue: selectedTabViewItemIndex) else {
55+
assertionFailure("selectedTabViewItemIndex of \(selectedTabViewItemIndex) doesn't correspond to a valid tab item")
56+
return
57+
}
5558

5659
activeTabVar.accept(tab)
5760

58-
(view.window as? WWDCWindow)?.setTitleBarHidden(tab.hidesWindowTitleBar, animated: true)
61+
updateWindowTitleBarVisibility(for: tab)
5962
}
6063
}
6164

65+
private func updateWindowTitleBarVisibility(for tab: Tab, animated: Bool = true) {
66+
(view.window as? WWDCWindow)?.setTitleBarHidden(tab.hidesWindowTitleBar, animated: animated)
67+
}
68+
6269
private(set) lazy var tabBar = WWDCTabViewControllerTabBar()
6370

6471
init(windowController: WWDCWindowController) {
@@ -94,7 +101,9 @@ class WWDCTabViewController<Tab: WWDCTab>: NSTabViewController where Tab.RawValu
94101
itemView.target = self
95102
itemView.action = #selector(changeTab)
96103

97-
itemView.state = (tabViewItems.firstIndex(of: tabViewItem) == selectedTabViewItemIndex) ? .on : .off
104+
let isActiveTab = (tabViewItems.firstIndex(of: tabViewItem) == selectedTabViewItemIndex)
105+
106+
itemView.state = isActiveTab ? .on : .off
98107

99108
tabBar.addItem(itemView)
100109
}
@@ -133,4 +142,12 @@ class WWDCTabViewController<Tab: WWDCTab>: NSTabViewController where Tab.RawValu
133142
loadingView?.hide()
134143
}
135144

145+
override func viewDidAppear() {
146+
super.viewDidAppear()
147+
148+
if let tab = Tab(rawValue: selectedTabViewItemIndex) {
149+
updateWindowTitleBarVisibility(for: tab, animated: false)
150+
}
151+
}
152+
136153
}

WWDC/WWDCMainWindowContentViewController.swift renamed to WWDC/WWDCWindowContentViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Cocoa
22

3-
class WWDCMainWindowContentViewController: NSViewController {
3+
class WWDCWindowContentViewController: NSViewController {
44

55
var topSafeAreaPadding: CGFloat { 22 }
66

0 commit comments

Comments
 (0)