-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from NullIsOne/analytics-proxy
Analytics proxy
- Loading branch information
Showing
13 changed files
with
115 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Sources/KinescopeSDK/Service/Analytic/AnalyticsDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// KinescopeAnalyticsDelegate.swift | ||
// KinescopeSDK | ||
// | ||
// Created by Nikita Korobeinikov on 02.04.2024. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Delegate to listen for analytics sended from ``KinescopeVideoPlayer`` | ||
public protocol KinescopeAnalyticsDelegate { | ||
/// Fired when ``KinescopeVideoPlayer`` is sending any analytics `event` | ||
/// - Parameters: | ||
/// - event: name of the event | ||
/// - data: serialized data in `String` format | ||
func didSendAnalytics(event: String, with data: String) | ||
} |
18 changes: 18 additions & 0 deletions
18
Sources/KinescopeSDK/Service/Analytic/AnalyticsLoggingService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// AnalyticsLoggingService.swift | ||
// KinescopeSDK | ||
// | ||
// Created by Nikita Korobeinikov on 02.04.2024. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Implementation of ``AnalyticsService`` which can delegate sending to client code | ||
final class AnalyticsLoggingService: AnalyticsService { | ||
|
||
func send(event: Analytics_Native) { | ||
Kinescope.analyticDelegate?.didSendAnalytics(event: event.event, | ||
with: event.textFormatString()) | ||
} | ||
|
||
} |
9 changes: 3 additions & 6 deletions
9
...nescopeSDK/Service/AnalyticsService.swift → ...ce/Analytic/AnalyticsNetworkService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Sources/KinescopeSDK/Service/Analytic/AnalyticsProxyService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// AnalyticsProxyService.swift | ||
// KinescopeSDK | ||
// | ||
// Created by Nikita Korobeinikov on 02.04.2024. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Implementation of ``AnalyticsService`` which can delegate sending to other services | ||
final class AnalyticsProxyService: AnalyticsService { | ||
|
||
private let wrappedServices: [AnalyticsService] | ||
|
||
init(wrappedServices: [AnalyticsService]) { | ||
self.wrappedServices = wrappedServices | ||
} | ||
|
||
func send(event: Analytics_Native) { | ||
wrappedServices.forEach { $0.send(event: event) } | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
Sources/KinescopeSDK/Service/Analytic/AnalyticsService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// AnalyticsService.swift | ||
// KinescopeSDK | ||
// | ||
// Created by Artemii Shabanov on 27.04.2021. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol AnalyticsService { | ||
func send(event: Analytics_Native) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters