Skip to content

Commit 45d3981

Browse files
Release 1.0.7
👔 Update anonymous users tracking logic. 📝 Update ReadMe file. 📝 Update config docs. ⬆️ Bump SDK version.
1 parent ef62985 commit 45d3981

File tree

7 files changed

+32
-14
lines changed

7 files changed

+32
-14
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Userpilot iOS SDK
22

3+
34
![version](https://img.shields.io/github/v/tag/Userpilot/ios-sdk?label=version)
45
[![Documentation](https://img.shields.io/badge/Documentation-blue.svg)](https://docs.userpilot.com/article/313-install-userpilot-on-your-ios-app)
6+
[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)
7+
[![CocoaPods compatible](https://img.shields.io/badge/CocoaPods-compatible-red.svg)](https://cocoapods.org/pods/Userpilot)
58
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/Userpilot/ios-sdk/blob/main/LICENSE)
6-
[![Swift](https://img.shields.io/badge/Swift-5.6-orange.svg)](https://swift.org)
9+
[![Platform](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FUserpilot%2Fios-sdk%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/Userpilot/ios-sdk)
10+
[![Swift version](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FUserpilot%2Fios-sdk%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/Userpilot/ios-sdk)
711

812
## Introduction
913

Sample/UserPilotSample/UserpilotSample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@
915915
"$(inherited)",
916916
"@executable_path/Frameworks",
917917
);
918-
MARKETING_VERSION = 1.0.6;
918+
MARKETING_VERSION = 1.0.7;
919919
PRODUCT_BUNDLE_IDENTIFIER = com.userpilot.sample.dev;
920920
PRODUCT_NAME = "$(TARGET_NAME)";
921921
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -950,7 +950,7 @@
950950
"$(inherited)",
951951
"@executable_path/Frameworks",
952952
);
953-
MARKETING_VERSION = 1.0.6;
953+
MARKETING_VERSION = 1.0.7;
954954
PRODUCT_BUNDLE_IDENTIFIER = com.userpilot.sample;
955955
PRODUCT_NAME = "$(TARGET_NAME)";
956956
PROVISIONING_PROFILE_SPECIFIER = "";

Sources/Userpilot/Storage/Storage.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ internal protocol DataStoring: AnyObject {
3030
/// by the application upon authentication.
3131
var userId: String { get set }
3232

33+
/// The anonymous user ID, generated by SDK.
34+
var anonymousUserId: String { get set }
35+
3336
/// The socket URL used to connect the SDK to the backend services.
3437
var user: String { get set }
3538

@@ -64,6 +67,7 @@ internal class Storage: DataStoring, BootUp {
6467
private enum Key: String {
6568
case socketURL
6669
case userId
70+
case anonymousUserId
6771
case user
6872
case temporaryUser
6973
case sessionDate
@@ -107,6 +111,16 @@ internal class Storage: DataStoring, BootUp {
107111
}
108112
}
109113

114+
/// The anonymous user ID, which generated by the SDK.
115+
internal var anonymousUserId: String {
116+
get {
117+
return read(.anonymousUserId, defaultValue: "")
118+
}
119+
set {
120+
write(.anonymousUserId, newValue: newValue)
121+
}
122+
}
123+
110124
/// The user, which contains all updated user meta data and company.
111125
internal var user: String {
112126
get {

Sources/Userpilot/Userpilot+Config.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public extension Userpilot {
2727
var logger: Logging = OSLog.disabled
2828

2929
/// Create an Userpilot SDK configuration
30-
/// - Parameter token: Userpilot Account Token,
31-
/// copied from the Environments settings page.
30+
/// - Parameter token: Userpilot Account Token, copied from the Environments settings page.
3231
@objc
3332
public init(token: String) {
3433
self.token = token
@@ -38,8 +37,6 @@ public extension Userpilot {
3837
///
3938
/// - Parameter enabled: A boolean indicating whether logging is enabled.
4039
/// - Returns: The `Configuration` object, allowing for method chaining.
41-
///
42-
/// Refer to <doc:Logging> for more details about logging functionality.
4340
@discardableResult
4441
@objc
4542
public func logging(enabled isEnabled: Bool) -> Self {

Sources/Userpilot/Userpilot.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,17 @@ extension Userpilot {
192192
}
193193

194194
/**
195-
Tracks an anonymous user session when a known user identity is unavailable.
195+
Tracks an anonymous user session.
196196

197-
This method generates a unique anonymous ID, allowing the SDK to track behavior and trigger relevant content
198-
even when the user has not explicitly signed in or identified themselves.
197+
This method generates a unique anonymous ID - cache it, allowing the SDK to track behavior and trigger
198+
relevant content even when the user has not explicitly signed in or identified themselves.
199199
*/
200200
@objc
201201
public func anonymous() {
202-
identify(userId: "\(config.token)_\(anonymousFactory())")
202+
if storage.anonymousUserId.isEmpty {
203+
storage.anonymousUserId = "\(config.token)_\(anonymousFactory())"
204+
}
205+
identify(userId: storage.anonymousUserId)
203206
}
204207

205208
/**

Sources/Userpilot/Version.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ import Foundation
1414
/// The current version of the Userpilot SDK.
1515
private let versionMajor = "1"
1616
private let versionMinor = "0"
17-
private let versionPatch = "6"
17+
private let versionPatch = "7"
1818
let userpilotVersion = "\(versionMajor).\(versionMinor).\(versionPatch)"

Userpilot.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |spec|
22

33
spec.name = "Userpilot"
44
spec.module_name = "Userpilot"
5-
spec.version = "1.0.6"
5+
spec.version = "1.0.7"
66
spec.summary = "Userpilot iOS SDK allows you to integrate Userpilot experiences into your native iOS apps"
77

88
spec.description = <<-DESC
@@ -11,7 +11,7 @@ Pod::Spec.new do |spec|
1111

1212
spec.homepage = "https://github.com/Userpilot/ios-sdk"
1313
spec.license = { :type => "MIT", :file => "LICENSE" }
14-
spec.author = { "Userpilot" => "dev@userpilot.co" }
14+
spec.author = { "Userpilot" => "dev@userpilot.com" }
1515

1616
spec.source = { :git => "https://github.com/Userpilot/ios-sdk.git", :tag => "#{spec.version}" }
1717
spec.source_files = "Sources/Userpilot/**/*.swift"

0 commit comments

Comments
 (0)