Skip to content

Commit

Permalink
Add User Messaging Platform C++ SDK (#1461)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
jonsimantov authored Oct 6, 2023
2 parents a75c280 + e6be822 commit 6b4d9de
Show file tree
Hide file tree
Showing 33 changed files with 3,567 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Android/firebase_dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def firebaseDependenciesMap = [
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links'],
'firestore' : ['com.google.firebase:firebase-firestore'],
'functions' : ['com.google.firebase:firebase-functions'],
'gma' : ['com.google.android.gms:play-services-ads:22.3.0'],
'gma' : ['com.google.android.gms:play-services-ads:22.3.0',
'com.google.android.ump:user-messaging-platform:2.1.0'],
'installations' : ['com.google.firebase:firebase-installations'],
'invites' : ['com.google.firebase:firebase-invites'],
// Messaging has an additional local dependency to include.
Expand Down
5 changes: 4 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,10 @@ if (IOS)
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/interstitial_ad.h
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/internal/native_ad.h
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/rewarded_ad.h
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/types.h)
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/types.h
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/ump.h
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/ump/consent_info.h
${FIREBASE_SOURCE_DIR}/gma/src/include/firebase/gma/ump/types.h)
set(installations_HDRS
${FIREBASE_SOURCE_DIR}/installations/src/include/firebase/installations.h)
set(messaging_HDRS
Expand Down
7 changes: 7 additions & 0 deletions gma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

# Common source files used by all platforms
set(common_SRCS
src/common/ump/consent_info.cc
src/common/ump/consent_info_internal.cc
src/common/gma_common.cc
src/common/ad_view.cc
src/common/ad_view_internal.cc
Expand All @@ -38,6 +40,7 @@ binary_to_array("gma_resources"
# Source files used by the Android implementation.
set(android_SRCS
${gma_resources_source}
src/android/ump/consent_info_internal_android.cc
src/android/ad_request_converter.cc
src/android/ad_error_android.cc
src/android/adapter_response_info_android.cc
Expand All @@ -51,6 +54,7 @@ set(android_SRCS

# Source files used by the iOS implementation.
set(ios_SRCS
src/ios/ump/consent_info_internal_ios.mm
src/ios/FADAdSize.mm
src/ios/FADAdView.mm
src/ios/FADInterstitialDelegate.mm
Expand All @@ -69,6 +73,7 @@ set(ios_SRCS

# Source files used by the stub implementation.
set(stub_SRCS
src/stub/ump/consent_info_internal_stub.cc
src/stub/ad_error_stub.cc
src/stub/adapter_response_info_stub.cc
src/stub/gma_stub.cc
Expand Down Expand Up @@ -128,11 +133,13 @@ elseif(IOS)
firebase_gma
POD_NAMES
Google-Mobile-Ads-SDK
GoogleUserMessagingPlatform
)

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

if (FIREBASE_XCODE_TARGET_FORMAT STREQUAL "frameworks")
set_target_properties(firebase_gma PROPERTIES
Expand Down
6 changes: 6 additions & 0 deletions gma/gma_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ allprojects {
apply plugin: 'com.android.library'

android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}

compileSdkVersion 28

sourceSets {
Expand All @@ -48,6 +53,7 @@ dependencies {
implementation platform('com.google.firebase:firebase-bom:32.3.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.gms:play-services-ads:22.3.0'
implementation 'com.google.android.ump:user-messaging-platform:2.1.0'
}

afterEvaluate {
Expand Down
2 changes: 1 addition & 1 deletion gma/integration_test/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="@string/app_name">
<!-- You may replace the sample App ID below with your own App ID. -->
<meta-data
Expand Down
2 changes: 2 additions & 0 deletions gma/integration_test/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
1 change: 1 addition & 0 deletions gma/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use_frameworks! :linkage => :static
target 'integration_test' do
pod 'Firebase/CoreOnly', '10.15.0'
pod 'Google-Mobile-Ads-SDK', '10.10.0'
pod 'GoogleUserMessagingPlatform', '2.1.0'
end

post_install do |installer|
Expand Down
5 changes: 4 additions & 1 deletion gma/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ android {

defaultConfig {
applicationId 'com.google.android.admob.testapp'
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName '1.0'
Expand All @@ -73,6 +73,9 @@ android {
proguardFile file('proguard.pro')
}
}
lintOptions {
abortOnError false
}
}

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
D640F3172819C85800AC956E /* empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = D640F3162819C85800AC956E /* empty.swift */; };
D66B16871CE46E8900E5638A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D66B16861CE46E8900E5638A /* LaunchScreen.storyboard */; };
D67D355822BABD2200292C1D /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = D67D355622BABD2100292C1D /* gtest-all.cc */; };
D686A3292A8B16F20034845A /* AppTrackingTransparency.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D686A3282A8B16F20034845A /* AppTrackingTransparency.framework */; };
D6C179E922CB322900C2651A /* ios_app_framework.mm in Sources */ = {isa = PBXBuildFile; fileRef = D6C179E722CB322900C2651A /* ios_app_framework.mm */; };
D6C179EA22CB322900C2651A /* ios_firebase_test_framework.mm in Sources */ = {isa = PBXBuildFile; fileRef = D6C179E822CB322900C2651A /* ios_firebase_test_framework.mm */; };
D6C179EE22CB323300C2651A /* firebase_test_framework.cc in Sources */ = {isa = PBXBuildFile; fileRef = D6C179EC22CB323300C2651A /* firebase_test_framework.cc */; };
Expand All @@ -39,6 +40,7 @@
D66B16861CE46E8900E5638A /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
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>"; };
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>"; };
D686A3282A8B16F20034845A /* AppTrackingTransparency.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppTrackingTransparency.framework; path = System/Library/Frameworks/AppTrackingTransparency.framework; sourceTree = SDKROOT; };
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>"; };
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>"; };
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>"; };
Expand All @@ -53,6 +55,7 @@
buildActionMask = 2147483647;
files = (
529226D81C85F68000C89379 /* CoreGraphics.framework in Frameworks */,
D686A3292A8B16F20034845A /* AppTrackingTransparency.framework in Frameworks */,
529226DA1C85F68000C89379 /* UIKit.framework in Frameworks */,
529226D61C85F68000C89379 /* Foundation.framework in Frameworks */,
);
Expand Down Expand Up @@ -85,6 +88,7 @@
529226D41C85F68000C89379 /* Frameworks */ = {
isa = PBXGroup;
children = (
D686A3282A8B16F20034845A /* AppTrackingTransparency.framework */,
529226D51C85F68000C89379 /* Foundation.framework */,
529226D71C85F68000C89379 /* CoreGraphics.framework */,
529226D91C85F68000C89379 /* UIKit.framework */,
Expand Down
Loading

0 comments on commit 6b4d9de

Please sign in to comment.