Skip to content

Commit

Permalink
Merge pull request #1288 from BranchMetrics/SDK-1982-SKAN-Simplificat…
Browse files Browse the repository at this point in the history
…ion-DB-Updates

SDK-1982 SKAN Simplification DB Updates
  • Loading branch information
NidhiDixit09 authored Sep 14, 2023
2 parents 35cf189 + da55b9e commit ef3b826
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pre-release-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
uses: actions/checkout@v3
- name: Install pod, build project and run tests
run: |
echo "branch=${{ github.ref }}" >> $GITHUB_OUTPUT
./scripts/getSimulator
DESTINATION="platform=iOS Simulator,name=$(cat ./iphoneSim),OS=latest"
cd SDKIntegrationTestApps/iOSReleaseTest-Cocoapods/
Expand Down
2 changes: 1 addition & 1 deletion BranchSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "BranchSDK"
s.version = "2.2.0"
s.version = "2.2.1"
s.summary = "Create an HTTP URL for any piece of content in your app"
s.description = <<-DESC
- Want the highest possible conversions on your sharing feature?
Expand Down
12 changes: 6 additions & 6 deletions BranchSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.BranchSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -2024,7 +2024,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.BranchSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -2226,7 +2226,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.BranchSDK;
PRODUCT_MODULE_NAME = BranchSDK;
PRODUCT_NAME = BranchSDK;
Expand Down Expand Up @@ -2261,7 +2261,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.BranchSDK;
PRODUCT_MODULE_NAME = BranchSDK;
PRODUCT_NAME = BranchSDK;
Expand Down Expand Up @@ -2293,7 +2293,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.BranchSDK;
PRODUCT_NAME = BranchSDK;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -2323,7 +2323,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.BranchSDK;
PRODUCT_NAME = BranchSDK;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion BranchSDK/BNCConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
NSString * const BNC_API_BASE_URL = @"https://api2.branch.io";
NSString * const BNC_API_VERSION = @"v1";
NSString * const BNC_LINK_URL = @"https://bnc.lt";
NSString * const BNC_SDK_VERSION = @"2.2.0";
NSString * const BNC_SDK_VERSION = @"2.2.1";
NSString * const BNC_CDN_URL = @"https://cdn.branch.io";

NSString* const BNC_API_URL = @"https://api3.branch.io";
Expand Down
6 changes: 5 additions & 1 deletion BranchSDK/BNCSKAdNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ - (BOOL) shouldCallPostbackForDataResponse:(NSDictionary *) dataResponseDictiona
}

int highestConversionValue = (int)[BNCPreferenceHelper sharedInstance].highestConversionValueSent;
if( conversionValue.intValue <= highestConversionValue ){
if((currentWindow == BranchSkanWindowFirst) && (conversionValue.intValue <= highestConversionValue)){
BOOL ascendingOnly = [self getAscendingOnlyFromDataResponse:dataResponseDictionary];
if (!ascendingOnly)
shouldCallUpdatePostback = YES;
} else if ((currentWindow != BranchSkanWindowFirst) && (highestConversionValue != 0) && (conversionValue.intValue <= highestConversionValue)){ // In second and third windows, conversion values can be negative, so added extra check here.
BOOL ascendingOnly = [self getAscendingOnlyFromDataResponse:dataResponseDictionary];
if (!ascendingOnly)
shouldCallUpdatePostback = YES;
Expand Down
5 changes: 5 additions & 0 deletions BranchSDK/BranchConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,8 @@ extern NSString * const BRANCH_REQUEST_KEY_APPLE_ATTRIBUTION_TOKEN;

extern NSString * const BRANCH_CRASHLYTICS_SDK_VERSION_KEY;
extern NSString * const BRANCH_CRASHLYTICS_LOW_MEMORY_KEY;

extern NSString * const BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX;
extern NSString * const BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_0;
extern NSString * const BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_1;
extern NSString * const BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_2;
5 changes: 5 additions & 0 deletions BranchSDK/BranchConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,8 @@
NSString * const BRANCH_CRASHLYTICS_LOW_MEMORY_KEY = @"io.branch.device.lowmemory";

NSString * const BRANCH_REQUEST_KEY_EXTERNAL_INTENT_URI = @"external_intent_uri";

NSString * const BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX = @"skan_postback_index";
NSString * const BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_0 = @"postback-sequence-index-0";
NSString * const BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_1 = @"postback-sequence-index-1";
NSString * const BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_2 = @"postback-sequence-index-2";
13 changes: 13 additions & 0 deletions BranchSDK/BranchEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,19 @@ - (NSDictionary *)buildEventDictionary {
eventDictionary[BRANCH_REQUEST_KEY_PARTNER_PARAMETERS] = partnerParameters;
}

if (@available(iOS 16.1, macCatalyst 16.1, *)){
if ([BNCPreferenceHelper sharedInstance].invokeRegisterApp) {
int currentWindow = [[BNCSKAdNetwork sharedInstance] calculateSKANWindowForTime:[NSDate date]];
if (currentWindow == BranchSkanWindowFirst){
eventDictionary[BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX] = BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_0;
} else if (currentWindow == BranchSkanWindowSecond) {
eventDictionary[BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX] = BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_1;
} else if (currentWindow == BranchSkanWindowThird) {
eventDictionary[BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX] = BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_2;
}
}
}

return eventDictionary;
}

Expand Down
13 changes: 13 additions & 0 deletions BranchSDK/BranchOpenRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ - (void)makeRequest:(BNCServerInterface *)serverInterface key:(NSString *)key ca
params[@"first_install_time"] = BNCWireFormatFromDate(application.firstInstallDate);
params[@"update"] = [self.class appUpdateState];

if (@available(iOS 16.1, macCatalyst 16.1, *)){
if ([BNCPreferenceHelper sharedInstance].invokeRegisterApp) {
int currentWindow = [[BNCSKAdNetwork sharedInstance] calculateSKANWindowForTime:[NSDate date]];
if (currentWindow == BranchSkanWindowFirst){
params[BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX] = BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_0;
} else if (currentWindow == BranchSkanWindowSecond) {
params[BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX] = BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_1;
} else if (currentWindow == BranchSkanWindowThird) {
params[BRANCH_REQUEST_KEY_SKAN_POSTBACK_INDEX] = BRANCH_REQUEST_KEY_VALUE_POSTBACK_SEQUENCE_INDEX_2;
}
}
}

[serverInterface postRequest:params
url:[preferenceHelper
getAPIURL:BRANCH_REQUEST_ENDPOINT_OPEN]
Expand Down
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Branch iOS SDK Change Log

V.2.2.1

Branch iOS SDK 2.2.1 adds parameter for current SKAN 4.0 Window in /v1/open and /v2/event requests.

- SDK-1982 - SKAN Simplification DB updates

V.2.2.0

Branch iOS SDK 2.2.0 adds the ability to include developer ID in installs and a new method to change the Branch API base URL.
Expand Down
2 changes: 1 addition & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Options:
USAGE
}

version=2.2.0
version=2.2.1
prev_version="$version"

if (( $# == 0 )); then
Expand Down

0 comments on commit ef3b826

Please sign in to comment.