File tree Expand file tree Collapse file tree 4 files changed +30
-6
lines changed Expand file tree Collapse file tree 4 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,8 @@ public actor AuthClient {
53
53
service: " supabase.gotrue.swift " ,
54
54
accessGroup: nil
55
55
)
56
- self . encoder = encoder ?? . goTrue
57
- self . decoder = decoder ?? . goTrue
56
+ self . encoder = encoder ?? . auth
57
+ self . decoder = decoder ?? . auth
58
58
self . fetch = fetch
59
59
}
60
60
}
Original file line number Diff line number Diff line change 5
5
// Created by Guilherme Souza on 14/12/23.
6
6
//
7
7
8
+ import Foundation
9
+
8
10
@available ( * , deprecated, renamed: " AuthClient " )
9
11
public typealias GoTrueClient = AuthClient
10
12
@@ -19,3 +21,25 @@ public typealias GoTrueMetaSecurity = AuthMetaSecurity
19
21
20
22
@available ( * , deprecated, renamed: " AuthError " )
21
23
public typealias GoTrueError = AuthError
24
+
25
+ extension JSONEncoder {
26
+ @available (
27
+ * ,
28
+ deprecated,
29
+ message: " Access to the default JSONEncoder instance will be removed on the next major release, please use your own instance of JSONEncoder. "
30
+ )
31
+ public static var goTrue : JSONEncoder {
32
+ auth
33
+ }
34
+ }
35
+
36
+ extension JSONDecoder {
37
+ @available (
38
+ * ,
39
+ deprecated,
40
+ message: " Access to the default JSONDecoder instance will be removed on the next major release, please use your own instance of JSONDecoder. "
41
+ )
42
+ public static var goTrue : JSONDecoder {
43
+ auth
44
+ }
45
+ }
Original file line number Diff line number Diff line change @@ -38,11 +38,11 @@ extension SessionStorage {
38
38
return Self (
39
39
getSession: {
40
40
try localStorage. retrieve ( key: " supabase.session " ) . flatMap {
41
- try JSONDecoder . goTrue . decode ( StoredSession . self, from: $0)
41
+ try JSONDecoder . auth . decode ( StoredSession . self, from: $0)
42
42
}
43
43
} ,
44
44
storeSession: {
45
- try localStorage. store ( key: " supabase.session " , value: JSONEncoder . goTrue . encode ( $0) )
45
+ try localStorage. store ( key: " supabase.session " , value: JSONEncoder . auth . encode ( $0) )
46
46
} ,
47
47
deleteSession: {
48
48
try localStorage. remove ( key: " supabase.session " )
Original file line number Diff line number Diff line change @@ -602,7 +602,7 @@ private let dateFormatter = { () -> ISO8601DateFormatter in
602
602
} ( )
603
603
604
604
extension JSONDecoder {
605
- public static let goTrue = { ( ) -> JSONDecoder in
605
+ static let auth = { ( ) -> JSONDecoder in
606
606
let decoder = JSONDecoder ( )
607
607
decoder. keyDecodingStrategy = . convertFromSnakeCase
608
608
decoder. dateDecodingStrategy = . custom { decoder in
@@ -626,7 +626,7 @@ extension JSONDecoder {
626
626
}
627
627
628
628
extension JSONEncoder {
629
- public static let goTrue = { ( ) -> JSONEncoder in
629
+ static let auth = { ( ) -> JSONEncoder in
630
630
let encoder = JSONEncoder ( )
631
631
encoder. keyEncodingStrategy = . convertToSnakeCase
632
632
encoder. dateEncodingStrategy = . custom { date, encoder in
You can’t perform that action at this time.
0 commit comments