@@ -1680,61 +1680,50 @@ - (NSString *)generateShortUrl:(NSArray *)tags
16801680 andParams : (NSDictionary *)params
16811681 ignoreUAString : (NSString *)ignoreUAString
16821682 forceLinkCreation : (BOOL )forceLinkCreation {
1683-
1683+
16841684 NSString *shortURL = nil ;
1685-
1685+
16861686 BNCLinkData *linkData =
1687- [self prepareLinkDataFor: tags
1688- andAlias: alias
1689- andType: type
1690- andMatchDuration: duration
1691- andChannel: channel
1692- andFeature: feature
1693- andStage: stage
1694- andCampaign: campaign
1695- andParams: params
1696- ignoreUAString: ignoreUAString];
1697-
1687+ [self prepareLinkDataFor: tags
1688+ andAlias: alias
1689+ andType: type
1690+ andMatchDuration: duration
1691+ andChannel: channel
1692+ andFeature: feature
1693+ andStage: stage
1694+ andCampaign: campaign
1695+ andParams: params
1696+ ignoreUAString: ignoreUAString];
1697+
16981698 // If an ignore UA string is present, we always get a new url.
16991699 // Otherwise, if we've already seen this request, use the cached version.
17001700 if (!ignoreUAString && [self .linkCache objectForKey: linkData]) {
17011701 shortURL = [self .linkCache objectForKey: linkData];
17021702 } else {
17031703 BranchShortUrlSyncRequest *req =
1704- [[BranchShortUrlSyncRequest alloc ]
1705- initWithTags: tags
1706- alias: alias
1707- type: type
1708- matchDuration: duration
1709- channel: channel
1710- feature: feature
1711- stage: stage
1712- campaign: campaign
1713- params: params
1714- linkData: linkData
1715- linkCache: self .linkCache];
1716-
1717- if (self.initializationStatus == BNCInitStatusInitialized) {
1718- BNCLogDebug (@" Creating a custom URL synchronously." );
1719- BNCServerResponse *serverResponse = [req makeRequest: self .serverInterface key: self .class.branchKey];
1720- shortURL = [req processResponse: serverResponse];
1721-
1722- // cache the link
1723- if (shortURL) {
1724- [self .linkCache setObject: shortURL forKey: linkData];
1725- }
1726- } else {
1727- if (forceLinkCreation) {
1728- if (self.class .branchKey ) {
1729- return [BranchShortUrlSyncRequest createLinkFromBranchKey: self .class.branchKey
1730- tags: tags alias: alias type: type matchDuration: duration
1731- channel: channel feature: feature stage: stage params: params];
1732- }
1733- }
1734- BNCLogError (@" Making a Branch request before init has succeeded!" );
1704+ [[BranchShortUrlSyncRequest alloc ]
1705+ initWithTags: tags
1706+ alias: alias
1707+ type: type
1708+ matchDuration: duration
1709+ channel: channel
1710+ feature: feature
1711+ stage: stage
1712+ campaign: campaign
1713+ params: params
1714+ linkData: linkData
1715+ linkCache: self .linkCache];
1716+
1717+ BNCLogDebug (@" Creating a custom URL synchronously." );
1718+ BNCServerResponse *serverResponse = [req makeRequest: self .serverInterface key: self .class.branchKey];
1719+ shortURL = [req processResponse: serverResponse];
1720+
1721+ // cache the link
1722+ if (shortURL) {
1723+ [self .linkCache setObject: shortURL forKey: linkData];
17351724 }
17361725 }
1737-
1726+
17381727 return shortURL;
17391728}
17401729
0 commit comments