Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copy from UserDefaults method #384

Merged
merged 2 commits into from
May 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
* **improvement** Fixed build warnings
* **bugfix** Fixed issue where only `UserDefaults.standard` is used despite specified another instance. [#384](https://github.com/matomo-org/matomo-sdk-ios/pull/384)

## 7.4.0
* **improvement** Escaped more symbols when sending events to the API. [#313](https://github.com/matomo-org/matomo-sdk-ios/issues/313)
Expand Down
18 changes: 9 additions & 9 deletions MatomoTracker/MatomoUserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ internal struct MatomoUserDefaults {

extension MatomoUserDefaults {
public mutating func copy(from userDefaults: UserDefaults) {
totalNumberOfVisits = UserDefaults.standard.integer(forKey: MatomoUserDefaults.Key.totalNumberOfVisits)
firstVisit = UserDefaults.standard.object(forKey: MatomoUserDefaults.Key.firstVistsTimestamp) as? Date
previousVisit = UserDefaults.standard.object(forKey: MatomoUserDefaults.Key.previousVistsTimestamp) as? Date
currentVisit = UserDefaults.standard.object(forKey: MatomoUserDefaults.Key.currentVisitTimestamp) as? Date
optOut = UserDefaults.standard.bool(forKey: MatomoUserDefaults.Key.optOut)
clientId = UserDefaults.standard.string(forKey: MatomoUserDefaults.Key.clientID)
forcedVisitorId = UserDefaults.standard.string(forKey: MatomoUserDefaults.Key.forcedVisitorID)
visitorUserId = UserDefaults.standard.string(forKey: MatomoUserDefaults.Key.visitorUserID)
lastOrder = UserDefaults.standard.object(forKey: MatomoUserDefaults.Key.lastOrder) as? Date
totalNumberOfVisits = userDefaults.integer(forKey: MatomoUserDefaults.Key.totalNumberOfVisits)
firstVisit = userDefaults.object(forKey: MatomoUserDefaults.Key.firstVistsTimestamp) as? Date
previousVisit = userDefaults.object(forKey: MatomoUserDefaults.Key.previousVistsTimestamp) as? Date
currentVisit = userDefaults.object(forKey: MatomoUserDefaults.Key.currentVisitTimestamp) as? Date
optOut = userDefaults.bool(forKey: MatomoUserDefaults.Key.optOut)
clientId = userDefaults.string(forKey: MatomoUserDefaults.Key.clientID)
forcedVisitorId = userDefaults.string(forKey: MatomoUserDefaults.Key.forcedVisitorID)
visitorUserId = userDefaults.string(forKey: MatomoUserDefaults.Key.visitorUserID)
lastOrder = userDefaults.object(forKey: MatomoUserDefaults.Key.lastOrder) as? Date
}
}

Expand Down