Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 697616850
  • Loading branch information
Justin Malandruccolo authored and copybara-github committed Nov 18, 2024
1 parent 043de5a commit 413d8e9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,35 @@ - (void)gatherConsentFromConsentPresentationViewController:(UIViewController *)v
// debugSettings.geography = UMPDebugGeographyEEA;
parameters.debugSettings = debugSettings;

// [START gather_consent]
// [START request_consent_info_update]
// Requesting an update to consent information should be called on every app launch.
[UMPConsentInformation.sharedInstance
requestConsentInfoUpdateWithParameters:parameters
completionHandler:^(NSError *_Nullable requestConsentError) {
// [START_EXCLUDE]
if (requestConsentError) {
consentGatheringComplete(requestConsentError);
} else {
[UMPConsentForm
loadAndPresentIfRequiredFromViewController:viewController
completionHandler:^(
NSError
*_Nullable loadAndPresentError) {
// Consent has been gathered.
consentGatheringComplete(
loadAndPresentError);
}];
[self loadAndPresentIfRequiredFromViewController:viewController
completionHandler:consentGatheringComplete];
}
// [END_EXCLUDE]
}];
// [END gather_consent]
// [END request_consent_info_update]
}

- (void)loadAndPresentIfRequiredFromViewController:(UIViewController *)viewController
completionHandler:(void (^)(NSError *_Nullable))completionHandler {
// [START load_and_present_consent_form]
[UMPConsentForm
loadAndPresentIfRequiredFromViewController:viewController
completionHandler:^(NSError *_Nullable loadAndPresentError) {
// Consent gathering process is complete.
// [START_EXCLUDE silent]
completionHandler(loadAndPresentError);
// [END_EXCLUDE]
}];
// [END load_and_present_consent_form]
}

- (void)presentPrivacyOptionsFormFromViewController:(UIViewController *)viewController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,29 @@ class GoogleMobileAdsConsentManager: NSObject {
// debugSettings.geography = UMPDebugGeography.EEA
parameters.debugSettings = debugSettings

// [START gather_consent]
// [START request_consent_info_update]
// Requesting an update to consent information should be called on every app launch.
UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(with: parameters) {
requestConsentError in
// [START_EXCLUDE]
guard requestConsentError == nil else {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
do {
// [START load_and_present_consent_form]
try await UMPConsentForm.loadAndPresentIfRequired(from: viewController)
// [END load_and_present_consent_form]
// Consent has been gathered.
consentGatheringComplete(nil)
} catch {
consentGatheringComplete(error)
}
}
// [END_EXCLUDE]
}
// [END gather_consent]
// [END request_consent_info_update]
}

/// Helper method to call the UMP SDK method to present the privacy options form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,29 @@ class GoogleMobileAdsConsentManager: NSObject {
// debugSettings.geography = UMPDebugGeography.EEA
parameters.debugSettings = debugSettings

// [START gather_consent]
// [START request_consent_info_update]
// Requesting an update to consent information should be called on every app launch.
UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(with: parameters) {
requestConsentError in
// [START_EXCLUDE]
guard requestConsentError == nil else {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
do {
// [START load_and_present_consent_form]
try await UMPConsentForm.loadAndPresentIfRequired(from: nil)
// [END load_and_present_consent_form]
// Consent has been gathered.
consentGatheringComplete(nil)
} catch {
consentGatheringComplete(error)
}
}
// [END_EXCLUDE]
}
// [END gather_consent]
// [END request_consent_info_update]
}

/// Helper method to call the UMP SDK method to present the privacy options form.
Expand Down

0 comments on commit 413d8e9

Please sign in to comment.