<commit_before>//
//  AppCoordinator+SessionActions.swift
//  WWDC
//
//  Created by <NAME> on 06/05/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Cocoa
import RealmSwift
import RxSwift
import ConfCore
import PlayerUI

extension AppCoordinator: SessionActionsViewControllerDelegate {
    
    func sessionActionsDidSelectFavorite(_ sender: NSView?) {
        guard let viewModel = selectedSessionValue else { return }
        
        if viewModel.isFavorite {
            storage.removeFavorite(for: viewModel.session)
        } else {
            storage.createFavorite(for: viewModel.session)
        }
    }
    
    func sessionActionsDidSelectDownload(_ sender: NSView?) {
        guard let viewModel = selectedSessionValue else { return }
        
        guard let videoAsset = viewModel.session.assets.filter({ $0.assetType == .hdVideo }).first else { return }
        
        downloadManager.download(videoAsset)
    }
    
    func sessionActionsDidSelectShare(_ sender: NSView?) {
        
    }
    
}<commit_msg>Fixed favoriting from the schedule view<commit_after>//
//  AppCoordinator+SessionActions.swift
//  WWDC
//
//  Created by <NAME> on 06/05/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Cocoa
import RealmSwift
import RxSwift
import ConfCore
import PlayerUI

extension AppCoordinator: SessionActionsViewControllerDelegate {
    
    func sessionActionsDidSelectFavorite(_ sender: NSView?) {
        guard let viewModel = selectedSessionValue ?? selectedScheduleItemValue else { return }
        
        if viewModel.isFavorite {
            storage.removeFavorite(for: viewModel.session)
        } else {
            storage.createFavorite(for: viewModel.session)
        }
    }
    
    func sessionActionsDidSelectDownload(_ sender: NSView?) {
        guard let viewModel = selectedSessionValue ?? selectedScheduleItemValue else { return }
        
        guard let videoAsset = viewModel.session.assets.filter({ $0.assetType == .hdVideo }).first else { return }
        
        downloadManager.download(videoAsset)
    }
    
    func sessionActionsDidSelectShare(_ sender: NSView?) {
        
    }
    
}
{'fraction_non_alphanumeric': 0.08455882352941177, 'fraction_numerical': 0.01011029411764706, 'mean_word_length': 2.640468227424749, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '237573', 'n_tokens_mistral': 609, 'n_tokens_neox': 577, 'n_words': 145}