Skip to content

Commit a2579be

Browse files
authored
Merge pull request #859 from Iterable/evan/MOB-10126
[MOB-10126] adds clearVisitorEventsAndUserData method
2 parents d6a5071 + b51513a commit a2579be

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

swift-sdk/Internal/AnonymousUserManager.swift

+8-14
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,6 @@ public class AnonymousUserManager: AnonymousUserManagerProtocol {
158158
}
159159
}
160160
}
161-
162-
// commenting this code for now as we need to execute this code in some other place so after all events are suceesfully synced as this code will execute too promptly right after the above loop so we simply clear all the data where or not the APIs were successful or not
163-
/* let notSynchedData = filterEvents(excludingTimestamps: successfulSyncedData)
164-
if let _ = notSynchedData {
165-
localStorage.anonymousUserEvents = notSynchedData
166-
} else {
167-
localStorage.anonymousUserEvents = nil
168-
} */
169-
170-
localStorage.anonymousUserEvents = nil
171-
localStorage.anonymousSessions = nil
172161
}
173162

174163
if var userUpdate = localStorage.anonymousUserUpdate {
@@ -177,10 +166,15 @@ public class AnonymousUserManager: AnonymousUserManagerProtocol {
177166
}
178167

179168
IterableAPI.implementation?.updateUser(userUpdate, mergeNestedObjects: false)
180-
181-
localStorage.anonymousUserUpdate = nil
182169
}
183-
170+
171+
clearVisitorEventsAndUserData()
172+
}
173+
174+
public func clearVisitorEventsAndUserData() {
175+
localStorage.anonymousUserEvents = nil
176+
localStorage.anonymousSessions = nil
177+
localStorage.anonymousUserUpdate = nil
184178
}
185179

186180
// Checks if criterias are being met and returns criteriaId if it matches the criteria.

0 commit comments

Comments
 (0)