Skip to content

Commit

Permalink
update report install logic
Browse files Browse the repository at this point in the history
Summary: Since v4 supports decrementing CV, we need to make sure we only report install for the first time app launch

Reviewed By: KylinChang

Differential Revision: D48086213

fbshipit-source-id: 3db468baa1590227ba5ed5fc1a51a0dfb5628ba5
  • Loading branch information
Xin Wu authored and facebook-github-bot committed Aug 7, 2023
1 parent d3dd58f commit 96dd709
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
13 changes: 8 additions & 5 deletions FBSDKCoreKit/FBSDKCoreKit/AppEvents/FBSDKAppEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,14 @@ - (void)fetchServerConfiguration:(FBSDKCodeBlock)callback
if ([self.settings isSKAdNetworkReportEnabled]) {
[self.featureChecker checkFeature:FBSDKFeatureSKAdNetwork completionBlock:^(BOOL SKAdNetworkEnabled) {
if (SKAdNetworkEnabled) {
if (@available(iOS 15.4, *)) {
[SKAdNetwork updatePostbackConversionValue:0 completionHandler:nil];
} else {
// Fallback on earlier versions
[SKAdNetwork registerAppForAdNetworkAttribution];
if (![self.primaryDataStore fb_boolForKey:@"com.facebook.sdk:FBSDKIsSkAdNetworkInstallReported"]) {
if (@available(iOS 15.4, *)) {
[SKAdNetwork updatePostbackConversionValue:0 completionHandler:nil];
} else {
// Fallback on earlier versions
[SKAdNetwork registerAppForAdNetworkAttribution];
}
[self.primaryDataStore fb_setBool:true forKey:@"com.facebook.sdk:FBSDKIsSkAdNetworkInstallReported"];
}
[self.featureChecker checkFeature:FBSDKFeatureSKAdNetworkConversionValue completionBlock:^(BOOL SKAdNetworkConversionValueEnabled) {
if (SKAdNetworkConversionValueEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ - (void)enable
if (@available(iOS 14.0, *)) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
if (@available(iOS 15.4, *)) {
[SKAdNetwork updatePostbackConversionValue:0 completionHandler:nil];
} else {
// Fallback on earlier versions
[SKAdNetwork registerAppForAdNetworkAttribution];
}
[self _loadReportData];
self.completionBlocks = [NSMutableArray new];
self.serialQueue = dispatch_queue_create(serialQueueLabel, DISPATCH_QUEUE_SERIAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
*/

final class TestDataStore: DataPersisting {
func fb_setBool(_ value: Bool, forKey defaultName: String) {}
func fb_setInteger(_ value: Int, forKey defaultName: String) {}
func fb_setObject(_ value: Any, forKey defaultName: String) {}
func fb_data(forKey defaultName: String) -> Data? { nil }
func fb_integer(forKey defaultName: String) -> Int { Int.min }
func fb_string(forKey defaultName: String) -> String? { nil }
func fb_object(forKey defaultName: String) -> Any? { nil }
func fb_bool(forKey defaultName: String) -> Bool { false }
func fb_removeObject(forKey defaultName: String) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ - (nullable NSData *)fb_dataForKey:(NSString *)key
return [self dataForKey:key];
}

- (BOOL)fb_boolForKey:(NSString *)key
{
return [self boolForKey:key];
}

- (void)fb_setBool:(BOOL)value
forKey:(NSString *)key
{
[self setBool:value forKey:key];
}


- (void)fb_removeObjectForKey:(NSString *)key
{
[self removeObjectForKey:key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ NS_SWIFT_NAME(DataPersisting)
- (NSInteger)fb_integerForKey:(NSString *)key;
- (nullable NSString *)fb_stringForKey:(NSString *)key;
- (nullable id)fb_objectForKey:(NSString *)key;
- (BOOL)fb_boolForKey:(NSString *)key;
- (void)fb_setBool:(BOOL)value forKey:(NSString *)key;
- (void)fb_removeObjectForKey:(NSString *)key;

@end
Expand Down

0 comments on commit 96dd709

Please sign in to comment.