Skip to content

Commit 8072c9d

Browse files
ddnanthemiswang
authored andcommitted
[Rollouts]Add remote config logic to featureRollouts test app (#12349)
1 parent 3c69903 commit 8072c9d

File tree

4 files changed

+61
-7
lines changed

4 files changed

+61
-7
lines changed

FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
/* Begin PBXBuildFile section */
1010
61A5654706089C41A7398CF3 /* Pods_FeatureRolloutsTestApp_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FE5945D035CAAB3297D2CAC /* Pods_FeatureRolloutsTestApp_iOS.framework */; };
1111
848D345C8969AF72BCC0E2E4 /* Pods_FeatureRolloutsTestApp_CrashlyticsRemoteConfig_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1729B0ED2CACB9C5A62A6F8C /* Pods_FeatureRolloutsTestApp_CrashlyticsRemoteConfig_iOS.framework */; };
12+
951D70152B71AD9B00BE7EED /* RemoteConfigButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 951D70142B71AD9A00BE7EED /* RemoteConfigButtonView.swift */; };
13+
951D70162B71AD9B00BE7EED /* RemoteConfigButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 951D70142B71AD9A00BE7EED /* RemoteConfigButtonView.swift */; };
1214
AD11C57C978D52894BFDC47F /* Pods_FeatureRolloutsTestApp_RemoteConfig_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E60230146BDE14D306856CB /* Pods_FeatureRolloutsTestApp_RemoteConfig_iOS.framework */; };
1315
C427C4A32B4603F60088A488 /* FeatureRolloutsTestAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C427C4A22B4603F60088A488 /* FeatureRolloutsTestAppApp.swift */; };
1416
C427C4A52B4603F60088A488 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C427C4A42B4603F60088A488 /* ContentView.swift */; };
@@ -76,6 +78,7 @@
7678
5472955122D0CE0A8A3CE4D5 /* Pods_FeatureRolloutsTestApp_Crashlytics_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FeatureRolloutsTestApp_Crashlytics_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7779
6D30A6D1F2CE622B6D5D563F /* Pods-FeatureRolloutsTestApp_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FeatureRolloutsTestApp_iOS.debug.xcconfig"; path = "Target Support Files/Pods-FeatureRolloutsTestApp_iOS/Pods-FeatureRolloutsTestApp_iOS.debug.xcconfig"; sourceTree = "<group>"; };
7880
8BA72854B19D7A9D9BE15E1D /* Pods-FeatureRolloutsTestApp_Crashlytics_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FeatureRolloutsTestApp_Crashlytics_iOS.release.xcconfig"; path = "Target Support Files/Pods-FeatureRolloutsTestApp_Crashlytics_iOS/Pods-FeatureRolloutsTestApp_Crashlytics_iOS.release.xcconfig"; sourceTree = "<group>"; };
81+
951D70142B71AD9A00BE7EED /* RemoteConfigButtonView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoteConfigButtonView.swift; sourceTree = "<group>"; };
7982
AF260B513E38B2528E7B13CC /* Pods-FeatureRolloutsTestApp_RemoteConfig_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FeatureRolloutsTestApp_RemoteConfig_iOS.debug.xcconfig"; path = "Target Support Files/Pods-FeatureRolloutsTestApp_RemoteConfig_iOS/Pods-FeatureRolloutsTestApp_RemoteConfig_iOS.debug.xcconfig"; sourceTree = "<group>"; };
8083
C427C49F2B4603F60088A488 /* FeatureRolloutsTestApp_iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FeatureRolloutsTestApp_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
8184
C427C4A22B4603F60088A488 /* FeatureRolloutsTestAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureRolloutsTestAppApp.swift; sourceTree = "<group>"; };
@@ -204,6 +207,7 @@
204207
children = (
205208
C49C48A02B47261000BC1456 /* GoogleService-Info.plist */,
206209
C427C4A22B4603F60088A488 /* FeatureRolloutsTestAppApp.swift */,
210+
951D70142B71AD9A00BE7EED /* RemoteConfigButtonView.swift */,
207211
C49C489D2B4722C100BC1456 /* CrashButtonView.swift */,
208212
);
209213
path = Shared;
@@ -615,6 +619,7 @@
615619
buildActionMask = 2147483647;
616620
files = (
617621
C49C48702B4704F300BC1456 /* FeatureRolloutsTestAppApp.swift in Sources */,
622+
951D70162B71AD9B00BE7EED /* RemoteConfigButtonView.swift in Sources */,
618623
C49C48992B4720AE00BC1456 /* ContentView.swift in Sources */,
619624
);
620625
runOnlyForDeploymentPostprocessing = 0;
@@ -623,6 +628,7 @@
623628
isa = PBXSourcesBuildPhase;
624629
buildActionMask = 2147483647;
625630
files = (
631+
951D70152B71AD9B00BE7EED /* RemoteConfigButtonView.swift in Sources */,
626632
C49C487A2B4704F500BC1456 /* FeatureRolloutsTestAppApp.swift in Sources */,
627633
C49C489E2B4722C100BC1456 /* CrashButtonView.swift in Sources */,
628634
C49C489C2B4720DD00BC1456 /* ContentView.swift in Sources */,

FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp_CrashlyticsRemoteConfig_iOS/ContentView.swift

+2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ struct ContentView: View {
2121
var body: some View {
2222
CrashButtonView()
2323
.padding()
24+
RemoteConfigButtonView()
25+
.padding()
2426
}
2527
}

FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp_RemoteConfig_iOS/ContentView.swift

+2-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ import SwiftUI
1919

2020
struct ContentView: View {
2121
var body: some View {
22-
VStack {
23-
Image(systemName: "globe")
24-
.imageScale(.large)
25-
.foregroundStyle(.tint)
26-
Text("Hello, world!")
27-
}
28-
.padding()
22+
RemoteConfigButtonView()
23+
.padding()
2924
}
3025
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// Copyright 2024 Google LLC
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
import FirebaseRemoteConfig
18+
import Foundation
19+
import SwiftUI
20+
21+
struct RemoteConfigButtonView: View {
22+
@State private var turnOnRealTimeRC = false
23+
let rc = RemoteConfig.remoteConfig()
24+
@RemoteConfigProperty(key: "ios_rollouts", fallback: "unfetched") var iosRollouts: String
25+
26+
var body: some View {
27+
NavigationView {
28+
VStack(
29+
alignment: .leading,
30+
spacing: 10
31+
) {
32+
Button(action: {
33+
rc.fetch()
34+
}) {
35+
Text("Fetch")
36+
}
37+
Button(action: {
38+
rc.activate()
39+
}) {
40+
Text("Activate")
41+
}
42+
Text(iosRollouts)
43+
Toggle("Turn on RealTime RC", isOn: $turnOnRealTimeRC).toggleStyle(.button).tint(.mint)
44+
.onChange(of: self.turnOnRealTimeRC, perform: { value in
45+
rc.addOnConfigUpdateListener { u, e in rc.activate() }
46+
})
47+
}
48+
.navigationTitle("Remote Config Example")
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)