-
Notifications
You must be signed in to change notification settings - Fork 1
feat: implement token update #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,22 +23,9 @@ cat <<EOT > ./IntegrationTester/Env.plist | |
| </plist> | ||
| EOT | ||
|
|
||
| # Find iPhone 16 Pro device ID from the latest iOS version | ||
| DEVICE_ID=$(xcrun simctl list devices available | grep "iPhone 16 Pro" | tail -1 | grep -oE '[A-F0-9-]{36}') | ||
|
|
||
| if [ -z "$DEVICE_ID" ]; then | ||
| echo "Error: No iPhone 16 Pro simulator found" | ||
| xcrun simctl list devices available | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Using device ID: $DEVICE_ID" | ||
|
|
||
| xcrun simctl boot "$DEVICE_ID" 2>/dev/null || true | ||
|
|
||
| xcodebuild clean test \ | ||
| -project ./IntegrationTester/IntegrationTester.xcodeproj \ | ||
| -scheme IntegrationTester \ | ||
ddiestra marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| -configuration Debug \ | ||
| -destination "platform=iOS Simulator,id=$DEVICE_ID" \ | ||
| -destination platform="iOS Simulator,OS=18.6,name=iPhone 16 Pro" \ | ||
| | xcpretty | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import Foundation | ||
| import AnyCodable | ||
|
|
||
| extension AnyCodable { | ||
| /// Recursively unwraps `AnyCodable`/`AnyDecodable` values into native Swift types | ||
| /// so that nested dictionaries become `[String: Any]` instead of `[String: AnyDecodable]`. | ||
| func deepUnwrap() -> Any { | ||
| let raw = self.value | ||
| return AnyCodable.unwrap(raw) | ||
| } | ||
|
|
||
| private static func unwrap(_ value: Any) -> Any { | ||
| switch value { | ||
| case let dict as [String: Any]: | ||
| return dict.mapValues { unwrap($0) } | ||
| case let array as [Any]: | ||
| return array.map { unwrap($0) } | ||
| case let codable as AnyCodable: | ||
| return unwrap(codable.value) | ||
| default: | ||
| // Check via Mirror for AnyDecodable (same module, shares _AnyDecodable protocol) | ||
| let mirror = Mirror(reflecting: value) | ||
| if mirror.displayStyle == nil, | ||
| let child = mirror.children.first(where: { $0.label == "value" }) { | ||
| return unwrap(child.value) | ||
| } | ||
| return value | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // | ||
| // UpdateToken.swift | ||
| // | ||
| // | ||
| // Created by Cascade on 02/11/26. | ||
| // | ||
|
|
||
| import AnyCodable | ||
|
|
||
| public struct UpdateToken { | ||
| public var data: [String: Any] | ||
| public var privacy: Privacy? | ||
| public var metadata: [String: String]? | ||
| public var searchIndexes: [String]? | ||
| public var fingerprintExpression: String? | ||
| public var mask: String? | ||
| public var deduplicateToken: Bool? | ||
| public var expiresAt: String? | ||
| public var containers: [String]? | ||
|
|
||
| public init(data: [String: Any], privacy: Privacy? = nil, metadata: [String: String]? = nil, searchIndexes: [String]? = nil, fingerprintExpression: String? = nil, mask: String? = nil, deduplicateToken: Bool? = nil, expiresAt: String? = nil, containers: [String]? = nil) { | ||
| self.data = data | ||
| self.privacy = privacy | ||
| self.metadata = metadata | ||
| self.searchIndexes = searchIndexes | ||
| self.fingerprintExpression = fingerprintExpression | ||
| self.mask = mask | ||
| self.deduplicateToken = deduplicateToken | ||
| self.expiresAt = expiresAt | ||
| self.containers = containers | ||
| } | ||
|
|
||
| func toUpdateTokenRequest() -> UpdateTokenRequest { | ||
| UpdateTokenRequest( | ||
| data: AnyCodable(self.data), | ||
| privacy: self.privacy, | ||
| metadata: self.metadata, | ||
| searchIndexes: self.searchIndexes, | ||
| fingerprintExpression: self.fingerprintExpression, | ||
| mask: AnyCodable(self.mask), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| deduplicateToken: self.deduplicateToken, | ||
| expiresAt: self.expiresAt, | ||
| containers: self.containers | ||
| ) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import Foundation | ||
| import AnyCodable | ||
|
|
||
| internal struct UpdateTokenRequest: Codable { | ||
| var data: AnyCodable? | ||
| var privacy: Privacy? | ||
| var metadata: [String: String]? | ||
| var searchIndexes: [String]? | ||
| var fingerprintExpression: String? | ||
| var mask: AnyCodable? | ||
| var deduplicateToken: Bool? | ||
| var expiresAt: String? | ||
| var containers: [String]? | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.