Skip to content

Commit 7ca910f

Browse files
committed
Rename and refactor all of the source files and namespaces.
1 parent 90ec0e1 commit 7ca910f

23 files changed

+86
-2399
lines changed

ump/src/android/consent_info_internal_android.cc

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "gma/src/android/ump/consent_info_internal_android.h"
17+
#include "ump/src/android/consent_info_internal_android.h"
1818

1919
#include <jni.h>
2020

@@ -25,17 +25,13 @@
2525
#include "app/src/thread.h"
2626
#include "app/src/util_android.h"
2727
#include "firebase/internal/common.h"
28-
#include "gma/gma_resources.h"
29-
#include "gma/src/android/gma_android.h"
28+
#include "ump/ump_resources.h"
29+
#include "ump/src/android/ump_android.h"
3030

3131
namespace firebase {
32-
namespace gma {
3332
namespace ump {
3433
namespace internal {
3534

36-
ConsentInfoInternalAndroid* ConsentInfoInternalAndroid::s_instance = nullptr;
37-
firebase::Mutex ConsentInfoInternalAndroid::s_instance_mutex;
38-
3935
// clang-format off
4036
#define CONSENTINFOHELPER_METHODS(X) \
4137
X(Constructor, "<init>", "(JLandroid/app/Activity;)V"), \
@@ -83,7 +79,7 @@ METHOD_LOOKUP_DECLARATION(consent_info_helper, CONSENTINFOHELPER_METHODS,
8379

8480
METHOD_LOOKUP_DEFINITION(
8581
consent_info_helper,
86-
"com/google/firebase/gma/internal/cpp/ConsentInfoHelper",
82+
"com/google/firebase/ump/internal/cpp/ConsentInfoHelper",
8783
CONSENTINFOHELPER_METHODS, CONSENTINFOHELPER_FIELDS);
8884

8985
// clang-format off
@@ -263,23 +259,23 @@ ConsentInfoInternalAndroid::ConsentInfoInternalAndroid(JNIEnv* env,
263259
util::Initialize(env, activity);
264260
env->GetJavaVM(&java_vm_);
265261

266-
// Between this and GMA, we only want to load these files once.
262+
// Ensure we only load these files once.
267263
{
268264
MutexLock lock(
269-
::firebase::gma::internal::g_cached_gma_embedded_files_mutex);
270-
if (::firebase::gma::internal::g_cached_gma_embedded_files == nullptr) {
271-
::firebase::gma::internal::g_cached_gma_embedded_files =
265+
::firebase::ump::internal::g_cached_ump_embedded_files_mutex);
266+
if (::firebase::ump::internal::g_cached_ump_embedded_files == nullptr) {
267+
::firebase::ump::internal::g_cached_ump_embedded_files =
272268
new std::vector<firebase::internal::EmbeddedFile>();
273-
*::firebase::gma::internal::g_cached_gma_embedded_files =
269+
*::firebase::ump::internal::g_cached_ump_embedded_files =
274270
util::CacheEmbeddedFiles(env, activity,
275271
firebase::internal::EmbeddedFile::ToVector(
276-
firebase_gma::gma_resources_filename,
277-
firebase_gma::gma_resources_data,
278-
firebase_gma::gma_resources_size));
272+
firebase_ump::ump_resources_filename,
273+
firebase_ump::ump_resources_data,
274+
firebase_ump::ump_resources_size));
279275
}
280276
}
281277
const std::vector<firebase::internal::EmbeddedFile>& embedded_files =
282-
*::firebase::gma::internal::g_cached_gma_embedded_files;
278+
*::firebase::ump::internal::g_cached_ump_embedded_files;
283279

284280
if (!(consent_info_helper::CacheClassFromFiles(env, activity,
285281
&embedded_files) != nullptr &&
@@ -335,7 +331,7 @@ ConsentStatus ConsentInfoInternalAndroid::CppConsentStatusFromAndroid(
335331
if (status == enums().consentstatus_not_required)
336332
return kConsentStatusNotRequired;
337333
if (status == enums().consentstatus_obtained) return kConsentStatusObtained;
338-
LogWarning("GMA: Unknown ConsentStatus returned by UMP Android SDK: %d",
334+
LogWarning("UMP: Unknown ConsentStatus returned by UMP Android SDK: %d",
339335
(int)status);
340336
return kConsentStatusUnknown;
341337
}
@@ -350,7 +346,7 @@ ConsentInfoInternalAndroid::CppPrivacyOptionsRequirementStatusFromAndroid(
350346
if (status == enums().privacy_options_requirement_not_required)
351347
return kPrivacyOptionsRequirementStatusNotRequired;
352348
LogWarning(
353-
"GMA: Unknown PrivacyOptionsRequirementStatus returned by UMP Android "
349+
"UMP: Unknown PrivacyOptionsRequirementStatus returned by UMP Android "
354350
"SDK: %d",
355351
(int)status);
356352
return kPrivacyOptionsRequirementStatusUnknown;
@@ -387,7 +383,7 @@ ConsentInfoInternalAndroid::CppConsentRequestErrorFromAndroidFormError(
387383
else
388384
return kConsentRequestErrorInvalidOperation;
389385
}
390-
LogWarning("GMA: Unknown RequestError returned by UMP Android SDK: %d (%s)",
386+
LogWarning("UMP: Unknown RequestError returned by UMP Android SDK: %d (%s)",
391387
(int)error, message ? message : "");
392388
return kConsentRequestErrorUnknown;
393389
}
@@ -410,7 +406,7 @@ ConsentInfoInternalAndroid::CppConsentFormErrorFromAndroidFormError(
410406
else
411407
return kConsentFormErrorInvalidOperation;
412408
}
413-
LogWarning("GMA: Unknown RequestError returned by UMP Android SDK: %d (%s)",
409+
LogWarning("UMP: Unknown RequestError returned by UMP Android SDK: %d (%s)",
414410
(int)error, message ? message : "");
415411
return kConsentFormErrorUnknown;
416412
}
@@ -664,5 +660,4 @@ void ConsentInfoInternalAndroid::CompleteFutureFromJniCallback(
664660

665661
} // namespace internal
666662
} // namespace ump
667-
} // namespace gma
668663
} // namespace firebase

ump/src/android/consent_info_internal_android.h

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,43 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef FIREBASE_GMA_SRC_ANDROID_UMP_CONSENT_INFO_INTERNAL_ANDROID_H_
18-
#define FIREBASE_GMA_SRC_ANDROID_UMP_CONSENT_INFO_INTERNAL_ANDROID_H_
17+
#ifndef FIREBASE_UMP_SRC_ANDROID_CONSENT_INFO_INTERNAL_ANDROID_H_
18+
#define FIREBASE_UMP_SRC_ANDROID_CONSENT_INFO_INTERNAL_ANDROID_H_
1919

2020
#include <jni.h>
2121

2222
#include "app/src/util_android.h"
2323
#include "firebase/internal/mutex.h"
24-
#include "gma/src/common/ump/consent_info_internal.h"
24+
#include "ump/src/common/consent_info_internal.h"
2525

2626
namespace firebase {
27-
namespace gma {
2827
namespace ump {
28+
29+
// clang-format off
30+
#define UMP_INITIALIZATION_HELPER_METHODS(X) \
31+
X(InitializeUmp, "initializeUmp", "(Landroid/content/Context;)V", \
32+
util::kMethodTypeStatic)
33+
// clang-format on
34+
35+
METHOD_LOOKUP_DECLARATION(ump_initialization_helper,
36+
UMP_INITIALIZATION_HELPER_METHODS);
37+
38+
// Needed when UMP is initialized without Firebase.
39+
JNIEnv* GetJNI();
40+
41+
// Retrieves the activity used to initialize UMP.
42+
jobject GetActivity();
43+
44+
// Register the native callbacks needed by the Futures.
45+
bool RegisterNatives();
46+
47+
// Release classes registered by this module.
48+
void ReleaseClasses(JNIEnv* env);
49+
2950
namespace internal {
51+
extern ::firebase::Mutex g_cached_ump_embedded_files_mutex;
52+
extern std::vector<::firebase::internal::EmbeddedFile>*
53+
g_cached_ump_embedded_files;
3054

3155
class ConsentInfoInternalAndroid : public ConsentInfoInternal {
3256
public:
@@ -126,7 +150,6 @@ class ConsentInfoInternalAndroid : public ConsentInfoInternal {
126150

127151
} // namespace internal
128152
} // namespace ump
129-
} // namespace gma
130153
} // namespace firebase
131154

132-
#endif // FIREBASE_GMA_SRC_ANDROID_UMP_CONSENT_INFO_INTERNAL_ANDROID_H_
155+
#endif // FIREBASE_UMP_SRC_ANDROID_CONSENT_INFO_INTERNAL_ANDROID_H_

ump/src/common/consent_info.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "firebase/gma/ump/consent_info.h"
17+
#include "firebase/ump/consent_info.h"
1818

1919
#include "app/src/assert.h"
2020
#include "firebase/app.h"
21-
#include "firebase/gma/ump.h"
21+
#include "firebase/ump.h"
2222
#include "firebase/internal/platform.h"
23-
#include "gma/src/common/ump/consent_info_internal.h"
23+
#include "ump//src/common/consent_info_internal.h"
2424

2525
namespace firebase {
26-
namespace gma {
2726
namespace ump {
2827

2928
ConsentInfo* ConsentInfo::s_instance_ = nullptr;
@@ -180,5 +179,4 @@ void ConsentInfo::Reset() {
180179
}
181180

182181
} // namespace ump
183-
} // namespace gma
184182
} // namespace firebase

ump/src/common/consent_info_internal.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "gma/src/common/ump/consent_info_internal.h"
17+
#include "ump/src/common/consent_info_internal.h"
1818

1919
#include "app/src/include/firebase/internal/platform.h"
2020

2121
namespace firebase {
22-
namespace gma {
2322
namespace ump {
2423
namespace internal {
2524

@@ -86,5 +85,4 @@ const char* ConsentInfoInternal::GetConsentFormErrorMessage(
8685

8786
} // namespace internal
8887
} // namespace ump
89-
} // namespace gma
9088
} // namespace firebase

ump/src/common/consent_info_internal.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef FIREBASE_GMA_SRC_COMMON_UMP_CONSENT_INFO_INTERNAL_H_
18-
#define FIREBASE_GMA_SRC_COMMON_UMP_CONSENT_INFO_INTERNAL_H_
17+
#ifndef FIREBASE_UMP_SRC_COMMON_CONSENT_INFO_INTERNAL_H_
18+
#define FIREBASE_UMP_SRC_COMMON_CONSENT_INFO_INTERNAL_H_
1919

2020
#include "app/src/cleanup_notifier.h"
2121
#include "app/src/reference_counted_future_impl.h"
2222
#include "firebase/future.h"
23-
#include "firebase/gma/ump.h"
24-
#include "firebase/gma/ump/types.h"
23+
#include "firebase/ump.h"
24+
#include "firebase/ump/types.h"
2525
#include "firebase/internal/platform.h"
2626

2727
#if FIREBASE_PLATFORM_ANDROID
2828
#include <jni.h>
2929
#endif
3030

3131
namespace firebase {
32-
namespace gma {
3332
namespace ump {
3433
namespace internal {
3534

@@ -136,7 +135,6 @@ class ConsentInfoInternal {
136135

137136
} // namespace internal
138137
} // namespace ump
139-
} // namespace gma
140138
} // namespace firebase
141139

142-
#endif // FIREBASE_GMA_SRC_COMMON_UMP_CONSENT_INFO_INTERNAL_H_
140+
#endif // FIREBASE_UMP_SRC_COMMON_CONSENT_INFO_INTERNAL_H_

ump/src/include/firebase/ump.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_H_
18-
#define FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_H_
17+
#ifndef FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_H_
18+
#define FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_H_
1919

20-
#include "firebase/gma/ump/consent_info.h"
21-
#include "firebase/gma/ump/types.h"
20+
#include "firebase/ump/consent_info.h"
21+
#include "firebase/ump/types.h"
2222

23-
#endif // FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_H_
23+
#endif // FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_H_

ump/src/include/firebase/ump/consent_info.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_CONSENT_INFO_H_
18-
#define FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_CONSENT_INFO_H_
17+
#ifndef FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_CONSENT_INFO_H_
18+
#define FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_CONSENT_INFO_H_
1919

2020
#include "firebase/app.h"
2121
#include "firebase/future.h"
22-
#include "firebase/gma/ump/types.h"
22+
#include "firebase/ump/types.h"
2323
#include "firebase/internal/platform.h"
2424

2525
#if FIREBASE_PLATFORM_ANDROID
2626
#include <jni.h>
2727
#endif // FIREBASE_PLATFORM_ANDROID
2828

2929
namespace firebase {
30-
namespace gma {
3130
/// @brief API for User Messaging Platform.
3231
///
3332
/// The User Messaging Platform (UMP) SDK is Google’s option to handle user
@@ -75,10 +74,10 @@ class ConsentInfo {
7574
/// do something like this:
7675
/// @code
7776
/// #if defined(__ANDROID__)
78-
/// consent_info = firebase::gma::ump::ConsentInfo::GetInstance(jni_env,
77+
/// consent_info = firebase::ump::ConsentInfo::GetInstance(jni_env,
7978
/// activity);
8079
/// #else
81-
/// consent_info = firebase::gma::ump::GetInstance();
80+
/// consent_info = firebase::ump::GetInstance();
8281
/// #endif
8382
/// @endcode
8483
///
@@ -243,7 +242,6 @@ class ConsentInfo {
243242
};
244243

245244
} // namespace ump
246-
} // namespace gma
247245
} // namespace firebase
248246

249-
#endif // FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_CONSENT_INFO_H_
247+
#endif // FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_CONSENT_INFO_H_

ump/src/include/firebase/ump/types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_TYPES_H_
18-
#define FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_TYPES_H_
17+
#ifndef FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_TYPES_H_
18+
#define FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_TYPES_H_
1919

2020
#include <string>
2121
#include <utility>
@@ -176,4 +176,4 @@ enum PrivacyOptionsRequirementStatus {
176176
} // namespace gma
177177
} // namespace firebase
178178

179-
#endif // FIREBASE_GMA_SRC_INCLUDE_FIREBASE_GMA_UMP_TYPES_H_
179+
#endif // FIREBASE_UMP_SRC_INCLUDE_FIREBASE_UMP_TYPES_H_

ump/src/ios/consent_info_internal_ios.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef FIREBASE_GMA_SRC_IOS_UMP_CONSENT_INFO_INTERNAL_IOS_H_
18-
#define FIREBASE_GMA_SRC_IOS_UMP_CONSENT_INFO_INTERNAL_IOS_H_
17+
#ifndef FIREBASE_UMP_SRC_IOS_CONSENT_INFO_INTERNAL_IOS_H_
18+
#define FIREBASE_UMP_SRC_IOS_CONSENT_INFO_INTERNAL_IOS_H_
1919

2020
#include <UserMessagingPlatform/UserMessagingPlatform.h>
2121

2222
#include "firebase/internal/mutex.h"
23-
#include "gma/src/common/ump/consent_info_internal.h"
23+
#include "ump/src/common/consent_info_internal.h"
2424

2525
namespace firebase {
26-
namespace gma {
2726
namespace ump {
2827
namespace internal {
2928

@@ -63,7 +62,6 @@ class ConsentInfoInternalIos : public ConsentInfoInternal {
6362

6463
} // namespace internal
6564
} // namespace ump
66-
} // namespace gma
6765
} // namespace firebase
6866

69-
#endif // FIREBASE_GMA_SRC_IOS_UMP_CONSENT_INFO_INTERNAL_IOS_H_
67+
#endif // FIREBASE_UMP_SRC_IOS_CONSENT_INFO_INTERNAL_IOS_H_

0 commit comments

Comments
 (0)