Skip to content
3 changes: 3 additions & 0 deletions auth/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ android {
proguardFile file('proguard.pro')
}
}
packagingOptions {
pickFirst 'META-INF/**/coroutines.pro'
}
}

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand Down
3 changes: 3 additions & 0 deletions database/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ android {
proguardFile file('proguard.pro')
}
}
packagingOptions {
pickFirst 'META-INF/**/coroutines.pro'
}
}

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand Down
3 changes: 3 additions & 0 deletions firestore/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ android {
proguardFile file('proguard.pro')
}
}
packagingOptions {
pickFirst 'META-INF/**/coroutines.pro'
}
}

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand Down
3 changes: 3 additions & 0 deletions firestore/integration_test_internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ android {
proguardFile file('proguard.pro')
}
}
packagingOptions {
pickFirst 'META-INF/**/coroutines.pro'
}
lintOptions {
abortOnError false
}
Expand Down
12 changes: 10 additions & 2 deletions firestore/src/android/aggregate_query_snapshot_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,34 @@ using jni::Env;
using jni::Local;
using jni::Method;
using jni::Object;
using jni::StaticMethod;

constexpr char kClassName[] =
PROGUARD_KEEP_CLASS "com/google/firebase/firestore/AggregateQuerySnapshot";
Constructor<Object> kConstructor(
"(Lcom/google/firebase/firestore/AggregateQuery;J)V");
"(Lcom/google/firebase/firestore/AggregateQuery;Ljava/util/Map;)V");
Method<int64_t> kGetCount("getCount", "()J");
Method<Object> kGetQuery("getQuery",
"()Lcom/google/firebase/firestore/AggregateQuery;");
Method<int32_t> kHashCode("hashCode", "()I");

constexpr char kHelperClassName[] = PROGUARD_KEEP_CLASS
"com/google/firebase/firestore/internal/cpp/AggregateQuerySnapshotHelper";
StaticMethod<Object> kCreateConstructorArg(
"createAggregateQuerySnapshotConstructorArg", "(J)Ljava/util/Map;");

} // namespace

void AggregateQuerySnapshotInternal::Initialize(jni::Loader& loader) {
loader.LoadClass(kClassName, kConstructor, kGetCount, kGetQuery, kHashCode);
loader.LoadClass(kHelperClassName, kCreateConstructorArg);
}

AggregateQuerySnapshot AggregateQuerySnapshotInternal::Create(
Env& env, AggregateQueryInternal& aggregate_query_internal, int64_t count) {
Local<Object> snapshot_data = env.Call(kCreateConstructorArg, count);
Local<Object> instance =
env.New(kConstructor, aggregate_query_internal.ToJava(), count);
env.New(kConstructor, aggregate_query_internal.ToJava(), snapshot_data);
return aggregate_query_internal.firestore_internal()
->NewAggregateQuerySnapshot(env, instance);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.firebase.firestore.internal.cpp;

import com.google.firestore.v1.Value;
import java.util.HashMap;
import java.util.Map;

public final class AggregateQuerySnapshotHelper {
private AggregateQuerySnapshotHelper() {}

/**
* Creates an object appropriate for specifying to the AggregateQuerySnapshot
* constructor that conveys the given "count" as the lone aggregate result.
*
* This class should be deleted and replaced with a proper mechanism once
* SUM/AVERAGE are ported to this SDK.
*/
public static Map<String, Value> createAggregateQuerySnapshotConstructorArg(
long count) {
HashMap<String, Value> map = new HashMap<>();
map.put("count", Value.newBuilder().setIntegerValue(count).build());
return map;
}
}
3 changes: 3 additions & 0 deletions functions/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ android {
proguardFile file('proguard.pro')
}
}
packagingOptions {
pickFirst 'META-INF/**/coroutines.pro'
}
}

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand Down
3 changes: 3 additions & 0 deletions storage/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ android {
proguardFile file('proguard.pro')
}
}
packagingOptions {
pickFirst 'META-INF/**/coroutines.pro'
}
}

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand Down