mirror of
https://github.com/status-im/react-native.git
synced 2025-01-24 16:29:01 +00:00
ca791dfe6f
Summary: No longer check for the `ASIdentifierManager` class. Since we only target iOS 7.0 and up, this is unnecessary. Instead, we should check for whether the `advertisingIdentifier` is non-nil. If it is, we send it; otherwise we send an error.
36 lines
1.1 KiB
Objective-C
36 lines
1.1 KiB
Objective-C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#import <AdSupport/ASIdentifierManager.h>
|
|
|
|
#import "RCTAdSupport.h"
|
|
|
|
@implementation RCTAdSupport
|
|
|
|
RCT_EXPORT_MODULE()
|
|
|
|
RCT_EXPORT_METHOD(getAdvertisingId:(RCTResponseSenderBlock)callback
|
|
withErrorCallback:(RCTResponseSenderBlock)errorCallback)
|
|
{
|
|
NSUUID *advertisingIdentifier = [ASIdentifierManager sharedManager].advertisingIdentifier;
|
|
if (advertisingIdentifier) {
|
|
callback(@[advertisingIdentifier.UUIDString]);
|
|
} else {
|
|
errorCallback(@[@"as_identifier_unavailable"]);
|
|
}
|
|
}
|
|
|
|
RCT_EXPORT_METHOD(getAdvertisingTrackingEnabled:(RCTResponseSenderBlock)callback
|
|
withErrorCallback:(__unused RCTResponseSenderBlock)errorCallback)
|
|
{
|
|
callback(@[@([ASIdentifierManager sharedManager].advertisingTrackingEnabled)]);
|
|
}
|
|
|
|
@end
|