From 8d28af4ff440473d6ccf95184c237d9fa359b135 Mon Sep 17 00:00:00 2001 From: Mobile Ads Developer Relations Date: Wed, 18 Jun 2025 01:11:50 -0700 Subject: [PATCH] Replaced usage of GADUConsentStatus with UMPConsentStatus. PiperOrigin-RevId: 772809133 --- .../Plugins/Ump/iOS/GADUConsentInformation.h | 41 ++----------------- .../Plugins/Ump/iOS/GADUConsentInformation.m | 22 ++++------ 2 files changed, 12 insertions(+), 51 deletions(-) diff --git a/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.h b/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.h index 1476a5d09..953dfb717 100644 --- a/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.h +++ b/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.h @@ -1,58 +1,23 @@ // Copyright 2022 Google LLC. All Rights Reserved. +#import #import #import "GADURequestParameters.h" #import "GADUUmpTypes.h" -/// Consent status values. -typedef NS_ENUM(NSInteger, GADUConsentStatus) { - kGADUConsentStatusUnknown = 0, ///< Unknown consent status. - kGADUConsentStatusNotRequired = 1, ///< Consent not required. - kGADUConsentStatusRequired = 2, ///< User consent required but not yet obtained. - kGADUConsentStatusObtained = - 3, ///< User consent obtained, personalized vs non-personalized undefined. -}; - -/// State values for whether the user has a consent form available to them. To check whether form -/// status has changed, an update can be requested through -/// requestConsentInfoUpdateWithParameters:completionHandler. -typedef NS_ENUM(NSInteger, GADUFormStatus) { - /// Whether a consent form is available is unknown. An update should be requested using - /// requestConsentInfoUpdateWithParameters:completionHandler. - kGADUFormStatusUnknown = 0, - - /// Consent forms are available and can be loaded using [UMPConsentForm - /// loadWithCompletionHandler:]. - kGADUFormStatusAvailable = 1, - - /// Consent forms are unavailable. Showing a consent form is not required. - kGADUFormStatusUnavailable = 2, -}; - -/// State values for whether the user needs to be provided a way to modify their privacy options. -typedef NS_ENUM(NSInteger, GADUPrivacyOptionsRequirementStatus) { - /// Requirement unknown. - kGADUPrivacyOptionsRequirementStatusUnknown = 0, - /// A way must be provided for the user to modify their privacy options. - kGADUPrivacyOptionsRequirementStatusRequired = 1, - /// User does not need to modify their privacy options. Either consent is not required, or the - /// consent type does not require modification. - kGADUPrivacyOptionsRequirementStatusNotRequired = 2, -}; - /// Utility methods for collecting consent from users. @interface GADUConsentInformation : NSObject /// The user's consent status. This value is cached between app sessions and can be read before /// requesting updated parameters. -@property(readonly, nonatomic) GADUConsentStatus consentStatus; +@property(readonly, nonatomic) UMPConsentStatus consentStatus; /// Check if the app has finished all the required consent flow and can request ads now. /// A return value of true means the app can request ads now. @property(nonatomic, readonly) BOOL canRequestAds; /// The privacy options requirement status. -@property(nonatomic, readonly) GADUPrivacyOptionsRequirementStatus privacyOptionsRequirementStatus; +@property(nonatomic, readonly) UMPPrivacyOptionsRequirementStatus privacyOptionsRequirementStatus; /// YES if consent form is available, NO otherwise. An update should be requested using /// requestConsentInfoUpdateWithParameters. diff --git a/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.m b/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.m index 137d93521..195153ace 100644 --- a/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.m +++ b/source/plugin/Assets/Plugins/Ump/iOS/GADUConsentInformation.m @@ -1,7 +1,6 @@ // Copyright 2022 Google LLC. All Rights Reserved. #import "GADUConsentInformation.h" -#import #import "GADUDebugSettings.h" #import "GADUDispatch.h" @@ -25,13 +24,13 @@ - (instancetype)initWithConsentInformationClientReference: return self; } -- (GADUConsentStatus)consentStatus { - __block GADUConsentStatus status; - if (NSThread.isMainThread) { - status = (GADUConsentStatus)UMPConsentInformation.sharedInstance.consentStatus; +- (UMPConsentStatus)consentStatus { + __block UMPConsentStatus status; + if (!NSThread.isMainThread) { + status = UMPConsentInformation.sharedInstance.consentStatus; } else { dispatch_sync(dispatch_get_main_queue(), ^{ - status = (GADUConsentStatus)UMPConsentInformation.sharedInstance.consentStatus; + status = UMPConsentInformation.sharedInstance.consentStatus; }); } return status; @@ -49,16 +48,13 @@ - (BOOL)canRequestAds { return status; } -- (GADUPrivacyOptionsRequirementStatus)privacyOptionsRequirementStatus { - __block GADUPrivacyOptionsRequirementStatus status; +- (UMPPrivacyOptionsRequirementStatus)privacyOptionsRequirementStatus { + __block UMPPrivacyOptionsRequirementStatus status; if (NSThread.isMainThread) { - status = - (GADUPrivacyOptionsRequirementStatus)[UMPConsentInformation - .sharedInstance privacyOptionsRequirementStatus]; + status = [UMPConsentInformation.sharedInstance privacyOptionsRequirementStatus]; } else { dispatch_sync(dispatch_get_main_queue(), ^{ - status = (GADUPrivacyOptionsRequirementStatus)[UMPConsentInformation.sharedInstance - privacyOptionsRequirementStatus]; + status = [UMPConsentInformation.sharedInstance privacyOptionsRequirementStatus]; }); } return status;