<commit_before>import Foundation

extension WMFContentGroup {
    public func detailViewControllerForPreviewItemAtIndex(_ index: Int, dataStore: MWKDataStore, theme: Theme) -> UIViewController? {
        switch detailType {
        case .page:
            guard let articleURL = previewArticleURLForItemAtIndex(index) else {
                return nil
            }
            return WMFArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme)
        case .pageWithRandomButton:
            guard let articleURL = previewArticleURLForItemAtIndex(index) else {
                return nil
            }
            return WMFRandomArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme)
        case .gallery:
            guard let date = self.date else {
                return nil
            }
            return WMFPOTDImageGalleryViewController(dates: [date], theme: theme, overlayViewTopBarHidden: false)
        case .story, .event:
            return detailViewControllerWithDataStore(dataStore, theme: theme)
        default:
            return nil
        }
    }
    
    @objc(detailViewControllerWithDataStore:theme:)
    public func detailViewControllerWithDataStore(_ dataStore: MWKDataStore, theme: Theme) -> UIViewController? {
        switch moreType {
        case .pageList:
            guard let articleURLs = contentURLs else {
                return nil
            }
            let vc = ArticleURLListViewController(articleURLs: articleURLs, dataStore: dataStore, contentGroup: self, theme: theme)
            vc.title = moreTitle
            return vc
        case .pageListWithLocation:
            guard let articleURLs = contentURLs else {
                return nil
            }
            return ArticleLocationCollectionViewController(articleURLs: articleURLs, dataStore: dataStore, theme: theme)
        case .news:
            guard let stories = fullContent?.object as? [WMFFeedNewsStory] else {
                return nil
            }
            return NewsViewController(stories: stories, dataStore: dataStore, theme: theme)
        case .onThisDay:
            guard let date = midnightUTCDate, let events = fullContent?.object as? [WMFFeedOnThisDayEvent] else {
                return nil
            }
            return OnThisDayViewController(events: events, dataStore: dataStore, midnightUTCDate: date, theme: theme)
        case .pageWithRandomButton:
            guard let siteURL = siteURL else {
                return nil
            }
            return WMFFirstRandomViewController(siteURL: siteURL, dataStore: dataStore, theme: theme)
        default:
            return nil
        }
    }
}<commit_msg>Fix background color of first random VC, fixes broken transition<commit_after>import Foundation

extension WMFContentGroup {
    public func detailViewControllerForPreviewItemAtIndex(_ index: Int, dataStore: MWKDataStore, theme: Theme) -> UIViewController? {
        switch detailType {
        case .page:
            guard let articleURL = previewArticleURLForItemAtIndex(index) else {
                return nil
            }
            return WMFArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme)
        case .pageWithRandomButton:
            guard let articleURL = previewArticleURLForItemAtIndex(index) else {
                return nil
            }
            return WMFRandomArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme)
        case .gallery:
            guard let date = self.date else {
                return nil
            }
            return WMFPOTDImageGalleryViewController(dates: [date], theme: theme, overlayViewTopBarHidden: false)
        case .story, .event:
            return detailViewControllerWithDataStore(dataStore, theme: theme)
        default:
            return nil
        }
    }
    
    @objc(detailViewControllerWithDataStore:theme:)
    public func detailViewControllerWithDataStore(_ dataStore: MWKDataStore, theme: Theme) -> UIViewController? {
        switch moreType {
        case .pageList:
            guard let articleURLs = contentURLs else {
                return nil
            }
            let vc = ArticleURLListViewController(articleURLs: articleURLs, dataStore: dataStore, contentGroup: self, theme: theme)
            vc.title = moreTitle
            return vc
        case .pageListWithLocation:
            guard let articleURLs = contentURLs else {
                return nil
            }
            return ArticleLocationCollectionViewController(articleURLs: articleURLs, dataStore: dataStore, theme: theme)
        case .news:
            guard let stories = fullContent?.object as? [WMFFeedNewsStory] else {
                return nil
            }
            return NewsViewController(stories: stories, dataStore: dataStore, theme: theme)
        case .onThisDay:
            guard let date = midnightUTCDate, let events = fullContent?.object as? [WMFFeedOnThisDayEvent] else {
                return nil
            }
            return OnThisDayViewController(events: events, dataStore: dataStore, midnightUTCDate: date, theme: theme)
        case .pageWithRandomButton:
            guard let siteURL = siteURL else {
                return nil
            }
            let firstRandom = WMFFirstRandomViewController(siteURL: siteURL, dataStore: dataStore, theme: theme)
            (firstRandom as Themeable).apply(theme: theme)
            return firstRandom
        default:
            return nil
        }
    }
}
{'fraction_non_alphanumeric': 0.06173725771715721, 'fraction_numerical': 0.0, 'mean_word_length': 2.1610890527509925, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1561342', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1312, 'n_words': 384}