2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-03-10 19:09:35 +00:00
|
|
|
|
|
|
|
#import "RCTAdSupport.h"
|
|
|
|
|
|
|
|
@implementation RCTAdSupport
|
|
|
|
|
2015-04-08 12:42:43 +00:00
|
|
|
RCT_EXPORT_MODULE()
|
|
|
|
|
2015-04-08 15:52:48 +00:00
|
|
|
RCT_EXPORT_METHOD(getAdvertisingId:(RCTResponseSenderBlock)callback
|
|
|
|
withErrorCallback:(RCTResponseSenderBlock)errorCallback)
|
2015-03-10 19:09:35 +00:00
|
|
|
{
|
|
|
|
if ([ASIdentifierManager class]) {
|
|
|
|
callback(@[[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]);
|
|
|
|
} else {
|
|
|
|
return errorCallback(@[@"as_identifier_unavailable"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-08 15:52:48 +00:00
|
|
|
RCT_EXPORT_METHOD(getAdvertisingTrackingEnabled:(RCTResponseSenderBlock)callback
|
|
|
|
withErrorCallback:(RCTResponseSenderBlock)errorCallback)
|
2015-03-12 22:57:48 +00:00
|
|
|
{
|
|
|
|
if ([ASIdentifierManager class]) {
|
2015-04-08 15:52:48 +00:00
|
|
|
BOOL hasTracking = [[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled];
|
2015-03-12 22:57:48 +00:00
|
|
|
callback(@[@(hasTracking)]);
|
|
|
|
} else {
|
|
|
|
return errorCallback(@[@"as_identifier_unavailable"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-10 19:09:35 +00:00
|
|
|
@end
|