Skip to content

Commit

Permalink
Constrain Grpc dependency version (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishpatil-g authored Sep 24, 2024
1 parent ef33e40 commit 8c3b017
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
firebaseDependency(),
.package(
url: "https://github.com/grpc/grpc-swift.git",
from: "1.19.1" // TODO: Constrain to a range at time of release
exact: "1.23.1"
),
.package(
url: "https://github.com/google/GoogleUtilities.git",
Expand Down
26 changes: 13 additions & 13 deletions Sources/Internal/GrpcClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ actor GrpcClient: CustomStringConvertible {

private lazy var client: FirebaseDataConnectAsyncClient? = {
do {
if (debugEnable == true) {
if debugEnable == true {
FirebaseLogger.dataConnect.debug("\(self.description) initialization starts.")
} else {
FirebaseLogger.dataConnect.debug("GrpcClient initialization starts.")
Expand All @@ -78,14 +78,14 @@ actor GrpcClient: CustomStringConvertible {
.plaintext,
eventLoopGroup: group
)
if (debugEnable == true) {
if debugEnable == true {
FirebaseLogger.dataConnect.debug("\(self.description) has been created.")
} else {
FirebaseLogger.dataConnect.debug("GrpcClient has been created.")
}
return FirebaseDataConnectAsyncClient(channel: channel)
} catch {
if (debugEnable == true) {
if debugEnable == true {
FirebaseLogger.dataConnect.error("Error:\(error) when creating \(self.description).")
} else {
FirebaseLogger.dataConnect.debug("Error:\(error) when creating GrpcClient.")
Expand Down Expand Up @@ -157,15 +157,15 @@ actor GrpcClient: CustomStringConvertible {
)

do {
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.debug("executeQuery() sends grpc request: \(grpcRequest.jsonString()).")
} else {
try FirebaseLogger.dataConnect
.debug("executeQuery() sends grpc request.")
}
let results = try await client.executeQuery(grpcRequest, callOptions: createCallOptions())
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.debug("executeQuery() receives response: \(results.jsonString()).")
} else {
Expand All @@ -177,7 +177,7 @@ actor GrpcClient: CustomStringConvertible {
return OperationResult(data: decodedResults)
} else {
// In future, set this as error in OperationResult
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.error("executeQuery() response: \(results.jsonString()) decode failed.")
} else {
Expand All @@ -187,7 +187,7 @@ actor GrpcClient: CustomStringConvertible {
throw DataConnectError.decodeFailed
}
} catch {
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.error(
"executeQuery() with request: \(grpcRequest.jsonString()) grpc call FAILED with \(error)."
Expand Down Expand Up @@ -220,15 +220,15 @@ actor GrpcClient: CustomStringConvertible {
)

do {
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.debug("executeMutation() sends grpc request: \(grpcRequest.jsonString()).")
} else {
try FirebaseLogger.dataConnect
.debug("executeMutation() sends grpc request.")
}
let results = try await client.executeMutation(grpcRequest, callOptions: createCallOptions())
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.debug("executeMutation() receives response: \(results.jsonString()).")
} else {
Expand All @@ -238,7 +238,7 @@ actor GrpcClient: CustomStringConvertible {
if let decodedResults = try codec.decode(result: results.data, asType: resultType) {
return OperationResult(data: decodedResults)
} else {
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.error("executeMutation() response: \(results.jsonString()) decode failed.")
} else {
Expand All @@ -248,7 +248,7 @@ actor GrpcClient: CustomStringConvertible {
throw DataConnectError.decodeFailed
}
} catch {
if (debugEnable == true) {
if debugEnable == true {
try FirebaseLogger.dataConnect
.error(
"executeMutation() with request: \(grpcRequest.jsonString()) grpc call FAILED with \(error)."
Expand All @@ -274,7 +274,7 @@ actor GrpcClient: CustomStringConvertible {
do {
if let token = try await auth.currentUser?.getIDToken() {
headers.add(name: RequestHeaders.authorizationHeader, value: "\(token)")
if (debugEnable == true) {
if debugEnable == true {
FirebaseLogger.dataConnect
.debug("Auth token added: \(token)")
} else {
Expand All @@ -293,7 +293,7 @@ actor GrpcClient: CustomStringConvertible {
do {
if let token = try await appCheck?.token(forcingRefresh: false) {
headers.add(name: RequestHeaders.appCheckHeader, value: token.token)
if (debugEnable == true) {
if debugEnable == true {
FirebaseLogger.dataConnect
.debug("App Check token added: \(token.token)")
} else {
Expand Down

0 comments on commit 8c3b017

Please sign in to comment.