-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to control anonymousId values. (#327)
* Add ability to control anonymousId values. * Removed singleton aspect of the initial implementation. * Adjusted test * CI checking * Another CI check * Another CI run * Revised failing test * Adjusted timing based tests.
- Loading branch information
Showing
7 changed files
with
187 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Noncodable.swift | ||
// | ||
// | ||
// Created by Brandon Sneed on 4/17/24. | ||
// | ||
|
||
import Foundation | ||
|
||
@propertyWrapper | ||
internal struct Noncodable<T>: Codable { | ||
public var wrappedValue: T? | ||
public init(wrappedValue: T?) { | ||
self.wrappedValue = wrappedValue | ||
} | ||
public init(from decoder: Decoder) throws { | ||
self.wrappedValue = nil | ||
} | ||
public func encode(to encoder: Encoder) throws { | ||
// Do nothing | ||
} | ||
} | ||
|
||
extension KeyedDecodingContainer { | ||
internal func decode<T>(_ type: Noncodable<T>.Type, forKey key: Self.Key) throws -> Noncodable<T> { | ||
return Noncodable(wrappedValue: nil) | ||
} | ||
} | ||
|
||
extension KeyedEncodingContainer { | ||
internal mutating func encode<T>(_ value: Noncodable<T>, forKey key: KeyedEncodingContainer<K>.Key) throws { | ||
// Do nothing | ||
} | ||
} |
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