Skip to content

Commit 6b4d9de

Browse files
authored
Add User Messaging Platform C++ SDK (#1461)
### Description > Provide details of the change, and generalize the change in the PR title above. Merge the UMP feature branch into the main branch. *** ### Testing > Describe how you've tested these changes. Link any manually triggered `Integration tests` or `CPP binary SDK Packaging` Github Action workflows, if applicable. Integration tests in this PR. *** ### Type of Change Place an `x` the applicable box: - [ ] Bug fix. Add the issue # below if applicable. - [x] New feature. A non-breaking change which adds functionality. - [ ] Other, such as a build process or documentation change. *** #### Notes - Bug fixes and feature changes require an update to the `Release Notes` section of `release_build_files/readme.md`. - Read the contribution guidelines [CONTRIBUTING.md](https://github.com/firebase/firebase-cpp-sdk/blob/main/CONTRIBUTING.md). - Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.
2 parents a75c280 + e6be822 commit 6b4d9de

33 files changed

+3567
-11
lines changed

Android/firebase_dependencies.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def firebaseDependenciesMap = [
2727
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links'],
2828
'firestore' : ['com.google.firebase:firebase-firestore'],
2929
'functions' : ['com.google.firebase:firebase-functions'],
30-
'gma' : ['com.google.android.gms:play-services-ads:22.3.0'],
30+
'gma' : ['com.google.android.gms:play-services-ads:22.3.0',
31+
'com.google.android.ump:user-messaging-platform:2.1.0'],
3132
'installations' : ['com.google.firebase:firebase-installations'],
3233
'invites' : ['com.google.firebase:firebase-invites'],
3334
// Messaging has an additional local dependency to include.

app/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,10 @@ if (IOS)
547547
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/interstitial_ad.h
548548
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/internal/native_ad.h
549549
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/rewarded_ad.h
550-
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/types.h)
550+
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/types.h
551+
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/ump.h
552+
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/ump/consent_info.h
553+
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/ump/types.h)
551554
set(installations_HDRS
552555
${FIREBASE_SOURCE_DIR}/installations/src/include/firebase/installations.h)
553556
set(messaging_HDRS

gma/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
# Common source files used by all platforms
1818
set(common_SRCS
19+
src/common/ump/consent_info.cc
20+
src/common/ump/consent_info_internal.cc
1921
src/common/gma_common.cc
2022
src/common/ad_view.cc
2123
src/common/ad_view_internal.cc
@@ -38,6 +40,7 @@ binary_to_array("gma_resources"
3840
# Source files used by the Android implementation.
3941
set(android_SRCS
4042
${gma_resources_source}
43+
src/android/ump/consent_info_internal_android.cc
4144
src/android/ad_request_converter.cc
4245
src/android/ad_error_android.cc
4346
src/android/adapter_response_info_android.cc
@@ -51,6 +54,7 @@ set(android_SRCS
5154

5255
# Source files used by the iOS implementation.
5356
set(ios_SRCS
57+
src/ios/ump/consent_info_internal_ios.mm
5458
src/ios/FADAdSize.mm
5559
src/ios/FADAdView.mm
5660
src/ios/FADInterstitialDelegate.mm
@@ -69,6 +73,7 @@ set(ios_SRCS
6973

7074
# Source files used by the stub implementation.
7175
set(stub_SRCS
76+
src/stub/ump/consent_info_internal_stub.cc
7277
src/stub/ad_error_stub.cc
7378
src/stub/adapter_response_info_stub.cc
7479
src/stub/gma_stub.cc
@@ -128,11 +133,13 @@ elseif(IOS)
128133
firebase_gma
129134
POD_NAMES
130135
Google-Mobile-Ads-SDK
136+
GoogleUserMessagingPlatform
131137
)
132138

133139
# GMA expects the header files to be in a subfolder, so set up a symlink to
134140
# accomplish that.
135141
symlink_pod_headers(firebase_gma Google-Mobile-Ads-SDK GoogleMobileAds)
142+
symlink_pod_headers(firebase_gma GoogleUserMessagingPlatform UserMessagingPlatform)
136143

137144
if (FIREBASE_XCODE_TARGET_FORMAT STREQUAL "frameworks")
138145
set_target_properties(firebase_gma PROPERTIES

gma/gma_resources/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ allprojects {
3232
apply plugin: 'com.android.library'
3333

3434
android {
35+
compileOptions {
36+
sourceCompatibility 1.8
37+
targetCompatibility 1.8
38+
}
39+
3540
compileSdkVersion 28
3641

3742
sourceSets {
@@ -48,6 +53,7 @@ dependencies {
4853
implementation platform('com.google.firebase:firebase-bom:32.3.1')
4954
implementation 'com.google.firebase:firebase-analytics'
5055
implementation 'com.google.android.gms:play-services-ads:22.3.0'
56+
implementation 'com.google.android.ump:user-messaging-platform:2.1.0'
5157
}
5258

5359
afterEvaluate {

gma/integration_test/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<uses-permission android:name="android.permission.INTERNET" />
2323
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2424
<uses-permission android:name="android.permission.WAKE_LOCK" />
25-
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
25+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
2626
<application android:label="@string/app_name">
2727
<!-- You may replace the sample App ID below with your own App ID. -->
2828
<meta-data

gma/integration_test/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<true/>
2525
<key>UILaunchStoryboardName</key>
2626
<string>LaunchScreen</string>
27+
<key>NSUserTrackingUsageDescription</key>
28+
<string>This identifier will be used to deliver personalized ads to you.</string>
2729
<key>CFBundleURLTypes</key>
2830
<array>
2931
<dict>

gma/integration_test/Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use_frameworks! :linkage => :static
66
target 'integration_test' do
77
pod 'Firebase/CoreOnly', '10.15.0'
88
pod 'Google-Mobile-Ads-SDK', '10.10.0'
9+
pod 'GoogleUserMessagingPlatform', '2.1.0'
910
end
1011

1112
post_install do |installer|

gma/integration_test/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ android {
5454

5555
defaultConfig {
5656
applicationId 'com.google.android.admob.testapp'
57-
minSdkVersion 19
57+
minSdkVersion 21
5858
targetSdkVersion 28
5959
versionCode 1
6060
versionName '1.0'
@@ -73,6 +73,9 @@ android {
7373
proguardFile file('proguard.pro')
7474
}
7575
}
76+
lintOptions {
77+
abortOnError false
78+
}
7679
}
7780

7881
apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"

gma/integration_test/integration_test.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
D640F3172819C85800AC956E /* empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = D640F3162819C85800AC956E /* empty.swift */; };
1818
D66B16871CE46E8900E5638A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D66B16861CE46E8900E5638A /* LaunchScreen.storyboard */; };
1919
D67D355822BABD2200292C1D /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = D67D355622BABD2100292C1D /* gtest-all.cc */; };
20+
D686A3292A8B16F20034845A /* AppTrackingTransparency.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D686A3282A8B16F20034845A /* AppTrackingTransparency.framework */; };
2021
D6C179E922CB322900C2651A /* ios_app_framework.mm in Sources */ = {isa = PBXBuildFile; fileRef = D6C179E722CB322900C2651A /* ios_app_framework.mm */; };
2122
D6C179EA22CB322900C2651A /* ios_firebase_test_framework.mm in Sources */ = {isa = PBXBuildFile; fileRef = D6C179E822CB322900C2651A /* ios_firebase_test_framework.mm */; };
2223
D6C179EE22CB323300C2651A /* firebase_test_framework.cc in Sources */ = {isa = PBXBuildFile; fileRef = D6C179EC22CB323300C2651A /* firebase_test_framework.cc */; };
@@ -39,6 +40,7 @@
3940
D66B16861CE46E8900E5638A /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
4041
D67D355622BABD2100292C1D /* gtest-all.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "gtest-all.cc"; path = "external/googletest/src/googletest/src/gtest-all.cc"; sourceTree = "<group>"; };
4142
D67D355722BABD2100292C1D /* gtest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gtest.h; path = external/googletest/src/googletest/include/gtest/gtest.h; sourceTree = "<group>"; };
43+
D686A3282A8B16F20034845A /* AppTrackingTransparency.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppTrackingTransparency.framework; path = System/Library/Frameworks/AppTrackingTransparency.framework; sourceTree = SDKROOT; };
4244
D6C179E722CB322900C2651A /* ios_app_framework.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ios_app_framework.mm; path = src/ios/ios_app_framework.mm; sourceTree = "<group>"; };
4345
D6C179E822CB322900C2651A /* ios_firebase_test_framework.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ios_firebase_test_framework.mm; path = src/ios/ios_firebase_test_framework.mm; sourceTree = "<group>"; };
4446
D6C179EB22CB323300C2651A /* firebase_test_framework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = firebase_test_framework.h; path = src/firebase_test_framework.h; sourceTree = "<group>"; };
@@ -53,6 +55,7 @@
5355
buildActionMask = 2147483647;
5456
files = (
5557
529226D81C85F68000C89379 /* CoreGraphics.framework in Frameworks */,
58+
D686A3292A8B16F20034845A /* AppTrackingTransparency.framework in Frameworks */,
5659
529226DA1C85F68000C89379 /* UIKit.framework in Frameworks */,
5760
529226D61C85F68000C89379 /* Foundation.framework in Frameworks */,
5861
);
@@ -85,6 +88,7 @@
8588
529226D41C85F68000C89379 /* Frameworks */ = {
8689
isa = PBXGroup;
8790
children = (
91+
D686A3282A8B16F20034845A /* AppTrackingTransparency.framework */,
8892
529226D51C85F68000C89379 /* Foundation.framework */,
8993
529226D71C85F68000C89379 /* CoreGraphics.framework */,
9094
529226D91C85F68000C89379 /* UIKit.framework */,

0 commit comments

Comments
 (0)