-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Basic Windows & Linux Support (#184)
* Seems to compile and sort of run tests * Fix a few more issues * Fix naming and unneeded import * Get CI a little further * Use platform specific snapshots * More snapshots * Try again with non-Darwin * Turns out we just need a darwin and non-darwin snapshots dir * Fix header look up for client creation * update ci configuration * Skip problematic test on Windows and Linux * Use a supported version of Swift for the linux CI * Go back to specific folders for each platform, it's just easier to deal with * Attempt to disable conversion and skip broken test * Cleaning up the PR a little * Add missing test files * Update tests * Address some PR feedback * Recomment out test * Drop down to see if using a Semaphore works across platforms * Allow threading in a local storage client * Remove defaults from designated initializer and put defaults in platform specific convenience inits * Give linux a convenience init so tests can use it * Remove default local storage * Fix mock generation * Remove old tests * Remove autocanonicalization problems by making Apikey consistent casing. * Re-record all snapshots to prevent auto-canonicalization issues across toolchains * Turn on autocrlf to see if that gets the test snapshots further * fix line endings for snapshots * fix initializer * Remove unneeded testing workaround * Update tests to use empty response where needed * Fix empty implementation to work across platforms * Fix test that breaks to only run if not Windows or Linux * use correct operator * Fix binary packaging * Use URLs and remove convenience * Fix cancellation * fix example * Fix actuallyCancel logic
- Loading branch information
1 parent
3b97d39
commit 37b68d2
Showing
56 changed files
with
534 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Tests/**/__Snapshots__/**/*.txt eol=lf |
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,12 @@ | ||
{ | ||
"cSpell.words": [ | ||
"apikey", | ||
"HTTPURL", | ||
"pkce", | ||
"postgrest", | ||
"preconcurrency", | ||
"Supabase", | ||
"whitespaces", | ||
"xctest" | ||
] | ||
} |
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
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
import Foundation | ||
|
||
// Borrowed from the Vapor project, https://github.com/vapor/vapor/blob/main/Sources/Vapor/Utilities/Array%2BRandom.swift#L14 | ||
extension FixedWidthInteger { | ||
internal static func random() -> Self { | ||
return Self.random(in: .min ... .max) | ||
} | ||
|
||
internal static func random<T>(using generator: inout T) -> Self | ||
where T : RandomNumberGenerator | ||
{ | ||
return Self.random(in: .min ... .max, using: &generator) | ||
} | ||
} | ||
|
||
extension Array where Element: FixedWidthInteger { | ||
internal static func random(count: Int) -> [Element] { | ||
var array: [Element] = .init(repeating: 0, count: count) | ||
(0..<count).forEach { array[$0] = Element.random() } | ||
return array | ||
} | ||
|
||
internal static func random<T>(count: Int, using generator: inout T) -> [Element] | ||
where T: RandomNumberGenerator | ||
{ | ||
var array: [Element] = .init(repeating: 0, count: count) | ||
(0..<count).forEach { array[$0] = Element.random(using: &generator) } | ||
return array | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Foundation | ||
import KeychainAccess | ||
@_spi(Internal) import _Helpers | ||
|
||
struct SessionRefresher: Sendable { | ||
|
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,7 @@ | ||
import Foundation | ||
|
||
public protocol AuthLocalStorage: Sendable { | ||
func store(key: String, value: Data) throws | ||
func retrieve(key: String) throws -> Data? | ||
func remove(key: String) throws | ||
} |
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,28 @@ | ||
#if !os(Windows) && !os(Linux) | ||
import Foundation | ||
@preconcurrency import KeychainAccess | ||
|
||
public struct KeychainLocalStorage: AuthLocalStorage { | ||
private let keychain: Keychain | ||
|
||
public init(service: String, accessGroup: String?) { | ||
if let accessGroup { | ||
keychain = Keychain(service: service, accessGroup: accessGroup) | ||
} else { | ||
keychain = Keychain(service: service) | ||
} | ||
} | ||
|
||
public func store(key: String, value: Data) throws { | ||
try keychain.set(value, key: key) | ||
} | ||
|
||
public func retrieve(key: String) throws -> Data? { | ||
try keychain.getData(key) | ||
} | ||
|
||
public func remove(key: String) throws { | ||
try keychain.remove(key) | ||
} | ||
} | ||
#endif |
Oops, something went wrong.