Skip to content

Commit

Permalink
Merge pull request #859 from Iterable/evan/MOB-10126
Browse files Browse the repository at this point in the history
[MOB-10126] adds clearVisitorEventsAndUserData method
  • Loading branch information
evantk91 authored Nov 6, 2024
2 parents d6a5071 + b51513a commit a2579be
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions swift-sdk/Internal/AnonymousUserManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,6 @@ public class AnonymousUserManager: AnonymousUserManagerProtocol {
}
}
}

// 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
/* let notSynchedData = filterEvents(excludingTimestamps: successfulSyncedData)
if let _ = notSynchedData {
localStorage.anonymousUserEvents = notSynchedData
} else {
localStorage.anonymousUserEvents = nil
} */

localStorage.anonymousUserEvents = nil
localStorage.anonymousSessions = nil
}

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

IterableAPI.implementation?.updateUser(userUpdate, mergeNestedObjects: false)

localStorage.anonymousUserUpdate = nil
}


clearVisitorEventsAndUserData()
}

public func clearVisitorEventsAndUserData() {
localStorage.anonymousUserEvents = nil
localStorage.anonymousSessions = nil
localStorage.anonymousUserUpdate = nil
}

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

0 comments on commit a2579be

Please sign in to comment.