Update UMP Package
This commit is contained in:
parent
5d2363b3f2
commit
136fe59b6b
9
Packages/com.bywaystudios.googleump/Plugins.meta
Normal file
9
Packages/com.bywaystudios.googleump/Plugins.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbde64d36fd994c458fffca9e931b232
|
||||
folderAsset: yes
|
||||
timeCreated: 1437157376
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Packages/com.bywaystudios.googleump/Plugins/Android.meta
Normal file
9
Packages/com.bywaystudios.googleump/Plugins/Android.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f5d736f7c4cb4c1e80d0816d0e81625
|
||||
folderAsset: yes
|
||||
timeCreated: 1437157376
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,67 @@
|
||||
package com.google.unity.ump;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.android.ump.ConsentForm;
|
||||
import com.google.android.ump.ConsentForm.OnConsentFormDismissedListener;
|
||||
import com.google.android.ump.FormError;
|
||||
import com.google.android.ump.UserMessagingPlatform;
|
||||
|
||||
/** Native consent form implementation for the Unity UMP plugin. */
|
||||
public class UnityConsentForm {
|
||||
|
||||
/** The {@code Activity} on which the consent form will display. */
|
||||
private final Activity activity;
|
||||
|
||||
/**
|
||||
* A listener implemented in Unity via {@code AndroidJavaProxy} to receive consent form events.
|
||||
*/
|
||||
private final UnityConsentFormCallback callback;
|
||||
|
||||
/** Callback to be invoked when a consent form is dismissed. */
|
||||
private final OnConsentFormDismissedListener onConsentFormDismissedListener =
|
||||
new OnConsentFormDismissedListener() {
|
||||
@Override
|
||||
public void onConsentFormDismissed(final FormError error) {
|
||||
new Thread(
|
||||
() -> {
|
||||
if (callback != null) {
|
||||
callback.onConsentFormDismissed(error);
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
};
|
||||
|
||||
public UnityConsentForm(Activity activity, UnityConsentFormCallback callback) {
|
||||
this.activity = activity;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and shows a consent form.
|
||||
*
|
||||
* <p>This method must be called on the main thread.
|
||||
*/
|
||||
public void loadAndShowConsentFormIfRequired() {
|
||||
UserMessagingPlatform.loadAndShowConsentFormIfRequired(
|
||||
activity, onConsentFormDismissedListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the consent form.
|
||||
*
|
||||
* <p>This method must be called on the main thread.
|
||||
*/
|
||||
public void show(ConsentForm consentForm) {
|
||||
consentForm.show(activity, onConsentFormDismissedListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Presents a privacy options form from the provided {@code Activity} if required.
|
||||
*
|
||||
* <p>This method must be called on the main thread.
|
||||
*/
|
||||
public void showPrivacyOptionsForm() {
|
||||
UserMessagingPlatform.showPrivacyOptionsForm(activity, onConsentFormDismissedListener);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0b21b6845b064e45a64a1eff7ad54ff
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,12 @@
|
||||
package com.google.unity.ump;
|
||||
|
||||
import com.google.android.ump.FormError;
|
||||
|
||||
/**
|
||||
* An interface that can be implemented via {@code AndroidJavaProxy} in Unity to receive consent
|
||||
* form events synchronously.
|
||||
*/
|
||||
public interface UnityConsentFormCallback {
|
||||
|
||||
void onConsentFormDismissed(FormError error);
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 584674c10cc66684eaff07a1fe2bef78
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e96e2e59b05d478fb659105b5efb85d
|
||||
guid: 469bfdc4d934d5944b074d82f141e9a6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@ -0,0 +1,45 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UserMessagingPlatform/UMPConsentForm.h>
|
||||
#import "GADUUmpTypes.h"
|
||||
|
||||
/// A rendered form for collecting consent from a user.
|
||||
@interface GADUConsentForm : NSObject
|
||||
|
||||
/// Initializes a consent form.
|
||||
- (nullable instancetype)initWithConsentFormClientReference:
|
||||
(_Nonnull GADUTypeConsentFormClientRef *_Nonnull)consentFormClient;
|
||||
|
||||
/// Loads a consent form and calls formLoadedCompletionHandler on completion.
|
||||
- (void)loadFormWithCompletionHandler:
|
||||
(nonnull GADUConsentFormLoadCompletionHandler)formLoadedCompletionHandler;
|
||||
|
||||
/// Presents the full screen consent form over the Unity controller.
|
||||
/// UMPConsentInformation.sharedInstance.consentStatus is updated, the
|
||||
/// formPresentedCompletionHandler is called and the form is dismissed when the user taps the
|
||||
/// consent button.
|
||||
- (void)showWithCompletionHandler:
|
||||
(nullable GADUConsentFormPresentCompletionHandler)formPresentedCompletionHandler;
|
||||
|
||||
/// Loads a consent form and immediately presents it from the provided viewController if
|
||||
/// UMPConsentInformation.sharedInstance.consentStatus is UMPConsentStatusRequired. Calls
|
||||
/// completionHandler after the user selects an option and the form is dismissed, or on the next run
|
||||
/// loop if no form is presented. Must be called on the main queue.
|
||||
- (void)loadAndPresentIfRequiredWithCompletionHandler:
|
||||
(nullable GADUConsentFormPresentCompletionHandler)completionHandler;
|
||||
|
||||
/// Presents a privacy options form from the provided viewController if
|
||||
/// UMPConsentInformation.sharedInstance.privacyOptionsRequirementStatus is
|
||||
/// UMPPrivacyOptionsRequirementStatusRequired. Calls completionHandler with nil error after the
|
||||
/// user selects an option and the form is dismissed, or on the next run loop with a non-nil error
|
||||
/// if no form is presented. Must be called on the main queue.
|
||||
///
|
||||
/// This method should only be called in response to a user input to request a privacy options form
|
||||
/// to be shown. The privacy options form is preloaded by the SDK automatically when a form becomes
|
||||
/// available. If no form is preloaded, the SDK will invoke the completionHandler on the next run
|
||||
/// loop, but will asynchronously retry to load one.
|
||||
- (void)presentPrivacyOptionsFormWithCompletionHandler:
|
||||
(nullable GADUConsentFormPresentCompletionHandler)completionHandler;
|
||||
|
||||
@end
|
||||
@ -0,0 +1,44 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9e47b9918cc5874a811b8f4d9dfe5d0
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,175 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import "GADUConsentForm.h"
|
||||
#import <UserMessagingPlatform/UMPConsentForm.h>
|
||||
|
||||
#import "GADUConsentInformation.h"
|
||||
#import "GADUDispatch.h"
|
||||
#import "GADUPluginUtil.h"
|
||||
#import "GADUUMPError.h"
|
||||
#import "UnityInterface.h"
|
||||
|
||||
@implementation GADUConsentForm {
|
||||
// Keep a reference to the error objects so references to Unity-level
|
||||
// FormError object are not released until the ConsentForm object is released.
|
||||
NSError *_lastLoadError;
|
||||
NSError *_lastPresentError;
|
||||
GADUTypeConsentFormClientRef *_consentFormClient;
|
||||
UMPConsentForm *_consentForm;
|
||||
}
|
||||
|
||||
- (nullable instancetype)initWithConsentFormClientReference:
|
||||
(GADUTypeConsentFormClientRef *)consentFormClient {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_consentFormClient = consentFormClient;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)loadFormWithCompletionHandler:
|
||||
(GADUConsentFormLoadCompletionHandler)formLoadedCompletionHandler {
|
||||
GADUDispatchAsyncSafeMainQueue(^{
|
||||
__weak GADUConsentForm *weakSelf = self;
|
||||
[UMPConsentForm loadWithCompletionHandler:^(UMPConsentForm *_Nullable consentForm,
|
||||
NSError *_Nullable error) {
|
||||
GADUConsentForm *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"Lost reference to the consent form. Please restart the application and try again.");
|
||||
return;
|
||||
}
|
||||
strongSelf->_consentForm = consentForm;
|
||||
if (formLoadedCompletionHandler) {
|
||||
strongSelf->_lastLoadError = error;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
formLoadedCompletionHandler(strongSelf->_consentFormClient,
|
||||
(__bridge GADUTypeFormErrorRef)error);
|
||||
});
|
||||
}
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)showWithCompletionHandler:
|
||||
(GADUConsentFormPresentCompletionHandler)formPresentedCompletionHandler {
|
||||
GADUDispatchAsyncSafeMainQueue(^{
|
||||
if (UMPConsentInformation.sharedInstance.formStatus != UMPFormStatusAvailable) {
|
||||
NSString *const description =
|
||||
@"Consent form unavailable. Please restart the application and try again.";
|
||||
if (formPresentedCompletionHandler) {
|
||||
NSLog(description);
|
||||
NSError *error =
|
||||
GADUUMPErrorWithCodeAndDescription(GADUUMPPluginErrorCodeUnavailable, description);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
formPresentedCompletionHandler(self->_consentFormClient,
|
||||
(__bridge GADUTypeFormErrorRef)error);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
UIViewController *unityController = [GADUPluginUtil unityGLViewController];
|
||||
if (!unityController) {
|
||||
NSString *const description = @"View controller not available.";
|
||||
NSLog(description);
|
||||
if (formPresentedCompletionHandler) {
|
||||
NSError *error = GADUUMPErrorWithCodeAndDescription(
|
||||
GADUUMPPluginErrorCodeInvalidViewController, description);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
formPresentedCompletionHandler(self->_consentFormClient,
|
||||
(__bridge GADUTypeFormErrorRef)error);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
__weak GADUConsentForm *weakSelf = self;
|
||||
[_consentForm presentFromViewController:unityController
|
||||
completionHandler:^(NSError *_Nullable error) {
|
||||
GADUConsentForm *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"Lost reference to the consent form. Please restart the "
|
||||
@"application and try again.");
|
||||
return;
|
||||
}
|
||||
if (formPresentedCompletionHandler) {
|
||||
strongSelf->_lastPresentError = error;
|
||||
formPresentedCompletionHandler(strongSelf->_consentFormClient,
|
||||
(__bridge GADUTypeFormErrorRef)error);
|
||||
}
|
||||
strongSelf->_consentForm = nil;
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)loadAndPresentIfRequiredWithCompletionHandler:
|
||||
(nullable GADUConsentFormPresentCompletionHandler)completionHandler {
|
||||
__weak GADUConsentForm *weakSelf = self;
|
||||
GADUDispatchAsyncSafeMainQueue(^{
|
||||
UIViewController *unityController = [GADUPluginUtil unityGLViewController];
|
||||
if (!unityController) {
|
||||
NSString *const description = @"View controller not available.";
|
||||
NSLog(description);
|
||||
if (completionHandler) {
|
||||
NSError *error = GADUUMPErrorWithCodeAndDescription(
|
||||
GADUUMPPluginErrorCodeInvalidViewController, description);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
completionHandler(self->_consentFormClient, (__bridge GADUTypeFormErrorRef)error);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
[UMPConsentForm
|
||||
loadAndPresentIfRequiredFromViewController:unityController
|
||||
completionHandler:^(NSError *_Nullable error) {
|
||||
GADUConsentForm *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"Lost reference to the consent form. Please restart the"
|
||||
@" application and try again.");
|
||||
return;
|
||||
}
|
||||
if (completionHandler) {
|
||||
strongSelf->_lastPresentError = error;
|
||||
completionHandler(strongSelf->_consentFormClient,
|
||||
(__bridge GADUTypeFormErrorRef)error);
|
||||
}
|
||||
strongSelf->_consentForm = nil;
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)presentPrivacyOptionsFormWithCompletionHandler:
|
||||
(nullable GADUConsentFormPresentCompletionHandler)completionHandler {
|
||||
__weak GADUConsentForm *weakSelf = self;
|
||||
GADUDispatchAsyncSafeMainQueue(^{
|
||||
UIViewController *unityController = [GADUPluginUtil unityGLViewController];
|
||||
if (!unityController) {
|
||||
NSString *const description = @"View controller not available.";
|
||||
NSLog(description);
|
||||
if (completionHandler) {
|
||||
NSError *error = GADUUMPErrorWithCodeAndDescription(
|
||||
GADUUMPPluginErrorCodeInvalidViewController, description);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
completionHandler(self->_consentFormClient, (__bridge GADUTypeFormErrorRef)error);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
[UMPConsentForm
|
||||
presentPrivacyOptionsFormFromViewController:unityController
|
||||
completionHandler:^(NSError *_Nullable error) {
|
||||
GADUConsentForm *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"Lost reference to the consent form. Please restart "
|
||||
@"the application and try again.");
|
||||
return;
|
||||
}
|
||||
if (completionHandler) {
|
||||
strongSelf->_lastPresentError = error;
|
||||
completionHandler(strongSelf->_consentFormClient,
|
||||
(__bridge GADUTypeFormErrorRef)error);
|
||||
}
|
||||
strongSelf->_consentForm = nil;
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb339d416353cad4589e262e4e8fe987
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,74 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#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;
|
||||
|
||||
/// 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;
|
||||
|
||||
/// YES if consent form is available, NO otherwise. An update should be requested using
|
||||
/// requestConsentInfoUpdateWithParameters.
|
||||
@property(readonly, nonatomic) BOOL isConsentFormAvailable;
|
||||
|
||||
/// Initializes a ConsentInformation.
|
||||
- (instancetype)initWithConsentInformationClientReference:
|
||||
(GADUTypeConsentInformationClientRef *)consentInformationClient;
|
||||
|
||||
/// Requests consent information update. Must be called before loading a consent form.
|
||||
/// @param bridgeParams UMPRequestParameters.
|
||||
- (void)requestConsentInfoUpdateWithParameters:(GADURequestParameters *)bridgeParams
|
||||
completionHandler:(GADUConsentInfoUpdateCompletionHandler)
|
||||
consentInfoUpdateCompletionHandler;
|
||||
|
||||
/// Clears all consent state from persistent storage.
|
||||
- (void)reset;
|
||||
|
||||
@end
|
||||
@ -0,0 +1,44 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0960e8c8864cc3749a1f511f915eb347
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,119 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import "GADUConsentInformation.h"
|
||||
#import <UserMessagingPlatform/UMPConsentInformation.h>
|
||||
|
||||
#import "GADUDebugSettings.h"
|
||||
#import "GADUDispatch.h"
|
||||
#import "GADUPluginUtil.h"
|
||||
#import "GADURequestParameters.h"
|
||||
#import "UnityInterface.h"
|
||||
|
||||
@implementation GADUConsentInformation {
|
||||
// Keep a reference to the error objects so references to Unity-level
|
||||
// FormError object are not released until the ConsentInformation object is released.
|
||||
NSError *_lastUpdateError;
|
||||
GADUTypeConsentInformationClientRef *_consentInformationClient;
|
||||
}
|
||||
|
||||
- (instancetype)initWithConsentInformationClientReference:
|
||||
(GADUTypeConsentInformationClientRef *)consentInformationClient {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_consentInformationClient = consentInformationClient;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (GADUConsentStatus)consentStatus {
|
||||
__block GADUConsentStatus status;
|
||||
if (NSThread.isMainThread) {
|
||||
status = (GADUConsentStatus)UMPConsentInformation.sharedInstance.consentStatus;
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
status = (GADUConsentStatus)UMPConsentInformation.sharedInstance.consentStatus;
|
||||
});
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
- (BOOL)canRequestAds {
|
||||
__block BOOL status;
|
||||
if (NSThread.isMainThread) {
|
||||
status = UMPConsentInformation.sharedInstance.canRequestAds;
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
status = UMPConsentInformation.sharedInstance.canRequestAds;
|
||||
});
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
- (GADUPrivacyOptionsRequirementStatus)privacyOptionsRequirementStatus {
|
||||
__block GADUPrivacyOptionsRequirementStatus status;
|
||||
if (NSThread.isMainThread) {
|
||||
status =
|
||||
(GADUPrivacyOptionsRequirementStatus)[UMPConsentInformation
|
||||
.sharedInstance privacyOptionsRequirementStatus];
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
status = (GADUPrivacyOptionsRequirementStatus)[UMPConsentInformation.sharedInstance
|
||||
privacyOptionsRequirementStatus];
|
||||
});
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
- (BOOL)isConsentFormAvailable {
|
||||
__block BOOL status;
|
||||
if (NSThread.isMainThread) {
|
||||
status = UMPConsentInformation.sharedInstance.formStatus == UMPFormStatusAvailable;
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
status = UMPConsentInformation.sharedInstance.formStatus == UMPFormStatusAvailable;
|
||||
});
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
- (void)requestConsentInfoUpdateWithParameters: (GADURequestParameters *)bridgeParams
|
||||
completionHandler:(GADUConsentInfoUpdateCompletionHandler)consentInfoUpdateCompletionHandler
|
||||
{
|
||||
__weak GADUConsentInformation *weakSelf = self;
|
||||
UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
|
||||
parameters.tagForUnderAgeOfConsent = bridgeParams.tagForUnderAgeOfConsent;
|
||||
if (bridgeParams.consentSyncID) {
|
||||
parameters.consentSyncID = bridgeParams.consentSyncID;
|
||||
}
|
||||
|
||||
UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init];
|
||||
debugSettings.geography = (NSInteger)bridgeParams.debugSettings.geography;
|
||||
debugSettings.testDeviceIdentifiers = bridgeParams.debugSettings.testDeviceIdentifiers;
|
||||
parameters.debugSettings = debugSettings;
|
||||
GADUDispatchAsyncSafeMainQueue(^{
|
||||
[UMPConsentInformation.sharedInstance
|
||||
requestConsentInfoUpdateWithParameters:parameters
|
||||
completionHandler:^(NSError *_Nullable error) {
|
||||
GADUConsentInformation *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"Consent information unavailable. Please restart the "
|
||||
@"application and try again.");
|
||||
return;
|
||||
}
|
||||
if (consentInfoUpdateCompletionHandler) {
|
||||
strongSelf->_lastUpdateError = error;
|
||||
consentInfoUpdateCompletionHandler(
|
||||
strongSelf->_consentInformationClient,
|
||||
(__bridge GADUTypeFormErrorRef)error);
|
||||
}
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)reset {
|
||||
GADUDispatchAsyncSafeMainQueue(^{
|
||||
[UMPConsentInformation.sharedInstance reset];
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c5f4231204e54e46a80f528de2689fe
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,24 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// Debug values for testing geography.
|
||||
typedef NS_ENUM(NSInteger, GADUDebugGeography) {
|
||||
kGADUDebugGeographyDisabled = 0, // Disable geography debugging.
|
||||
kGADUDebugGeographyEEA = 1, // Geography appears as in EEA for debug devices.
|
||||
kGADUDebugGeographyNotEEA = 2, // Geography appears as not in EEA for debug devices.
|
||||
kGADUDebugGeographyRegulatedUSState = 3, // Geography appears as in a regulated US State.
|
||||
kGADUDebugGeographyOther = 4, // Geography appears as in a region with no regulation in force.
|
||||
};
|
||||
|
||||
/// Settings that publishers can use for debugging or testing.
|
||||
@interface GADUDebugSettings : NSObject
|
||||
|
||||
/// Array of device identifier strings. Debug features are enabled for devices with these
|
||||
/// identifiers. Debug features are always enabled for simulators.
|
||||
@property(nonatomic, nullable, copy) NSArray<NSString *> *testDeviceIdentifiers;
|
||||
|
||||
/// Debug geography.
|
||||
@property(nonatomic) GADUDebugGeography geography;
|
||||
|
||||
@end
|
||||
@ -0,0 +1,44 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b6885a0238b1c341b7279a2d0430e24
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,13 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import "GADUDebugSettings.h"
|
||||
|
||||
@implementation GADUDebugSettings
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_geography = kGADUDebugGeographyDisabled;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3caa47746953a1d49b63b3447bbfd01c
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,7 @@
|
||||
// Copyright 2023 Google LLC. All Rights Reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// Runs a block on the main thread immediately if the current thread is the
|
||||
/// main thread, otherwise dispatches asynchronously to the main thread.
|
||||
void GADUDispatchAsyncSafeMainQueue(_Nonnull dispatch_block_t block);
|
||||
@ -0,0 +1,44 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37bb4f9a49e8c3e43a59db03e1d869ce
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,11 @@
|
||||
// Copyright 2023 Google LLC. All Rights Reserved.
|
||||
|
||||
#import "GADUDispatch.h"
|
||||
|
||||
void GADUDispatchAsyncSafeMainQueue(_Nonnull dispatch_block_t block) {
|
||||
if (NSThread.isMainThread) {
|
||||
block();
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), block);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 124ed6591f528894f8d613aac509a8b4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
195
Packages/com.bywaystudios.googleump/Plugins/iOS/GADUInterface.m
Normal file
195
Packages/com.bywaystudios.googleump/Plugins/iOS/GADUInterface.m
Normal file
@ -0,0 +1,195 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import "GADUConsentForm.h"
|
||||
#import "GADUConsentInformation.h"
|
||||
#import "GADUDebugSettings.h"
|
||||
#import "GADUObjectCache.h"
|
||||
#import "GADUUmpTypes.h"
|
||||
|
||||
/// Returns an NSString copying the characters from |bytes|, a C array of UTF8-encoded bytes.
|
||||
/// Returns nil if |bytes| is NULL.
|
||||
static NSString *GADUStringFromUTF8String(const char *bytes) { return bytes ? @(bytes) : nil; }
|
||||
|
||||
/// Returns a C string from a C array of UTF8-encoded bytes.
|
||||
static const char *cStringCopy(const char *string) {
|
||||
if (!string) {
|
||||
return NULL;
|
||||
}
|
||||
char *res = (char *)malloc(strlen(string) + 1);
|
||||
strcpy(res, string);
|
||||
return res;
|
||||
}
|
||||
|
||||
#pragma mark - UMP SDK
|
||||
|
||||
// FormError Methods
|
||||
|
||||
const int GADUGetFormErrorCode(GADUTypeErrorRef error) {
|
||||
NSError *internalError = (__bridge NSError *)error;
|
||||
return internalError.code;
|
||||
}
|
||||
|
||||
const char *GADUGetFormErrorMessage(GADUTypeErrorRef error) {
|
||||
NSError *internalError = (__bridge NSError *)error;
|
||||
return cStringCopy(internalError.localizedDescription.UTF8String);
|
||||
}
|
||||
|
||||
// Consent Information Methods
|
||||
|
||||
/// Create an empty GADURequestParameters
|
||||
GADUTypeRequestParametersRef GADUCreateRequestParameters() {
|
||||
GADURequestParameters *requestParameters = [[GADURequestParameters alloc] init];
|
||||
GADUObjectCache *cache = [GADUObjectCache sharedInstance];
|
||||
cache[requestParameters.gadu_referenceKey] = requestParameters;
|
||||
return (__bridge GADUTypeRequestParametersRef)requestParameters;
|
||||
}
|
||||
|
||||
/// Set GADURequestParameters tagForUnderAgeOfConsent
|
||||
void GADUSetRequestParametersTagForUnderAgeOfConsent(
|
||||
GADUTypeRequestParametersRef requestParameters, BOOL tagForUnderAgeOfConsent) {
|
||||
GADURequestParameters *internalRequestParameters =
|
||||
(__bridge GADURequestParameters *)requestParameters;
|
||||
internalRequestParameters.tagForUnderAgeOfConsent = tagForUnderAgeOfConsent;
|
||||
}
|
||||
|
||||
/// Set GADURequestParameters consentSyncID
|
||||
void GADUSetRequestParametersConsentSyncID(
|
||||
GADUTypeRequestParametersRef requestParameters, const char *consentSyncID) {
|
||||
GADURequestParameters *internalRequestParameters =
|
||||
(__bridge GADURequestParameters *)requestParameters;
|
||||
internalRequestParameters.consentSyncID = GADUStringFromUTF8String(consentSyncID);
|
||||
}
|
||||
|
||||
/// Create an empty GADUDebugSettings.
|
||||
GADUTypeDebugSettingsRef GADUCreateDebugSettings() {
|
||||
GADUDebugSettings *debugSettings = [[GADUDebugSettings alloc] init];
|
||||
GADUObjectCache *cache = [GADUObjectCache sharedInstance];
|
||||
cache[debugSettings.gadu_referenceKey] = debugSettings;
|
||||
return (__bridge GADUTypeDebugSettingsRef)debugSettings;
|
||||
}
|
||||
|
||||
/// Set GADUDebugSettings DebugGeography.
|
||||
void GADUSetDebugSettingsDebugGeography(
|
||||
GADUTypeDebugSettingsRef debugSettings, NSInteger debugGeography) {
|
||||
GADUDebugSettings *internalDebugSettings = (__bridge GADUDebugSettings *)debugSettings;
|
||||
internalDebugSettings.geography = debugGeography;
|
||||
}
|
||||
|
||||
/// Set GADUDebugSettings test device IDs.
|
||||
void GADUSetDebugSettingsTestDeviceIdentifiers(
|
||||
GADUTypeDebugSettingsRef debugSettings, const char **testDeviceIDs,
|
||||
NSInteger testDeviceIDLength) {
|
||||
GADUDebugSettings *internalDebugSettings =
|
||||
(__bridge GADUDebugSettings *)debugSettings;
|
||||
NSMutableArray *testDeviceIDsArray = [[NSMutableArray alloc] init];
|
||||
for (int i = 0; i < testDeviceIDLength; i++) {
|
||||
[testDeviceIDsArray addObject:GADUStringFromUTF8String(testDeviceIDs[i])];
|
||||
}
|
||||
[internalDebugSettings setTestDeviceIdentifiers:testDeviceIDsArray];
|
||||
}
|
||||
|
||||
/// Set GADURequestParameters tag for under age of consent.
|
||||
void GADUSetRequestParametersDebugSettings(
|
||||
GADUTypeRequestParametersRef requestParameters, GADUTypeDebugSettingsRef debugSettings) {
|
||||
GADURequestParameters *internalRequestParameters =
|
||||
(__bridge GADURequestParameters *)requestParameters;
|
||||
internalRequestParameters.debugSettings = (__bridge GADUDebugSettings *)debugSettings;
|
||||
}
|
||||
|
||||
/// Create an empty ConsentInformation object (in bridge layer).
|
||||
GADUTypeConsentInformationRef GADUCreateConsentInformation(
|
||||
GADUTypeConsentInformationClientRef *consentInformationClient) {
|
||||
GADUConsentInformation *internalConsentInfo =
|
||||
[[GADUConsentInformation alloc]
|
||||
initWithConsentInformationClientReference:consentInformationClient];
|
||||
GADUObjectCache *cache = [GADUObjectCache sharedInstance];
|
||||
cache[internalConsentInfo.gadu_referenceKey] = internalConsentInfo;
|
||||
return (__bridge GADUTypeConsentInformationRef)internalConsentInfo;
|
||||
}
|
||||
|
||||
/// Update GADUConsentInformation with the RequestParameters.
|
||||
void GADURequestConsentInfoUpdate(
|
||||
GADUTypeConsentInformationRef consentInformation,
|
||||
GADUTypeRequestParametersRef parameters,
|
||||
GADUConsentInfoUpdateCompletionHandler completionHandler) {
|
||||
GADUConsentInformation *internalConsentInfo =
|
||||
(__bridge GADUConsentInformation *)consentInformation;
|
||||
GADURequestParameters *internalRequestParameters =
|
||||
(__bridge GADURequestParameters *)parameters;
|
||||
[internalConsentInfo requestConsentInfoUpdateWithParameters:internalRequestParameters
|
||||
completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
/// Get the current consent status.
|
||||
const int GADUGetConsentStatus(GADUTypeConsentInformationRef consentInformation) {
|
||||
GADUConsentInformation *internalConsentInfo =
|
||||
(__bridge GADUConsentInformation *)consentInformation;
|
||||
return internalConsentInfo.consentStatus;
|
||||
}
|
||||
|
||||
/// Get the privacy options requirement status.
|
||||
const int GADUGetPrivacyOptionsRequirementStatus(GADUTypeConsentInformationRef consentInformation) {
|
||||
GADUConsentInformation *internalConsentInfo =
|
||||
(__bridge GADUConsentInformation *)consentInformation;
|
||||
return internalConsentInfo.privacyOptionsRequirementStatus;
|
||||
}
|
||||
|
||||
/// 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.
|
||||
const bool GADUUMPCanRequestAds(GADUTypeConsentInformationRef consentInformation) {
|
||||
GADUConsentInformation *internalConsentInfo =
|
||||
(__bridge GADUConsentInformation *)consentInformation;
|
||||
return internalConsentInfo.canRequestAds;
|
||||
}
|
||||
|
||||
/// Check if there is a GADUConsentForm available to load.
|
||||
const bool GADUIsConsentFormAvailable(GADUTypeConsentInformationRef consentInformation) {
|
||||
GADUConsentInformation *internalConsentInfo =
|
||||
(__bridge GADUConsentInformation *)consentInformation;
|
||||
return [internalConsentInfo isConsentFormAvailable];
|
||||
}
|
||||
|
||||
/// Erase / Reset GADUConsentInformation to default (unknown).
|
||||
void GADUResetConsentInformation(GADUTypeConsentInformationRef consentInformation) {
|
||||
GADUConsentInformation *internalConsentInfo =
|
||||
(__bridge GADUConsentInformation *)consentInformation;
|
||||
[internalConsentInfo reset];
|
||||
}
|
||||
|
||||
// Consent Form Methods
|
||||
|
||||
/// Create an empty GADUConsentForm object.
|
||||
GADUTypeConsentFormRef GADUCreateConsentForm(
|
||||
GADUTypeConsentFormClientRef *consentFormClient) {
|
||||
GADUConsentForm *consentForm =
|
||||
[[GADUConsentForm alloc] initWithConsentFormClientReference:consentFormClient];
|
||||
GADUObjectCache *cache = [GADUObjectCache sharedInstance];
|
||||
cache[consentForm.gadu_referenceKey] = consentForm;
|
||||
return (__bridge GADUTypeConsentFormRef)consentForm;
|
||||
}
|
||||
|
||||
/// Try loading a GADUConsentForm if required / available.
|
||||
void GADULoadConsentForm(GADUTypeConsentFormRef form,
|
||||
GADUConsentFormLoadCompletionHandler completionHandler) {
|
||||
GADUConsentForm *internalConsentForm = (__bridge GADUConsentForm *)form;
|
||||
[internalConsentForm loadFormWithCompletionHandler:completionHandler];
|
||||
}
|
||||
|
||||
/// Present the loaded GADUConsentForm.
|
||||
void GADUPresentConsentForm(GADUTypeConsentFormRef form,
|
||||
GADUConsentFormPresentCompletionHandler completionHandler) {
|
||||
GADUConsentForm *internalConsentForm = (__bridge GADUConsentForm *)form;
|
||||
[internalConsentForm showWithCompletionHandler:completionHandler];
|
||||
}
|
||||
|
||||
void GADULoadAndPresentConsentForm(GADUTypeConsentFormRef form,
|
||||
GADUConsentFormPresentCompletionHandler completionHandler) {
|
||||
GADUConsentForm *internalConsentForm = (__bridge GADUConsentForm *)form;
|
||||
[internalConsentForm loadAndPresentIfRequiredWithCompletionHandler:completionHandler];
|
||||
}
|
||||
|
||||
void GADUPresentPrivacyOptionsForm(GADUTypeConsentFormRef form,
|
||||
GADUConsentFormPresentCompletionHandler completionHandler) {
|
||||
GADUConsentForm *internalConsentForm = (__bridge GADUConsentForm *)form;
|
||||
[internalConsentForm presentPrivacyOptionsFormWithCompletionHandler:completionHandler];
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b8687221f2d1ab4ba0674e672c3fc7f
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,18 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "GADUDebugSettings.h"
|
||||
|
||||
/// Parameters sent on updates to user consent info.
|
||||
@interface GADURequestParameters : NSObject
|
||||
|
||||
/// Indicates whether the user is tagged for under age of consent.
|
||||
@property(nonatomic) BOOL tagForUnderAgeOfConsent;
|
||||
|
||||
/// Consent sync ID for the request.
|
||||
@property(nonatomic, nullable) NSString *consentSyncID;
|
||||
|
||||
/// Debug settings for the request.
|
||||
@property(nonatomic, nullable) GADUDebugSettings *debugSettings;
|
||||
|
||||
@end
|
||||
@ -0,0 +1,44 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87b69716f83b85c4f8c72f54627a0cbe
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,6 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import "GADURequestParameters.h"
|
||||
|
||||
@implementation GADURequestParameters
|
||||
@end
|
||||
@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 683bfc9e199de40439401c3bd849473e
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,20 @@
|
||||
// Copyright 2023 Google LLC. All Rights Reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// Error domain for UMP Unty SDK errors.
|
||||
extern NSErrorDomain _Nonnull const GADUUMPErrorDomain;
|
||||
|
||||
/// Returns an NSError with the plugin consent domain and provided description.
|
||||
NSError *_Nonnull GADUUMPErrorWithCodeAndDescription(NSInteger code,
|
||||
NSString *_Nonnull description);
|
||||
|
||||
/// Error codes used when loading and showing forms.
|
||||
typedef NS_ENUM(NSInteger, GADUUMPPluginErrorCode) {
|
||||
GADUUMPPluginErrorCodeInternal = 105, ///< Internal error.
|
||||
GADUUMPPluginErrorCodeAlreadyUsed = 106, ///< Form was already used.
|
||||
GADUUMPPluginErrorCodeUnavailable = 107, ///< Form is unavailable.
|
||||
GADUUMPPluginErrorCodeTimeout = 108, ///< Loading a form timed out.
|
||||
GADUUMPPluginErrorCodeInvalidViewController =
|
||||
109, ///< Form cannot be presented from the provided view controller.
|
||||
};
|
||||
@ -0,0 +1,44 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3b5d109f2e40244f8cadf6e8ea1c96e
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,13 @@
|
||||
// Copyright 2023 Google LLC. All Rights Reserved.
|
||||
|
||||
#import "GADUUMPError.h"
|
||||
|
||||
NSErrorDomain const GADUUMPErrorDomain = @"com.google.user_messaging_platform.unity_ios_bridge";
|
||||
|
||||
NSError *_Nonnull GADUUMPErrorWithCodeAndDescription(NSInteger code,
|
||||
NSString *_Nonnull description) {
|
||||
return [[NSError alloc]
|
||||
initWithDomain:GADUUMPErrorDomain
|
||||
code:code
|
||||
userInfo:@{NSLocalizedDescriptionKey : description ?: @"Internal error."}];
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0539482a031c4974c9999a7ed8ebd99f
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,42 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// Type representing a UMPConsentInformation type.
|
||||
typedef const void *GADUTypeConsentInformationRef;
|
||||
|
||||
/// Type representing a UMPConsentInformationClient type.
|
||||
typedef const void *GADUTypeConsentInformationClientRef;
|
||||
|
||||
/// Type representing a UMPRequestParameters type.
|
||||
typedef const void *GADUTypeRequestParametersRef;
|
||||
|
||||
/// Type representing a UMPDebugSettings type.
|
||||
typedef const void *GADUTypeDebugSettingsRef;
|
||||
|
||||
/// Type representing a UMPDebugGeography type.
|
||||
typedef const void *GADUTypeDebugGeographyRef;
|
||||
|
||||
/// Type representing a Error type
|
||||
typedef const void *GADUTypeErrorRef;
|
||||
|
||||
/// Type representing a FormError type.
|
||||
typedef const void *GADUTypeFormErrorRef;
|
||||
|
||||
/// Type representing a UMPConsentForm type.
|
||||
typedef const void *GADUTypeConsentFormRef;
|
||||
|
||||
/// Type representing a GADUTypeConsentFormClient type.
|
||||
typedef const void *GADUTypeConsentFormClientRef;
|
||||
|
||||
/// CompletionHandler when Consent Information is updated.
|
||||
typedef void (*GADUConsentInfoUpdateCompletionHandler)(
|
||||
GADUTypeConsentInformationClientRef *clientRef, const char *error);
|
||||
|
||||
/// CompletionHandler when Consent Form is loaded.
|
||||
typedef void (*GADUConsentFormLoadCompletionHandler)(
|
||||
GADUTypeConsentFormClientRef *clientRef, const char *error);
|
||||
|
||||
/// CompletionHandler when Consent Form is presented.
|
||||
typedef void (*GADUConsentFormPresentCompletionHandler)(
|
||||
GADUTypeConsentFormClientRef *clientRef, const char *error);
|
||||
@ -0,0 +1,44 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99802ebd549399742a9790a03ef77d06
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -43,7 +43,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (formLoadCallback != null)
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
Byway.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
{
|
||||
formLoadCallback(new ConsentForm(client), null);
|
||||
});
|
||||
@ -52,7 +52,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (formLoadCallback != null)
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
Byway.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
{
|
||||
formLoadCallback(null, error);
|
||||
});
|
||||
@ -70,7 +70,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (onDismissed != null)
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
Byway.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
{
|
||||
onDismissed(error);
|
||||
});
|
||||
@ -90,7 +90,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (onDismissed != null)
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
Byway.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
{
|
||||
onDismissed(error);
|
||||
});
|
||||
@ -110,7 +110,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (onDismissed != null)
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
Byway.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
{
|
||||
onDismissed(error);
|
||||
});
|
||||
@ -31,7 +31,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (_clientFactory == null)
|
||||
{
|
||||
_clientFactory = Utils.GetClientFactory();
|
||||
_clientFactory = Byway.Ump.Utils.GetClientFactory();
|
||||
}
|
||||
return _clientFactory;
|
||||
}
|
||||
@ -83,7 +83,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (consentInfoUpdateCallback != null)
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
Byway.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
{
|
||||
consentInfoUpdateCallback(null);
|
||||
});
|
||||
@ -92,7 +92,7 @@ namespace GoogleMobileAds.Ump.Api
|
||||
{
|
||||
if (consentInfoUpdateCallback != null)
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
Byway.Ump.BywayUmpEventExecutor.RaiseAction(() =>
|
||||
{
|
||||
consentInfoUpdateCallback(error);
|
||||
});
|
||||
@ -4,7 +4,7 @@
|
||||
"references": [
|
||||
"GoogleMobileAds.Ump.Core",
|
||||
"GoogleMobileAds.Ump.Common",
|
||||
"Byway.GoogleMobileAds.Ump"
|
||||
"Byway.Ump.Event"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
@ -4,7 +4,7 @@
|
||||
"references": [
|
||||
"GoogleMobileAds.Ump.Api",
|
||||
"GoogleMobileAds.Ump.Core",
|
||||
"Byway.GoogleMobileAds.Ump"
|
||||
"Byway.Ump.Event"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@ -17,7 +17,7 @@ public class BywayUmp
|
||||
// [START request_consent]
|
||||
public static void Initialize()
|
||||
{
|
||||
Byway.GoogleMobileAds.Ump.BywayUmpEventExecutor.Initialize();
|
||||
Byway.Ump.BywayUmpEventExecutor.Initialize();
|
||||
|
||||
// Create a ConsentRequestParameters object.
|
||||
ConsentRequestParameters requestParameters = new ConsentRequestParameters();
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "GoogleMobileAds.Ump.Android",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GoogleMobileAds.Ump.Core",
|
||||
"GoogleMobileAds.Ump.Common"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Android",
|
||||
"Editor"
|
||||
"Android"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
@ -16,4 +16,4 @@
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user