Skip to content

Commit 05c3ed6

Browse files
committed
use new sessionid format
1 parent cf88a39 commit 05c3ed6

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.3
2+
3+
- use new session id format
4+
15
## 0.2.2
26

37
- Fixed issue with settings importer

PACKAGE.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.aptabase",
33
"displayName": "Aptabase",
4-
"version": "0.2.2",
4+
"version": "0.2.3",
55
"unity": "2018.4",
66
"description": "Analytics for Apps. Privacy-First. Simple. Real-Time.",
77
"keywords": ["analytics"],

Runtime/Aptabase.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public static class Aptabase
1717
private static string _baseURL;
1818

1919
private static readonly TimeSpan _sessionTimeout = TimeSpan.FromMinutes(60);
20+
private static readonly Random _random = new();
2021
private static readonly Dictionary<string, string> _hosts = new()
2122
{
2223
{ "US", "https://us.aptabase.com" },
@@ -165,6 +166,11 @@ private static int GetFlushInterval()
165166
return _env.isDebug ? 2000 : 60000;
166167
}
167168

168-
private static string NewSessionId() => Guid.NewGuid().ToString().ToLower();
169+
public static string NewSessionId()
170+
{
171+
var epochInSeconds = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
172+
var random = _random.NextInt64(0, 99999999);
173+
return (epochInSeconds * 100000000 + random).ToString();
174+
}
169175
}
170176
}

Runtime/Version.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace AptabaseSDK
44
{
55
public static class Version
66
{
7-
private const string SDK_VERSION = "Aptabase.Unity@0.2.2";
7+
private const string SDK_VERSION = "Aptabase.Unity@0.2.3";
88

99
public static VersionInfo GetVersionInfo(Settings settings)
1010
{

0 commit comments

Comments
 (0)