Skip to content

Commit

Permalink
✨ Add FirebaseFetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
olejnjak committed Jan 3, 2024
1 parent 6698c55 commit a85460a
Show file tree
Hide file tree
Showing 6 changed files with 423 additions and 0 deletions.
261 changes: 261 additions & 0 deletions ACKategories.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" ~> 10.19
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseRemoteConfigBinary.json" ~> 10.19
2 changes: 2 additions & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" "10.19.0"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseRemoteConfigBinary.json" "10.19.0"
122 changes: 122 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
"version" : "1.2022062300.0"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "5746b2d35c91c50581590ed97abe4c06b5037274",
"version" : "10.18.0"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "c60c958e707c50a9cf8bcb7cfd7d51c566d726c5",
"version" : "10.19.1"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "6b332152355c372ace9966d8ee76ed191f97025e",
"version" : "10.17.0"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "a732a4b47f59e4f725a2ea10f0c77e93a7131117",
"version" : "9.3.0"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "bc27fad73504f3d4af235de451f02ee22586ebd3",
"version" : "7.12.1"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "a673bc2937fbe886dd1f99c401b01b6d977a9c98",
"version" : "1.49.1"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "115f75e43851774934d695449a4836123c3246e1",
"version" : "3.2.0"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
"version" : "100.0.0"
}
},
{
"identity" : "leveldb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "9d108e9112aa1d65ce508facf804674546116d9c",
"version" : "1.22.3"
}
},
{
"identity" : "nanopb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
"version" : "2.30909.0"
}
},
{
"identity" : "promises",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/promises.git",
"state" : {
"revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e",
"version" : "2.3.1"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8",
"version" : "1.25.2"
}
}
],
"version" : 2
}
14 changes: 14 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ let package = Package(
.library(name: "ACKategories", targets: ["ACKategories"]),
.library(name: "ACKategoriesTesting", targets: ["ACKategoriesTesting"]),
.library(name: "Networking", targets: ["Networking"]),
.library(name: "FirebaseFetcher", targets: ["FirebaseFetcher"]),
],
dependencies: [
.package(
url: "https://github.com/firebase/firebase-ios-sdk",
from: "10.19.0"
),
],
targets: [
.target(name: "ACKategories"),
Expand All @@ -38,5 +45,12 @@ let package = Package(
"Networking",
]
),
.target(
name: "FirebaseFetcher",
dependencies: [
"ACKategories",
.product(name: "FirebaseRemoteConfig", package: "firebase-ios-sdk"),
]
),
]
)
22 changes: 22 additions & 0 deletions Sources/FirebaseFetcher/FirebaseFetcher.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ACKategories
import FirebaseRemoteConfig

public final class FirebaseFetcher: MinBuildNumberFetcher {
public var minBuildNumber: Int {
get async throws {
try await remoteConfig.fetchAndActivate()
return remoteConfig[decodedValue: key] ?? Int.max
}
}

private let key: String
private let remoteConfig: RemoteConfig

public init(
key: String,
remoteConfig: RemoteConfig = RemoteConfig.remoteConfig()
) {
self.key = key
self.remoteConfig = remoteConfig
}
}

0 comments on commit a85460a

Please sign in to comment.