Skip to content

Commit

Permalink
[MOB-2702-patch] Analytics fix (#19)
Browse files Browse the repository at this point in the history
* analytics auth state fix

* bump podspec
  • Loading branch information
airlacodes committed Jul 2, 2020
1 parent 948443d commit 17a022f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion KarhooSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "KarhooSDK"
s.version = "1.1.2"
s.version = "1.1.3"
s.summary = "Karhoo Network SDK"
s.homepage = "https://developer.karhoo.com/docs/build-apps-using-sdks"
s.license = 'BSD 2-Clause'
Expand Down
7 changes: 4 additions & 3 deletions KarhooSDK/Service/Analytics/AnalyticsPayloadBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ final class DefaultAnalyticsPayloadBuilder {
}

private func addUserPayload() {
let authState = Karhoo.configuration.authenticationMethod()
payload[AnalyticsConstants.EventNames.guestMode.description] = authState.isGuest()
addUserLocationPayload(location: locationProvider.getLastKnownLocation())

guard let user = KarhooUserService().getCurrentUser() else {
return
}

let authState = Karhoo.configuration.authenticationMethod()
payload[AnalyticsConstants.EventNames.guestMode.description] = authState.isGuest()
payload[AnalyticsConstants.Keys.userId.description] = user.userId
addUserLocationPayload(location: locationProvider.getLastKnownLocation())
}

private func addUserLocationPayload(location: CLLocation?) {
Expand Down

0 comments on commit 17a022f

Please sign in to comment.