|
|
hace 3 años | |
|---|---|---|
| .. | ||
| FakeConsole | 5e8790d78a Update to SwiftFormat 0.49.2 (#9239) | hace 4 años |
| FakeUtils | 2246d8ff8c RC Swift pod and codable (#9084) | hace 4 años |
| ObjC | 4e5b83f2d9 Merge Realtime into Remote Config (#10060) | hace 3 años |
| SwiftAPI | 4e5b83f2d9 Merge Realtime into Remote Config (#10060) | hace 3 años |
| AccessToken.json | 2246d8ff8c RC Swift pod and codable (#9084) | hace 4 años |
| Defaults-testInfo.plist | bc2bc6b9f2 Fix RC Codable to handle arrays and dictionaries from plist defaults (#10046) | hace 3 años |
| README.md | 2246d8ff8c RC Swift pod and codable (#9084) | hace 4 años |
Currently the Remote Config tests run in two configurations:
RemoteConfigConsole.swift
provides a simple API for interacting with an app's Remote Config on the
Firebase console.
GoogleService-Info.plist.ServiceAccount.json.Within the firebase-ios-sdk, run:
./scripts/generate_access_token.sh local_dev PATH/TO/ServiceAccount.json FirebaseRemoteConfigSwift/Tests/AccessToken.json
Generate the FirebaseRemoteConfig project:
pod gen FirebaseRemoteConfig.podspec --local-sources=./ --auto-open --platforms=ios
Copy the GoogleService-Info.plist you downloaded earlier into the generated
Xcode project.
🚀 Everything is ready to go! Run the tests in the swift-api-tests target.
While the RemoteConfigConsole API basically just makes simple network calls,
we need to include an access token so our requests do the proper "handshake" with the Firebase console.
This private key is needed to create an access token with the valid parameters that authorizes our requests to programmatically make changes to remote config on the Firebase console.
The private key can be located on the Firebase console and navigate to your project's settings. To download, click on the Service accounts tab and then generate the private key by clicking the blue button that says "Generate new private key".
We use Google's Auth Library for Swift
to generate the access token. There are a few example use cases provided. We use the
TokenSource
example.
For the access token to be generated, the GOOGLE_APPLICATION_CREDENTIALS env var should be set to point to where the
Firebase project's service account key is stored. This is set in the
generate_access_token.sh
script.
There is a section
of tests in APITests.swift
showcasing the RemoteConfigConsole in action.