File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed
Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ public class FirewrapAuth {
6060 public static var userName : String ? { Auth . auth ( ) . currentUser? . displayName }
6161 public static var userEmail : String ? { Auth . auth ( ) . currentUser? . email }
6262
63+ public static func getIDToken( ) async throws -> String ? {
64+ try await Auth . auth ( ) . currentUser? . getIDToken ( )
65+ }
66+
6367 public static var providers : [ FirewrapAuthProvider ] {
6468 guard let providerData = Auth . auth ( ) . currentUser? . providerData else { return [ ] }
6569 var providers : [ FirewrapAuthProvider ] = [ ]
@@ -140,6 +144,11 @@ public class FirewrapAuth {
140144 } else {
141145 printConsole ( " Sign in with Google complete " )
142146 completion ? ( nil )
147+
148+ print ( " JWT " )
149+ Task {
150+ print ( await try ? FirewrapAuth . getIDToken ( ) )
151+ }
143152 }
144153 }
145154 }
Original file line number Diff line number Diff line change 1+ #if canImport(SwiftUI)
2+ import SwiftUI
3+ import GoogleSignIn
4+
5+ public struct WrapperSignInGoogleButton : UIViewRepresentable {
6+
7+ public init ( ) { }
8+
9+ public func makeUIView( context: Context ) -> GIDSignInButton {
10+ return GIDSignInButton ( )
11+ }
12+
13+ public func updateUIView( _ uiView: GIDSignInButton , context: Context ) { }
14+ }
15+ #endif
Original file line number Diff line number Diff line change @@ -23,6 +23,19 @@ public class FirewrapCollection {
2323
2424 // MARK: - Getter
2525
26+ // MARK: Get Count Documents
27+
28+ public func getCountDocuments( completion: @escaping ( Int ? , Error ? ) -> Void ) {
29+ let db = Firestore . firestore ( )
30+ let collection = db. collection ( path)
31+ let countQuery = collection. count
32+ countQuery. getAggregation ( source: . server) { snapshot, error in
33+ completion ( snapshot? . count. intValue, error)
34+ }
35+ }
36+
37+ // MARK: Get Documents
38+
2639 public func getDocuments( _ source: FirewrapSource = . default, completion: @escaping ( [ [ String : Any ] ] ? ) -> Void ) {
2740 let db = Firestore . firestore ( )
2841 db. collection ( path) . getDocuments ( source: source. firebaseValue) { snapshot, error in
@@ -109,7 +122,7 @@ public class FirewrapCollection {
109122 let model = try document. data ( as: T . self)
110123 models. append ( model)
111124 } catch {
112- break
125+ continue
113126 }
114127 }
115128 return models
You can’t perform that action at this time.
0 commit comments