Skip to content

Commit 56b5d61

Browse files
author
Guilherme Souza
authored
Provide default value for 'identity_data' (#58)
* Provide default value for 'identity_data' * Fix tests * Remove macCatalyst test * Run CI on latest version
1 parent a972c99 commit 56b5d61

File tree

5 files changed

+16
-22
lines changed

5 files changed

+16
-22
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,17 @@ concurrency:
1414

1515
jobs:
1616
library:
17-
runs-on: macos-12
18-
strategy:
19-
matrix:
20-
xcode: ["14.1"]
17+
runs-on: macos-latest
2118
steps:
2219
- uses: actions/checkout@v3
23-
- name: Select Xcode ${{ matrix.xcode }}
24-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
2520
- name: Run tests
2621
run: make test-library
2722

2823
example:
29-
runs-on: macos-12
30-
strategy:
31-
matrix:
32-
xcode: ["14.1"]
24+
runs-on: macos-latest
3325
steps:
3426
- uses: actions/checkout@v3
35-
- name: Select Xcode ${{ matrix.xcode }}
36-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
3727
- name: Copy Secrets file
3828
run: cp Examples/Shared/Sources/_Secrets.swift Examples/Shared/Sources/Secrets.swift
3929
- name: Build example
4030
run: make build-example
41-
42-
# examples:
43-
# runs-on: macos-12
44-
# steps:
45-
# - uses: actions/checkout@v3
46-
# - name: Run tests
47-
# run: make test-examples

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PLATFORM_TVOS = tvOS Simulator,name=Apple TV
55
PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 7 (45mm)
66

77
test-library:
8-
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_MAC_CATALYST)" "$(PLATFORM_TVOS)" "$(PLATFORM_WATCHOS)"; do \
8+
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_TVOS)" "$(PLATFORM_WATCHOS)"; do \
99
xcodebuild test \
1010
-workspace GoTrue.xcworkspace \
1111
-scheme GoTrue \

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.6
1+
// swift-tools-version:5.7
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

Sources/GoTrue/Types.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,17 @@ public struct UserIdentity: Codable, Hashable, Identifiable {
278278
case lastSignInAt = "last_sign_in_at"
279279
case updatedAt = "updated_at"
280280
}
281+
282+
public init(from decoder: Decoder) throws {
283+
let container = try decoder.container(keyedBy: CodingKeys.self)
284+
self.id = try container.decode(String.self, forKey: .id)
285+
self.userID = try container.decode(UUID.self, forKey: .userID)
286+
self.identityData = try container.decodeIfPresent([String : AnyJSON].self, forKey: .identityData) ?? [:]
287+
self.provider = try container.decode(String.self, forKey: .provider)
288+
self.createdAt = try container.decode(Date.self, forKey: .createdAt)
289+
self.lastSignInAt = try container.decode(Date.self, forKey: .lastSignInAt)
290+
self.updatedAt = try container.decode(Date.self, forKey: .updatedAt)
291+
}
281292
}
282293

283294
public enum Provider: String, Codable, CaseIterable {

Tests/GoTrueTests/GoTrueTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ final class GoTrueTests: XCTestCase {
9090
)!
9191

9292
var mock = Mock.get(path: "user", json: "user")
93-
mock.onRequestHandler = OnRequestHandler { request in
93+
mock.onRequestHandler = OnRequestHandler(httpBodyType: Session?.self) { request, _ in
9494
let authorizationHeader = request.allHTTPHeaderFields?["Authorization"]
9595
XCTAssertEqual(authorizationHeader, "bearer accesstoken")
9696
}

0 commit comments

Comments
 (0)