@@ -257,71 +257,6 @@ extension RawEvent {
257257 }
258258 }
259259
260- /**
261- Set values to be received for this event in cloud-mode, specific to an integration key path.
262- Note that when specifying nil as the value, the key will be removed for the given key path. Additionally,
263- any keys that don't already exist in the path will be created as necessary.
264-
265- Example:
266- ```
267- trackEvent.setIntegrationValue(42, forKeyPath: "Amplitude.threshold")
268- ```
269-
270- - Parameters:
271- - value: The value to set for the given keyPath, or nil.
272- - forKeyPath: The key path for the value.
273- */
274- public mutating func setIntegrationValue( _ value: Any ? , forKeyPath keyPath: String ) {
275- guard let existing = integrations? . dictionaryValue else {
276- // this shouldn't happen, might oughta log it.
277- Analytics . segmentLog ( message: " Unable to get what should be a valid list of integrations from event. " , kind: . error)
278- return
279- }
280-
281- var new = existing
282- new [ keyPath: KeyPath ( keyPath) ] = value
283- do {
284- integrations = try JSON ( new)
285- } catch {
286- // this shouldn't happen, log it.
287- Analytics . segmentLog ( message: " Unable to convert list of integrations to JSON. \( error) " , kind: . error)
288- }
289- }
290-
291- /**
292- Set context values for this event.
293- Note that when specifying nil as the value, the key will be removed for the given key path. Additionally,
294- any keys that don't already exist in the path will be created as necessary.
295-
296- Example:
297- ```
298- // the metadata key will be created as a dictionary, and the key nickname will be set.
299- trackEvent.setContextValue("Brandon's device", forKeyPath: "device.metadata.nickname")
300-
301- // the metadata key will be removed entirely.
302- trackEvent.setContextValue(nil, forKeyPath: "device.metadata")
303- ```
304-
305- - Parameters:
306- - value: The value to set for the given keyPath, or nil.
307- - forKeyPath: The key path for the value.
308- */
309- public mutating func setContextValue( _ value: Any ? , forKeyPath keyPath: String ) {
310- guard let existing = context? . dictionaryValue else {
311- // this shouldn't happen, might oughta log it.
312- Analytics . segmentLog ( message: " Unable to get what should be a valid context from event. " , kind: . error)
313- return
314- }
315-
316- var new = existing
317- new [ keyPath: KeyPath ( keyPath) ] = value
318- do {
319- context = try JSON ( new)
320- } catch {
321- // this shouldn't happen, log it.
322- Analytics . segmentLog ( message: " Unable to convert context to JSON. \( error) " , kind: . error)
323- }
324- }
325260}
326261
327262
0 commit comments