From 38f6fe8b82bfebd0b7d60aa1359dbe58e970615c Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Tue, 14 Sep 2021 21:18:45 -0700 Subject: [PATCH 1/6] Fix the logic to generate .pro file --- android_build_files/generate_proguard.gradle | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android_build_files/generate_proguard.gradle b/android_build_files/generate_proguard.gradle index 082e157d42..55f5c87246 100644 --- a/android_build_files/generate_proguard.gradle +++ b/android_build_files/generate_proguard.gradle @@ -44,6 +44,7 @@ def generateCppProguard(File library, String outCppPro) { // proguardSet: The set of proguard files to use. // outputProguard: The path to the output proguard file. def generateFinalProguard(Set proguardSet, String outputProguard) { + Set proguardLineSet = new HashSet() for (File pro : proguardSet) { for (String line : pro.text.split("[\\r\\n]+")) { @@ -79,9 +80,12 @@ def defineGenerateProguardFile(String subproject, String buildType, Set librarySet = fileTree("$nativeBuildDir") .matching({ include "**/*firebase_${subproject}*" }).getFiles() String cppProguard = "$buildDir/cpp_${subproject}.pro" - if (!librarySet.isEmpty()) { + while (!librarySet.isEmpty()) { File lib = librarySet.iterator().next() - generateCppProguard(lib, cppProguard) + librarySet.remove(lib) + if (lib.name.endsWith(".a")) { + generateCppProguard(lib, cppProguard) + } } // Combine the proguard files into a single file. From 3697224fdc7f2421bb669bc191f56c89b2bfcd18 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Wed, 15 Sep 2021 10:37:08 -0700 Subject: [PATCH 2/6] update readme file --- release_build_files/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 244a44ceaa..43c1990260 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -570,6 +570,8 @@ code. ### 8.4.0 - Changes - General: Updating Android and iOS dependencies to the latest. + - General: Fix the generating of proguard file + ([#664](https://github.com/firebase/firebase-cpp-sdk/pull/664)). - Firestore: Added `operator==` and `operator!=` for `SnapshotMetadata`, `Settings`, `QuerySnapshot`, `DocumentSnapshot`, `SetOptions`, and `DocumentChange`. From e80ea397914214b3e7f486a6cda653c91b132d76 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Wed, 15 Sep 2021 10:50:38 -0700 Subject: [PATCH 3/6] modify the release notes --- release_build_files/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 106fc30c63..4ed5bae95e 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -570,12 +570,12 @@ code. ### 8.5.0 - Changes - General: Updating Android and iOS dependencies to the latest. + - General: Fix the generating of proguard file + ([#664](https://github.com/firebase/firebase-cpp-sdk/pull/664)). ### 8.4.0 - Changes - General: Updating Android and iOS dependencies to the latest. - - General: Fix the generating of proguard file - ([#664](https://github.com/firebase/firebase-cpp-sdk/pull/664)). - Firestore: Added `operator==` and `operator!=` for `SnapshotMetadata`, `Settings`, `QuerySnapshot`, `DocumentSnapshot`, `SetOptions`, and `DocumentChange`. From fd9c129530f271bb9264b4795b8a4d8b3ca8fe55 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Wed, 15 Sep 2021 20:03:44 -0700 Subject: [PATCH 4/6] Change the way to fetch initial token with the new API --- messaging/src/android/cpp/messaging.cc | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/messaging/src/android/cpp/messaging.cc b/messaging/src/android/cpp/messaging.cc index ac2018116c..dff7aacea6 100644 --- a/messaging/src/android/cpp/messaging.cc +++ b/messaging/src/android/cpp/messaging.cc @@ -713,21 +713,13 @@ void Terminate() { static void InstallationsGetToken() { FIREBASE_ASSERT_MESSAGE_RETURN_VOID(internal::IsInitialized(), kMessagingNotInitializedError); - JNIEnv* env = g_app->GetJNIEnv(); - - // Intent intent = new Intent(this, RegistrationIntentService.class); - jobject new_intent = env->NewObject( - util::intent::GetClass(), - util::intent::GetMethodId(util::intent::kConstructor), g_app->activity(), - registration_intent_service::GetClass()); + Future result = GetToken(); - // startService(intent); - jobject component_name = env->CallObjectMethod( - g_app->activity(), - util::context::GetMethodId(util::context::kStartService), new_intent); - assert(env->ExceptionCheck() == false); - env->DeleteLocalRef(component_name); - env->DeleteLocalRef(new_intent); + result.OnCompletion( + [](const Future& result, void* voidptr) { + NotifyListenerOnTokenReceived(result.result()->c_str()); + }, + nullptr); } static void SubscriptionUpdateComplete(JNIEnv* env, jobject result, From 18547d05457a74940c2ecbd3f681a9bd58e2419e Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Thu, 16 Sep 2021 15:14:20 -0700 Subject: [PATCH 5/6] Change the way to fetch initial token with the new API --- messaging/integration_test/src/integration_test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/messaging/integration_test/src/integration_test.cc b/messaging/integration_test/src/integration_test.cc index aedbe2a093..dcd5ec862d 100644 --- a/messaging/integration_test/src/integration_test.cc +++ b/messaging/integration_test/src/integration_test.cc @@ -354,6 +354,8 @@ TEST_F(FirebaseMessagingTest, TestReceiveToken) { EXPECT_TRUE(RequestPermission()); + EXPECT_TRUE(::firebase::messaging::IsTokenRegistrationOnInitEnabled()); + FLAKY_TEST_SECTION_BEGIN(); EXPECT_TRUE(WaitForToken()); From 866b114431ded4f2e083704d272378ea63f127f7 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Fri, 17 Sep 2021 11:53:59 -0700 Subject: [PATCH 6/6] Add change to release notes --- release_build_files/readme.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 4ed5bae95e..67e11fc3e9 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -567,10 +567,16 @@ code. ## Release Notes +### Future Release +- Changes + - Messaging (Android): Fixes an issue to receive token when + initialize the app. + ([#667](https://github.com/firebase/firebase-cpp-sdk/pull/667)). + ### 8.5.0 - Changes - General: Updating Android and iOS dependencies to the latest. - - General: Fix the generating of proguard file + - General: Fixes an issue with generating Proguard files. ([#664](https://github.com/firebase/firebase-cpp-sdk/pull/664)). ### 8.4.0