Skip to content

Commit

Permalink
resolve property 'config' in closure requires explicit use of 'self' …
Browse files Browse the repository at this point in the history
…to make capture semantics explicit
  • Loading branch information
megha-iterable committed Oct 23, 2024
1 parent 1d44bbb commit 3c81c88
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions swift-sdk/Internal/InternalIterableAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
self._email = email
self._userId = nil

self.onLogin(authToken) { [weak self]() -> Void in
guard let self = self else {
self.onLogin(authToken) { [weak self] in
guard let config = self?.config else {
return
}
let merge = identityResolution?.mergeOnAnonymousToKnown ?? config.identityResolution.mergeOnAnonymousToKnown
let replay = identityResolution?.replayOnVisitorToKnown ?? config.identityResolution.replayOnVisitorToKnown
if config.enableAnonTracking, let email = email {
attemptAndProcessMerge(
self?.attemptAndProcessMerge(
merge: merge ?? true,
replay: replay ?? true,
destinationUser: email,
isEmail: true,
failureHandler: failureHandler
)
self.localStorage.userIdAnnon = nil
self?.localStorage.userIdAnnon = nil
}
}

Expand All @@ -188,15 +188,15 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
self._email = nil
self._userId = userId

self.onLogin(authToken) { [weak self]() -> Void in
guard let self = self else {
self.onLogin(authToken) { [weak self] in
guard let config = self?.config else {
return
}
if config.enableAnonTracking {
if let userId = userId, userId != localStorage.userIdAnnon {
if let userId = userId, userId != (self?.localStorage.userIdAnnon ?? "") {
let merge = identityResolution?.mergeOnAnonymousToKnown ?? config.identityResolution.mergeOnAnonymousToKnown
let replay = identityResolution?.replayOnVisitorToKnown ?? config.identityResolution.replayOnVisitorToKnown
attemptAndProcessMerge(
self?.attemptAndProcessMerge(
merge: merge ?? true,
replay: replay ?? true,
destinationUser: userId,
Expand All @@ -206,7 +206,7 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
}

if !isAnon {
localStorage.userIdAnnon = nil
self?.localStorage.userIdAnnon = nil
}
}
}
Expand Down

0 comments on commit 3c81c88

Please sign in to comment.