Skip to content

Commit

Permalink
Wrap up the final fixes I think
Browse files Browse the repository at this point in the history
  • Loading branch information
allenhumphreys committed Jul 2, 2023
1 parent 9faf1e6 commit 9899bac
Show file tree
Hide file tree
Showing 18 changed files with 472 additions and 445 deletions.
9 changes: 2 additions & 7 deletions Packages/ConfCore/ConfCore/Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,6 @@ public final class Storage: Logging, Signposting {
return tracks
}()

public lazy var tracksObservable: some Publisher<Results<Track>, Error> = {
let tracks = self.realm.objects(Track.self).sorted(byKeyPath: "order")

return tracks.collectionPublisher
}()

public lazy var tracksShallowObservable: some Publisher<Results<Track>, Error> = {
let tracks = self.realm.objects(Track.self).sorted(byKeyPath: "order")

Expand Down Expand Up @@ -618,10 +612,11 @@ public final class Storage: Logging, Signposting {
return realm.objects(Event.self).sorted(byKeyPath: "startDate", ascending: false).toArray()
}

public var eventsForFiltering: Results<Event> {
public var eventsForFilteringShallowPublisher: some Publisher<Results<Event>, Error> {
return realm.objects(Event.self)
.filter("SUBQUERY(sessions, $session, ANY $session.assets.rawAssetType == %@).@count > %d", SessionAssetType.streamingVideo.rawValue, 0)
.sorted(byKeyPath: "startDate", ascending: false)
.collectionChangedPublisher
}

public var allSessionTypesShallowPublisher: some Publisher<[String], Error> {
Expand Down
4 changes: 4 additions & 0 deletions WWDC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
4DDF6A782177A00C008E5539 /* DownloadsManagementTableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DDF6A772177A00C008E5539 /* DownloadsManagementTableCellView.swift */; };
4DF6641620C8A85000FD1684 /* SessionsTableViewController+SupportingTypesAndExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DF6641520C8A85000FD1684 /* SessionsTableViewController+SupportingTypesAndExtensions.swift */; };
9104BDFE2A25165A00860C08 /* Combine+UI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9104BDFD2A25165A00860C08 /* Combine+UI.swift */; };
911C72C92A52169A00CB3757 /* CombineLatestMany.swift in Sources */ = {isa = PBXBuildFile; fileRef = 911C72C82A52169A00CB3757 /* CombineLatestMany.swift */; };
914367202A4C6B0E004E4392 /* Sequence+GroupedBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9143671F2A4C6B0E004E4392 /* Sequence+GroupedBy.swift */; };
91C2A0BC2A4DE9B60049B6B7 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 91C2A0BB2A4DE9B60049B6B7 /* OrderedCollections */; };
91EF6A2A2A33FBF8003A71A3 /* Realm+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91EF6A292A33FBF8003A71A3 /* Realm+Combine.swift */; };
Expand Down Expand Up @@ -287,6 +288,7 @@
4DF6641520C8A85000FD1684 /* SessionsTableViewController+SupportingTypesAndExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SessionsTableViewController+SupportingTypesAndExtensions.swift"; sourceTree = "<group>"; };
91037C8C2A32AF62009AF15E /* Transcripts */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Transcripts; path = Packages/Transcripts; sourceTree = "<group>"; };
9104BDFD2A25165A00860C08 /* Combine+UI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Combine+UI.swift"; sourceTree = "<group>"; };
911C72C82A52169A00CB3757 /* CombineLatestMany.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombineLatestMany.swift; sourceTree = "<group>"; };
9143671F2A4C6B0E004E4392 /* Sequence+GroupedBy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+GroupedBy.swift"; sourceTree = "<group>"; };
91EF6A292A33FBF8003A71A3 /* Realm+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Realm+Combine.swift"; sourceTree = "<group>"; };
DD0159A61ECFE26200F980F1 /* DeepLink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeepLink.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -794,6 +796,7 @@
DDA7B7342484416B00F86668 /* CompositionalLayoutBackgroundSwizzler.m */,
91EF6A292A33FBF8003A71A3 /* Realm+Combine.swift */,
9143671F2A4C6B0E004E4392 /* Sequence+GroupedBy.swift */,
911C72C82A52169A00CB3757 /* CombineLatestMany.swift */,
);
name = Util;
sourceTree = "<group>";
Expand Down Expand Up @@ -1422,6 +1425,7 @@
DD0159CF1ED0CD3A00F980F1 /* PreferencesWindowController.swift in Sources */,
F44C823C2A22B90600FDE980 /* RemoteImage.swift in Sources */,
F44C82332A22879000FDE980 /* TitleBarBlurFadeView.swift in Sources */,
911C72C92A52169A00CB3757 /* CombineLatestMany.swift in Sources */,
F4D0F0362A2012C700C74B50 /* VisualEffectDebugger.m in Sources */,
DDC678191EDB2CD300A4E19C /* ActionLabel.swift in Sources */,
DD876D351EC2A7410058EE3B /* ImageDownloadCenter.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion WWDC.xcodeproj/xcshareddata/xcschemes/WWDC.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--delorean 2018-06-07&apos;T&apos;12:00:00-06:00"
argument = "--delorean 2023-06-07&apos;T&apos;12:00:00-06:00"
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
Expand Down
14 changes: 7 additions & 7 deletions WWDC/AppCoordinator+SessionActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import OSLog
extension AppCoordinator: SessionActionsViewControllerDelegate {

func sessionActionsDidSelectCancelDownload(_ sender: NSView?) {
guard let viewModel = selectedViewModelRegardlessOfTab else { return }
guard let viewModel = activeTabSelectedSessionViewModel else { return }

DownloadManager.shared.cancelDownloads([viewModel.session])
}

func sessionActionsDidSelectFavorite(_ sender: NSView?) {
guard let session = selectedViewModelRegardlessOfTab?.session else { return }
guard let session = activeTabSelectedSessionViewModel?.session else { return }

storage.toggleFavorite(on: session)
}

func sessionActionsDidSelectSlides(_ sender: NSView?) {
guard let viewModel = selectedViewModelRegardlessOfTab else { return }
guard let viewModel = activeTabSelectedSessionViewModel else { return }

guard let slidesAsset = viewModel.session.asset(ofType: .slides) else { return }

Expand All @@ -38,13 +38,13 @@ extension AppCoordinator: SessionActionsViewControllerDelegate {
}

func sessionActionsDidSelectDownload(_ sender: NSView?) {
guard let viewModel = selectedViewModelRegardlessOfTab else { return }
guard let viewModel = activeTabSelectedSessionViewModel else { return }

DownloadManager.shared.download([viewModel.session])
}

func sessionActionsDidSelectDeleteDownload(_ sender: NSView?) {
guard let viewModel = selectedViewModelRegardlessOfTab else { return }
guard let viewModel = activeTabSelectedSessionViewModel else { return }

let alert = WWDCAlert.create()

Expand All @@ -71,7 +71,7 @@ extension AppCoordinator: SessionActionsViewControllerDelegate {

func sessionActionsDidSelectShare(_ sender: NSView?) {
guard let sender = sender else { return }
guard let viewModel = selectedViewModelRegardlessOfTab else { return }
guard let viewModel = activeTabSelectedSessionViewModel else { return }

guard let webpageAsset = viewModel.session.asset(ofType: .webpage) else { return }

Expand Down Expand Up @@ -142,7 +142,7 @@ extension Storage {

extension AppCoordinator {
@objc func sessionActionsDidSelectCalendar(_ sender: NSView?) {
guard let viewModel = selectedViewModelRegardlessOfTab else { return }
guard let viewModel = activeTabSelectedSessionViewModel else { return }

Task { @MainActor in
do {
Expand Down
6 changes: 6 additions & 0 deletions WWDC/AppCoordinator+SessionTableViewContextMenuActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ extension AppCoordinator: SessionsTableViewControllerDelegate {
}
}

func sessionTableViewContextMenuActionRemoveDownload(viewModels: [SessionViewModel]) {
viewModels.forEach { viewModel in
DownloadManager.shared.deleteDownloadedFile(for: viewModel.session)
}
}

func sessionTableViewContextMenuActionRevealInFinder(viewModels: [SessionViewModel]) {
guard let firstSession = viewModels.first?.session else { return }
guard let localURL = DownloadManager.shared.downloadedFileURL(for: firstSession) else { return }
Expand Down
8 changes: 4 additions & 4 deletions WWDC/AppCoordinator+Shelf.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension AppCoordinator: ShelfViewControllerDelegate {
guard currentPlaybackViewModel != nil else { return }
guard let playerController = currentPlayerController else { return }

playerOwnerTab.flatMap(shelf(for:))?.playerContainer.animator().isHidden = playerOwnerSessionIdentifier != selectedViewModelRegardlessOfTab?.identifier
playerOwnerTab.flatMap(shelf(for:))?.playerContainer.animator().isHidden = playerOwnerSessionIdentifier != activeTabSelectedSessionViewModel?.identifier

// Everything after this point is for automatically entering PiP

Expand All @@ -45,7 +45,7 @@ extension AppCoordinator: ShelfViewControllerDelegate {
guard !playerController.playerView.isInFullScreenPlayerWindow else { return }

// autopip only activates if the user is leaving the currently playing session
guard activeTab != playerOwnerTab || playerOwnerSessionIdentifier != selectedViewModelRegardlessOfTab?.identifier else { return }
guard activeTab != playerOwnerTab || playerOwnerSessionIdentifier != activeTabSelectedSessionViewModel?.identifier else { return }

// if the user selected a different session/tab during playback, we move the player to PiP mode and hide the player on the shelf
if !playerController.playerView.isInPictureInPictureMode {
Expand All @@ -65,7 +65,7 @@ extension AppCoordinator: ShelfViewControllerDelegate {
tabController.activeTab = playerOwnerTab

// Reveal the session
if playerOwnerSessionIdentifier != selectedViewModelRegardlessOfTab?.identifier {
if playerOwnerSessionIdentifier != activeTabSelectedSessionViewModel?.identifier {
currentListController?.select(session: SessionIdentifier(identifier))
}

Expand All @@ -80,7 +80,7 @@ extension AppCoordinator: ShelfViewControllerDelegate {
guard let viewModel = shelfController.viewModel else { return }

playerOwnerTab = activeTab
playerOwnerSessionIdentifier = selectedViewModelRegardlessOfTab?.identifier
playerOwnerSessionIdentifier = activeTabSelectedSessionViewModel?.identifier

do {
let playbackViewModel = try PlaybackViewModel(sessionViewModel: viewModel, storage: storage)
Expand Down
Loading

0 comments on commit 9899bac

Please sign in to comment.