deep-linking-sample/Apps/Wikipedia/WMF Framework/WMFContentGroup+EventLogging.swift

39 lines
1.1 KiB
Swift
Raw Permalink Normal View History

import Foundation
@objc public extension WMFContentGroup {
var eventLoggingLabel: EventLoggingLabel? {
switch contentGroupKind {
case .featuredArticle:
return .featuredArticle
case .topRead:
return .topRead
case .onThisDay:
return .onThisDay
case .random:
return .random
case .news:
return .news
case .relatedPages:
return .relatedPages
case .continueReading:
return .continueReading
case .locationPlaceholder:
fallthrough
case .location:
return .location
case .mainPage:
return .mainPage
case .pictureOfTheDay:
return .pictureOfTheDay
case .announcement:
guard let announcement = contentPreview as? WMFAnnouncement else {
return .announcement
}
return announcement.placement == "article" ? .articleAnnouncement : .announcement
default:
return nil
}
}
}