Skip to content

Commit 71e364f

Browse files
committed
Updated imports.
1 parent 4435abe commit 71e364f

File tree

7 files changed

+46
-16
lines changed

7 files changed

+46
-16
lines changed

Package.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22

33
import PackageDescription
44

5-
let SwiftBoost: Target.Dependency = .product(name: "SwiftBoost", package: "SwiftBoost")
6-
75
let package = Package(
86
name: "Firewrap",
97
defaultLocalization: "en",
10-
platforms: [.iOS(.v13), .macCatalyst(.v13), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v7)],
8+
platforms: [
9+
.iOS(.v13),
10+
.macCatalyst(.v13),
11+
.macOS(.v10_13),
12+
.tvOS(.v12),
13+
.watchOS(.v7),
14+
.visionOS(.v1)
15+
],
1116
products: [
1217
.library(
1318
name: "FirewrapAuth",
@@ -23,15 +28,15 @@ let package = Package(
2328
)
2429
],
2530
dependencies: [
26-
.package(url: "https://github.com/firebase/firebase-ios-sdk", .upToNextMajor(from: "10.23.0")),
31+
.package(url: "https://github.com/firebase/firebase-ios-sdk", .exactItem("10.29.0")),
2732
.package(url: "https://github.com/google/GoogleSignIn-iOS", .upToNextMajor(from: "7.1.0")),
28-
.package(url: "https://github.com/sparrowcode/SwiftBoost", .upToNextMajor(from: "4.0.9")),
33+
.package(url: "https://github.com/sparrowcode/SwiftBoost", .upToNextMajor(from: "4.0.9"))
2934
],
3035
targets: [
3136
.target(
3237
name: "Firewrap",
3338
dependencies: [
34-
SwiftBoost,
39+
.product(name: "SwiftBoost", package: "SwiftBoost"),
3540
.product(name: "FirebaseAnalytics", package: "firebase-ios-sdk"),
3641
]
3742
),

Sources/Firewrap/Firewrap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Foundation
2-
import FirebaseCore
2+
import Firebase
33
import SwiftBoost
44

55
open class Firewrap {

Sources/FirewrapAuth/FirewrapAuth.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import UIKit
2-
import FirebaseCore
1+
import Foundation
32
import Firewrap
3+
import Firebase
44
import FirebaseAuth
5-
import GoogleSignIn
65
import SwiftBoost
6+
import UIKit
77

88
public class FirewrapAuth {
99

@@ -33,6 +33,7 @@ public class FirewrapAuth {
3333
printConsole("Configure Complete")
3434
}
3535

36+
3637
public static func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
3738
let handleEmailWay = handleSignInWithEmailURL(url) { error in
3839
shared.completionSignInViaEmail?(error)
@@ -41,10 +42,15 @@ public class FirewrapAuth {
4142
if handleEmailWay {
4243
return true
4344
} else {
44-
return GIDSignIn.sharedInstance.handle(url)
45+
#if os(iOS) || os(macOS)
46+
return false//GIDSignIn.sharedInstance.handle(url)
47+
#else
48+
return false
49+
#endif
4550
}
4651
}
4752

53+
4854
// MARK: - Data
4955

5056
public static var isAuthed: Bool { userID != nil }
@@ -106,6 +112,7 @@ public class FirewrapAuth {
106112
}
107113
}
108114

115+
#if os(iOS) || os(macOS)
109116
public static func signInWithGoogle(on controller: UIViewController, completion: ((FirewrapAuthSignInError?) -> Void)?) {
110117
printConsole("Sign in with Google...")
111118
GoogleAuthService.signIn(on: controller) { data, googleError in
@@ -130,6 +137,7 @@ public class FirewrapAuth {
130137
}
131138
}
132139
}
140+
#endif
133141

134142
/**
135143
Firebase asking about Dynamic Links, but its will depicated. Observing how shoud change it

Sources/FirewrapAuth/Services/EmailAuthService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import UIKit
2-
import FirebaseCore
2+
import Firebase
33
import FirebaseAuth
44

55
class EmailAuthService {

Sources/FirewrapAuth/Services/GoogleAuthService.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#if os(iOS) || os(macOS)
12
import UIKit
2-
import FirebaseCore
3+
import Firebase
34
import GoogleSignIn
45

56
class GoogleAuthService {
@@ -31,3 +32,4 @@ public struct SignInWithGoogleData {
3132
public let identityToken: String
3233
public let accessToken: String
3334
}
35+
#endif

Sources/FirewrapDatabase/FirewrapCollection.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#if os(iOS)
12
import Foundation
23
import FirebaseFirestore
34

4-
class FirewrapCollection {
5+
public class FirewrapCollection {
56

67
public let path: String
78
private var listener: ListenerRegistration?
@@ -48,3 +49,4 @@ class FirewrapCollection {
4849
}
4950
}
5051
}
52+
#endif

Sources/FirewrapDatabase/FirewrapDocument.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
#if os(iOS)
12
import Foundation
23
import FirebaseFirestore
34

5+
// Using for wrap default firebase value
6+
public typealias FirewrapFieldNil = NSNull
7+
48
public class FirewrapDocument {
59

610
public let path: String
@@ -12,6 +16,7 @@ public class FirewrapDocument {
1216

1317
// MARK: - Getter
1418

19+
#warning("add error or state")
1520
public func get(_ source: FirewrapSource = .default, completion: @escaping (([String : Any]?) -> Void)) {
1621
let db = Firestore.firestore()
1722
db.document(path).getDocument(source: source.firebaseValue) { document, error in
@@ -25,9 +30,16 @@ public class FirewrapDocument {
2530

2631
// MARK: - Setter
2732

28-
public func set(_ data: [String : Any], merge: Bool) {
33+
#warning("add error or state")
34+
public func set(_ data: [String : Any], merge: Bool, completion: @escaping (() -> Void)) {
2935
let db = Firestore.firestore()
30-
db.document(path).setData(data, merge: merge)
36+
db.document(path).setData(data, merge: merge) { error in
37+
guard error == nil else {
38+
completion()
39+
return
40+
}
41+
completion()
42+
}
3143
}
3244

3345
public func delete(_ completion: @escaping (Bool) -> Void) {
@@ -55,3 +67,4 @@ public class FirewrapDocument {
5567
self.listener?.remove()
5668
}
5769
}
70+
#endif

0 commit comments

Comments
 (0)