mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Rename TelegramCore source folder
This commit is contained in:
35
submodules/TelegramCore/Sources/SplitTest.swift
Normal file
35
submodules/TelegramCore/Sources/SplitTest.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
import Foundation
|
||||
#if os(macOS)
|
||||
import PostboxMac
|
||||
#else
|
||||
import Postbox
|
||||
#endif
|
||||
|
||||
import SyncCore
|
||||
|
||||
public protocol SplitTestEvent: RawRepresentable where RawValue == String {
|
||||
}
|
||||
|
||||
public protocol SplitTestConfiguration {
|
||||
static var defaultValue: Self { get }
|
||||
}
|
||||
|
||||
public protocol SplitTest {
|
||||
associatedtype Configuration: SplitTestConfiguration
|
||||
associatedtype Event: SplitTestEvent
|
||||
|
||||
var postbox: Postbox { get }
|
||||
var bucket: String? { get }
|
||||
var configuration: Configuration { get }
|
||||
|
||||
init(postbox: Postbox, bucket: String?, configuration: Configuration)
|
||||
}
|
||||
|
||||
extension SplitTest {
|
||||
public func addEvent(_ event: Self.Event, data: JSON = []) {
|
||||
if let bucket = self.bucket {
|
||||
//TODO: merge additional data
|
||||
addAppLogEvent(postbox: self.postbox, time: Date().timeIntervalSince1970, type: event.rawValue, peerId: nil, data: ["bucket": bucket])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user