Skip to content
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

Remove Get dependency #64

Closed
wants to merge 16 commits into from
Closed
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
library:
runs-on: macos-latest
runs-on: macos-13
strategy:
matrix:
platform:
Expand All @@ -25,13 +25,21 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Select Xcode 14.3
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Run tests
run: PLATFORM="${{ matrix.platform }}" make test-library

example:
runs-on: macos-latest
runs-on: macos-13
strategy:
matrix:
platform:
- iOS Simulator,name=iPhone 14 Pro Max
steps:
- uses: actions/checkout@v3
- name: Select Xcode 14.3
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Copy Secrets file
run: cp Examples/Shared/Sources/_Secrets.swift Examples/Shared/Sources/Secrets.swift
- name: Build example
Expand Down
7 changes: 4 additions & 3 deletions .swiftpm/xcode/xcshareddata/xcschemes/GoTrue.xcscheme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -26,7 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
37 changes: 14 additions & 23 deletions Examples/Shared/Sources/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,30 @@ import SwiftUI
struct AppView: View {
@Environment(\.goTrueClient) private var client
@State private var session: Session?
@State private var clientInitialized = false

var body: some View {
if clientInitialized {
NavigationView {
if let session {
SessionView(session: session)
} else {
List {
NavigationLink("Auth with Email and Password") {
AuthWithEmailAndPasswordView()
}
NavigationView {
if let session {
SessionView(session: session)
} else {
List {
NavigationLink("Auth with Email and Password") {
AuthWithEmailAndPasswordView()
}

NavigationLink("Sign in with Apple") {
SignInWithAppleView()
}
NavigationLink("Sign in with Apple") {
SignInWithAppleView()
}
.listStyle(.plain)
.navigationTitle("Examples")
}
.listStyle(.plain)
.navigationTitle("Examples")
}
.task { await observeSession() }
} else {
ProgressView()
.task {
await client.initialize()
clientInitialized = true
}
}
.task { await observeSession() }
}

private func observeSession() async {
for await _ in client.authEventChange {
for await _ in client.authEventChange.values {
session = try? await client.session
}
}
Expand Down
29 changes: 15 additions & 14 deletions Examples/Shared/Sources/SessionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,21 @@ struct SessionView: View {
struct SessionView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
SessionView(session: .init(
accessToken: "placeholder",
tokenType: "bearer",
expiresIn: 3600,
refreshToken: "refreshToken",
user: User(
id: UUID(),
appMetadata: [:],
userMetadata: [:],
aud: "",
createdAt: Date(),
updatedAt: Date()
)
))
SessionView(
session: .init(
accessToken: "placeholder",
tokenType: "bearer",
expiresIn: 3600,
refreshToken: "refreshToken",
user: User(
id: UUID(),
appMetadata: [:],
userMetadata: [:],
aud: "",
createdAt: Date(),
updatedAt: Date()
)
))
}
}
}
5 changes: 3 additions & 2 deletions Examples/Shared/Sources/SignInWithAppleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ struct SignInWithAppleView: View {
return
}

guard let idToken = credential.identityToken
.flatMap({ String(data: $0, encoding: .utf8) })
guard
let idToken = credential.identityToken
.flatMap({ String(data: $0, encoding: .utf8) })
else {
return
}
Expand Down
26 changes: 13 additions & 13 deletions GoTrue.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"pins" : [
{
"identity" : "get",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/Get",
"state" : {
"revision" : "12830cc64f31789ae6f4352d2d51d03a25fc3741",
"version" : "2.1.6"
}
},
{
"identity" : "keychainaccess",
"kind" : "remoteSourceControl",
Expand All @@ -28,12 +19,21 @@
}
},
{
"identity" : "urlqueryencoder",
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "5b356adceabff6ca027f6574aac79e9fee145d26",
"version" : "1.14.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/URLQueryEncoder",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "4ce950479707ea109f229d7230ec074a133b15d7",
"version" : "0.2.1"
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
"version" : "509.0.0"
}
}
],
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ PLATFORM ?= iOS Simulator,name=iPhone 14 Pro Max

test-library:
xcodebuild test \
-workspace GoTrue.xcworkspace \
-scheme GoTrue \
-destination platform="$(PLATFORM)" || exit 1;

build-example:
xcodebuild build \
-workspace GoTrue.xcworkspace \
-scheme Examples \
-destination platform="$(PLATFORM)" || exit 1;

format:
@swiftformat .
@swift format -i -r .

.PHONY: test-library build-example format test-library
26 changes: 13 additions & 13 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"pins" : [
{
"identity" : "get",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/Get",
"state" : {
"revision" : "7209fdb015686fd90918b2037cb2039206405bd3",
"version" : "2.1.5"
}
},
{
"identity" : "keychainaccess",
"kind" : "remoteSourceControl",
Expand All @@ -28,12 +19,21 @@
}
},
{
"identity" : "urlqueryencoder",
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "5b356adceabff6ca027f6574aac79e9fee145d26",
"version" : "1.14.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/URLQueryEncoder",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "4cc975d4d075d0e62699a796a08284e217d4ee93",
"version" : "0.2.0"
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
"version" : "509.0.0"
}
}
],
Expand Down
17 changes: 9 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,29 @@ let package = Package(
.tvOS(.v13),
],
products: [
.library(name: "GoTrue", targets: ["GoTrue"]),
.library(name: "GoTrue", targets: ["GoTrue"])
],
dependencies: [
.package(url: "https://github.com/kean/Get", from: "2.1.4"),
.package(url: "https://github.com/kean/URLQueryEncoder", from: "0.2.0"),
.package(url: "https://github.com/kishikawakatsumi/KeychainAccess", from: "4.2.2"),
.package(url: "https://github.com/WeTransfer/Mocker", from: "3.0.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.0.0"),
],
targets: [
.target(
name: "GoTrue",
dependencies: [
.product(name: "Get", package: "Get"),
.product(name: "KeychainAccess", package: "KeychainAccess"),
.product(name: "URLQueryEncoder", package: "URLQueryEncoder"),
.product(name: "KeychainAccess", package: "KeychainAccess")
]
),
.testTarget(
name: "GoTrueTests",
dependencies: ["GoTrue", "Mocker"],
dependencies: [
"GoTrue",
"Mocker",
.product(name: "SnapshotTesting", package: "swift-snapshot-testing"),
],
resources: [
.process("Resources"),
.process("Resources")
]
),
]
Expand Down
8 changes: 0 additions & 8 deletions Sources/GoTrue/AuthChangeEvent.swift

This file was deleted.

Loading