@@ -1729,61 +1729,50 @@ - (NSString *)generateShortUrl:(NSArray *)tags
17291729 andParams : (NSDictionary *)params
17301730 ignoreUAString : (NSString *)ignoreUAString
17311731 forceLinkCreation : (BOOL )forceLinkCreation {
1732-
1732+
17331733 NSString *shortURL = nil ;
1734-
1734+
17351735 BNCLinkData *linkData =
1736- [self prepareLinkDataFor: tags
1737- andAlias: alias
1738- andType: type
1739- andMatchDuration: duration
1740- andChannel: channel
1741- andFeature: feature
1742- andStage: stage
1743- andCampaign: campaign
1744- andParams: params
1745- ignoreUAString: ignoreUAString];
1746-
1736+ [self prepareLinkDataFor: tags
1737+ andAlias: alias
1738+ andType: type
1739+ andMatchDuration: duration
1740+ andChannel: channel
1741+ andFeature: feature
1742+ andStage: stage
1743+ andCampaign: campaign
1744+ andParams: params
1745+ ignoreUAString: ignoreUAString];
1746+
17471747 // If an ignore UA string is present, we always get a new url.
17481748 // Otherwise, if we've already seen this request, use the cached version.
17491749 if (!ignoreUAString && [self .linkCache objectForKey: linkData]) {
17501750 shortURL = [self .linkCache objectForKey: linkData];
17511751 } else {
17521752 BranchShortUrlSyncRequest *req =
1753- [[BranchShortUrlSyncRequest alloc ]
1754- initWithTags: tags
1755- alias: alias
1756- type: type
1757- matchDuration: duration
1758- channel: channel
1759- feature: feature
1760- stage: stage
1761- campaign: campaign
1762- params: params
1763- linkData: linkData
1764- linkCache: self .linkCache];
1765-
1766- if (self.initializationStatus == BNCInitStatusInitialized) {
1767- BNCLogDebug (@" Creating a custom URL synchronously." );
1768- BNCServerResponse *serverResponse = [req makeRequest: self .serverInterface key: self .class.branchKey];
1769- shortURL = [req processResponse: serverResponse];
1770-
1771- // cache the link
1772- if (shortURL) {
1773- [self .linkCache setObject: shortURL forKey: linkData];
1774- }
1775- } else {
1776- if (forceLinkCreation) {
1777- if (self.class .branchKey ) {
1778- return [BranchShortUrlSyncRequest createLinkFromBranchKey: self .class.branchKey
1779- tags: tags alias: alias type: type matchDuration: duration
1780- channel: channel feature: feature stage: stage params: params];
1781- }
1782- }
1783- BNCLogError (@" Making a Branch request before init has succeeded!" );
1753+ [[BranchShortUrlSyncRequest alloc ]
1754+ initWithTags: tags
1755+ alias: alias
1756+ type: type
1757+ matchDuration: duration
1758+ channel: channel
1759+ feature: feature
1760+ stage: stage
1761+ campaign: campaign
1762+ params: params
1763+ linkData: linkData
1764+ linkCache: self .linkCache];
1765+
1766+ BNCLogDebug (@" Creating a custom URL synchronously." );
1767+ BNCServerResponse *serverResponse = [req makeRequest: self .serverInterface key: self .class.branchKey];
1768+ shortURL = [req processResponse: serverResponse];
1769+
1770+ // cache the link
1771+ if (shortURL) {
1772+ [self .linkCache setObject: shortURL forKey: linkData];
17841773 }
17851774 }
1786-
1775+
17871776 return shortURL;
17881777}
17891778
0 commit comments