From e27f29ab207d51220ab0d78fc4100216ca48d428 Mon Sep 17 00:00:00 2001 From: Jing Liu Date: Mon, 27 Nov 2023 16:34:47 -0800 Subject: [PATCH 1/2] Add product_id to clearcut logging for compliance. --- FirebaseMessaging.podspec | 2 +- FirebaseMessaging/Sources/FIRMessagingConstants.h | 1 + FirebaseMessaging/Sources/FIRMessagingConstants.m | 1 + FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m | 9 ++++++++- Package.swift | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/FirebaseMessaging.podspec b/FirebaseMessaging.podspec index 0949111725f..29c94be68fa 100644 --- a/FirebaseMessaging.podspec +++ b/FirebaseMessaging.podspec @@ -64,7 +64,7 @@ device, and it is completely free. s.dependency 'GoogleUtilities/Reachability', '~> 7.8' s.dependency 'GoogleUtilities/Environment', '~> 7.8' s.dependency 'GoogleUtilities/UserDefaults', '~> 7.8' - s.dependency 'GoogleDataTransport', '~> 9.2' + s.dependency 'GoogleDataTransport', '~> 9.3' s.dependency 'nanopb', '>= 2.30908.0', '< 2.30910.0' s.test_spec 'unit' do |unit_tests| diff --git a/FirebaseMessaging/Sources/FIRMessagingConstants.h b/FirebaseMessaging/Sources/FIRMessagingConstants.h index 6984db3084b..b3eac74434f 100644 --- a/FirebaseMessaging/Sources/FIRMessagingConstants.h +++ b/FirebaseMessaging/Sources/FIRMessagingConstants.h @@ -33,6 +33,7 @@ FOUNDATION_EXPORT NSString *const kFIRMessagingFID; FOUNDATION_EXPORT NSString *const kFIRMessagingAnalyticsComposerIdentifier; FOUNDATION_EXPORT NSString *const kFIRMessagingAnalyticsMessageLabel; FOUNDATION_EXPORT NSString *const kFIRMessagingAnalyticsComposerLabel; +FOUNDATION_EXPORT NSString *const kFIRMessagingProductID; FOUNDATION_EXPORT NSString *const kFIRMessagingRemoteNotificationsProxyEnabledInfoPlistKey; FOUNDATION_EXPORT NSString *const kFIRMessagingSubDirectoryName; diff --git a/FirebaseMessaging/Sources/FIRMessagingConstants.m b/FirebaseMessaging/Sources/FIRMessagingConstants.m index e40794d8726..88536eb503d 100644 --- a/FirebaseMessaging/Sources/FIRMessagingConstants.m +++ b/FirebaseMessaging/Sources/FIRMessagingConstants.m @@ -43,6 +43,7 @@ NSString *const kFIRMessagingAnalyticsComposerIdentifier = @"google.c.a.c_id"; NSString *const kFIRMessagingAnalyticsMessageLabel = @"google.c.a.m_l"; NSString *const kFIRMessagingAnalyticsComposerLabel = @"google.c.a.c_l"; +NSString *const kFIRMessagingProductID = @"google.product_id"; NSString *const kFIRMessagingRemoteNotificationsProxyEnabledInfoPlistKey = @"FirebaseAppDelegateProxyEnabled"; diff --git a/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m b/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m index dee7d5d5927..30c4174f24e 100644 --- a/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m +++ b/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m @@ -266,7 +266,14 @@ - (void)exportDeliveryMetricsToBigQueryWithMessageInfo:(NSDictionary *)info { FIRMessagingMetricsLog *log = [[FIRMessagingMetricsLog alloc] initWithEventExtension:eventExtension]; - GDTCOREvent *event = [transport eventForTransport]; + GDTCOREvent *event; + if (info[kFIRMessagingProductID]) { + event = [transport eventForTransport]; + } else { + int32_t productID = [info[kFIRMessagingProductID] intValue]; + GDTCORProductData *productData = [[GDTCORProductData alloc] initWithProductID:productID]; + event = [transport eventForTransportWithProductData:productData]; + } event.dataObject = log; event.qosTier = GDTCOREventQoSFast; diff --git a/Package.swift b/Package.swift index 1ca093b5977..c9eba1843c1 100644 --- a/Package.swift +++ b/Package.swift @@ -150,7 +150,7 @@ let package = Package( googleAppMeasurementDependency(), .package( url: "https://github.com/google/GoogleDataTransport.git", - "9.2.0" ..< "10.0.0" + "9.3.0" ..< "10.0.0" ), .package( url: "https://github.com/google/GoogleUtilities.git", From 95c354cdbfa00d9e5ecb361c0375c06ab0f545a6 Mon Sep 17 00:00:00 2001 From: Jing Liu Date: Tue, 28 Nov 2023 11:59:05 -0800 Subject: [PATCH 2/2] Switch the if and else blocks. I changed the code for testing, but forgot to change it back. --- FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m b/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m index 30c4174f24e..a632c4ff854 100644 --- a/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m +++ b/FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m @@ -268,11 +268,11 @@ - (void)exportDeliveryMetricsToBigQueryWithMessageInfo:(NSDictionary *)info { GDTCOREvent *event; if (info[kFIRMessagingProductID]) { - event = [transport eventForTransport]; - } else { int32_t productID = [info[kFIRMessagingProductID] intValue]; GDTCORProductData *productData = [[GDTCORProductData alloc] initWithProductID:productID]; event = [transport eventForTransportWithProductData:productData]; + } else { + event = [transport eventForTransport]; } event.dataObject = log; event.qosTier = GDTCOREventQoSFast;