Skip to content

Commit

Permalink
Polish implementation and documentation (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos authored Apr 2, 2024
1 parent 3dc84c7 commit 3e4ff5e
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Demo/Sources/Model/Media.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ extension Media {
)
},
trackerAdapters: [
DemoTracker.adapter { media in
DemoTracker.Metadata(title: media.title)
DemoTracker.adapter { metadata in
DemoTracker.Metadata(title: metadata.title)
}
]
)
Expand Down
4 changes: 3 additions & 1 deletion Sources/Analytics/Analytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public class Analytics {

/// Starts analytics with the specified configuration.
///
/// - Parameter configuration: The configuration to use.
/// - Parameters:
/// - configuration: The configuration to use.
/// - dataSource: The data source to use.
///
/// This method must be called from your `UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:)`
/// delegate method implementation, otherwise the behavior is undefined.
Expand Down
5 changes: 1 addition & 4 deletions Sources/Analytics/CommandersAct/CommandersActEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ public struct CommandersActEvent {
/// - labels: Additional information associated with the event.
///
/// Custom labels which might accidentally override official labels will be ignored.
public init(
name: String,
labels: [String: String] = [:]
) {
public init(name: String, labels: [String: String] = [:]) {
assert(!name.isBlank, "A name is required")
self.name = name
self.labels = labels
Expand Down
2 changes: 1 addition & 1 deletion Sources/Analytics/CommandersAct/CommandersActGlobals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public struct CommandersActGlobals {
/// Creates Commanders Act global labels.
///
/// - Parameters:
/// - consentServices: The list of service allowed.
/// - consentServices: The list of services for which the user provided consent.
/// - labels: Additional information associated with the global labels.
public init(consentServices: [String], labels: [String: String]) {
self.labels = labels.merging([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct CommandersActPageView {
///
/// - Parameters:
/// - name: The page name.
/// - type: The page type (e.g. Article).
/// - type: The page type (e.g. _Article_).
/// - labels: Additional information associated with the page view.
/// - levels: The page levels.
///
Expand Down
15 changes: 8 additions & 7 deletions Sources/Analytics/CommandersAct/CommandersActService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ final class CommandersActService {

func start(with configuration: Analytics.Configuration) {
vendor = configuration.vendor
guard let serverSide = ServerSide(siteID: 3666, andSourceKey: configuration.sourceKey) else { return }
serverSide.addPermanentData("app_library_version", withValue: Analytics.version)
serverSide.addPermanentData("navigation_app_site_name", withValue: configuration.appSiteName)
serverSide.addPermanentData("navigation_device", withValue: Self.device())
serverSide.enableRunningInBackground()

if let serverSide = ServerSide(siteID: 3666, andSourceKey: configuration.sourceKey) {
serverSide.addPermanentData("app_library_version", withValue: Analytics.version)
serverSide.addPermanentData("navigation_app_site_name", withValue: configuration.appSiteName)
serverSide.addPermanentData("navigation_device", withValue: Self.device())
serverSide.enableRunningInBackground()
self.serverSide = serverSide
}

// Use the legacy V4 identifier as unique identifier in V5.
TCDevice.sharedInstance().sdkID = TCPredefinedVariables.sharedInstance().uniqueIdentifier()
TCPredefinedVariables.sharedInstance().useLegacyUniqueIDForAnonymousID()

self.serverSide = serverSide
}

func trackPageView(_ pageView: CommandersActPageView) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreBusiness/Model/Chapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public struct Chapter: Decodable {

/// The chapter image URL.
///
/// Use `SRGDataProvider.imagePublisher(for:width:)` to obtain a scaled downloadable version.
/// Use `DataProvider.imagePublisher(for:width:)` to obtain a scaled downloadable version.
public let imageUrl: URL

/// The content type.
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions Sources/Player/UserInterface/RoutePickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public extension RoutePickerView {
return view
}
}

#Preview("Audio") {
RoutePickerView()
}
Expand Down
1 change: 0 additions & 1 deletion Sources/Player/UserInterface/VisibilityTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import UIKit
/// can for example call this method during slider interactions so that the user interface stays visible while the
/// user is still moving the slider.
///
///
/// > Note: For step-by-step integration instructions have a look at the associated <doc:tracking-visibility> tutorial.
@available(iOS 16, *)
@available(tvOS, unavailable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ final class ComScoreTrackerMetadataTests: ComScoreTestCase {
let player = Player(item: .simple(
url: Stream.onDemand.url,
trackerAdapters: [
ComScoreTracker.adapter { _ in
[:]
}
ComScoreTracker.adapter { _ in [:] }
]
))

Expand Down
20 changes: 5 additions & 15 deletions Tests/AnalyticsTests/CommandersAct/CommandersActTrackerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ final class CommandersActTrackerTests: CommandersActTestCase {
let player = Player(item: .simple(
url: Stream.onDemand.url,
trackerAdapters: [
CommandersActTracker.adapter { _ in
[:]
}
CommandersActTracker.adapter { _ in [:] }
]
))

Expand Down Expand Up @@ -133,9 +131,7 @@ final class CommandersActTrackerTests: CommandersActTestCase {
var player: Player? = Player(item: .simple(
url: Stream.shortOnDemand.url,
trackerAdapters: [
CommandersActTracker.adapter { _ in
[:]
}
CommandersActTracker.adapter { _ in [:] }
]
))

Expand All @@ -152,9 +148,7 @@ final class CommandersActTrackerTests: CommandersActTestCase {
let player = Player(item: .simple(
url: Stream.unavailable.url,
trackerAdapters: [
CommandersActTracker.adapter { _ in
[:]
}
CommandersActTracker.adapter { _ in [:] }
]
))

Expand All @@ -167,9 +161,7 @@ final class CommandersActTrackerTests: CommandersActTestCase {
let player = Player(item: .simple(
url: Stream.onDemand.url,
trackerAdapters: [
CommandersActTracker.adapter { _ in
[:]
}
CommandersActTracker.adapter { _ in [:] }
]
))

Expand All @@ -185,9 +177,7 @@ final class CommandersActTrackerTests: CommandersActTestCase {
let player = Player(item: .simple(
url: Stream.onDemand.url,
trackerAdapters: [
CommandersActTracker.adapter { _ in
[:]
}
CommandersActTracker.adapter { _ in [:] }
]
))

Expand Down

0 comments on commit 3e4ff5e

Please sign in to comment.