Skip to content

Commit f5a4480

Browse files
committed
Merge pull request #306 from BranchMetrics/spotlight
add canonical url and ID to spotlight indexing
2 parents 9eab55b + 69b7fc8 commit f5a4480

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Branch-SDK/Branch-SDK/BranchUniversalObject.m

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,18 @@ - (void)listOnSpotlightWithCallback:(callbackWithUrl)callback {
227227
publiclyIndexable = YES;
228228
}
229229

230+
NSMutableDictionary *metadataAndProperties = [self.metadata mutableCopy];
231+
if (self.canonicalIdentifier) {
232+
metadataAndProperties[BRANCH_LINK_DATA_KEY_CANONICAL_IDENTIFIER] = self.canonicalIdentifier;
233+
}
234+
if (self.canonicalUrl) {
235+
metadataAndProperties[BRANCH_LINK_DATA_KEY_CANONICAL_URL] = self.canonicalUrl;
236+
}
237+
230238
[[Branch getInstance] createDiscoverableContentWithTitle:self.title
231239
description:self.contentDescription
232240
thumbnailUrl:[NSURL URLWithString:self.imageUrl]
233-
linkParams:self.metadata.copy
241+
linkParams:metadataAndProperties.copy
234242
type:self.type
235243
publiclyIndexable:publiclyIndexable
236244
keywords:[NSSet setWithArray:self.keywords]
@@ -249,10 +257,18 @@ - (void)listOnSpotlightWithIdentifierCallback:(callbackWithUrlAndSpotlightIdenti
249257
publiclyIndexable = YES;
250258
}
251259

260+
NSMutableDictionary *metadataAndProperties = [self.metadata mutableCopy];
261+
if (self.canonicalIdentifier) {
262+
metadataAndProperties[BRANCH_LINK_DATA_KEY_CANONICAL_IDENTIFIER] = self.canonicalIdentifier;
263+
}
264+
if (self.canonicalUrl) {
265+
metadataAndProperties[BRANCH_LINK_DATA_KEY_CANONICAL_URL] = self.canonicalUrl;
266+
}
267+
252268
[[Branch getInstance] createDiscoverableContentWithTitle:self.title
253269
description:self.contentDescription
254270
thumbnailUrl:[NSURL URLWithString:self.imageUrl]
255-
linkParams:self.metadata.copy
271+
linkParams:metadataAndProperties.copy
256272
type:self.type
257273
publiclyIndexable:publiclyIndexable
258274
keywords:[NSSet setWithArray:self.keywords]

0 commit comments

Comments
 (0)