Skip to content

Commit 026db9f

Browse files
rathovarun1032Varun RathoreathiramanuAthira M
authored
feat(rc): Add support for Server-Side Remote Config (#1122)
* Implementation for Fetching and Caching Server Side Remote Config (#1107)009 * Implementation for Fetching and Caching Server Side Remote Config * implementation of fetch , cache and load of template --------- Co-authored-by: Varun Rathore <varunrathore@google.com> * Implement custom signal targeting for server side RC (#1108) Co-authored-by: Athira M <athiramanu@google.com> * Implement percent evaluation for server side RC (#1114) * [feat] Implement percent evaluation for server side RC * Ssrc bugbash fix (#1117) * Handle empty context * fix issue related to update time * fix string equality * fix textcase * Fix lint errors * Add unit tests * fix for [438426692](getDouble() logs a malformed warning on type conversion failure) Using getDouble on a string parameter value, returns the appropriate default static value but logs a warning which looks incorrect ("%s" in the warning message?). * Update ServerTemplateResponse.java to fix b/438607881 In the server template builder flow using cached template, evaluation using custom signals is not working as intended. * Update getServerRemoteConfig.json to fix b/438607881 * Update getServerTemplateData.json to fix b/438607881 * fix for bugs * Resolve comment related to revert of ServerVersion Class * remove serverVersion * Resolve comments related to Evaluator * fix indentation * fix indentation * fix indentations * fix multi line indent * fix multi line indents * Update ConditionEvaluator.java * Update ConditionEvaluator.java --------- Co-authored-by: Athira M <athiramanu@google.com> Co-authored-by: Varun Rathore <varunrathore@google.com> * Create ParameterValueTest.java * Fix typo errors * Change return type and cache regex * Addressed comment to make cache atomic * Trigger CI --------- Co-authored-by: Varun Rathore <varunrathore@google.com> Co-authored-by: Athira M <athiramanu9400@gmail.com> Co-authored-by: Athira M <athiramanu@google.com>
1 parent 450fe3c commit 026db9f

31 files changed

+5094
-249
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright 2025 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+
package com.google.firebase.remoteconfig;
18+
19+
import static com.google.common.base.Preconditions.checkArgument;
20+
import static com.google.common.base.Preconditions.checkNotNull;
21+
22+
import com.google.common.collect.ImmutableList;
23+
import com.google.firebase.internal.NonNull;
24+
import com.google.firebase.remoteconfig.internal.ServerTemplateResponse.AndConditionResponse;
25+
import com.google.firebase.remoteconfig.internal.ServerTemplateResponse.OneOfConditionResponse;
26+
27+
import java.util.List;
28+
import java.util.stream.Collectors;
29+
30+
final class AndCondition {
31+
private final ImmutableList<OneOfCondition> conditions;
32+
33+
AndCondition(@NonNull List<OneOfCondition> conditions) {
34+
checkNotNull(conditions, "List of conditions for AND operation must not be null.");
35+
checkArgument(!conditions.isEmpty(),
36+
"List of conditions for AND operation must not be empty.");
37+
this.conditions = ImmutableList.copyOf(conditions);
38+
}
39+
40+
AndCondition(AndConditionResponse andConditionResponse) {
41+
List<OneOfConditionResponse> conditionList = andConditionResponse.getConditions();
42+
checkNotNull(conditionList, "List of conditions for AND operation must not be null.");
43+
checkArgument(!conditionList.isEmpty(),
44+
"List of conditions for AND operation must not be empty");
45+
this.conditions = conditionList.stream()
46+
.map(OneOfCondition::new)
47+
.collect(ImmutableList.toImmutableList());
48+
}
49+
50+
@NonNull
51+
ImmutableList<OneOfCondition> getConditions() {
52+
return conditions;
53+
}
54+
55+
AndConditionResponse toAndConditionResponse() {
56+
return new AndConditionResponse()
57+
.setConditions(this.conditions.stream()
58+
.map(OneOfCondition::toOneOfConditionResponse)
59+
.collect(Collectors.toList()));
60+
}
61+
}

0 commit comments

Comments
 (0)