This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,18 @@ class UsageModel
32
32
33
33
private Usage currentUsage ;
34
34
35
- public Usage GetCurrentUsage ( )
35
+ public Usage GetCurrentUsage ( string appVersion , string unityVersion )
36
36
{
37
+ Guard . ArgumentNotNullOrWhiteSpace ( appVersion , "appVersion" ) ;
38
+ Guard . ArgumentNotNullOrWhiteSpace ( unityVersion , "unityVersion" ) ;
39
+
37
40
var date = DateTime . UtcNow . Date ;
38
41
if ( currentUsage == null )
39
42
{
40
- currentUsage = Reports . FirstOrDefault ( usage => usage . Date == date ) ;
43
+ currentUsage = Reports
44
+ . FirstOrDefault ( usage => usage . Date == date
45
+ && usage . AppVersion == appVersion
46
+ && usage . UnityVersion == unityVersion ) ;
41
47
}
42
48
43
49
if ( currentUsage ? . Date == date )
@@ -48,7 +54,12 @@ public Usage GetCurrentUsage()
48
54
}
49
55
else
50
56
{
51
- currentUsage = new Usage { Date = date , Guid = Guid } ;
57
+ currentUsage = new Usage {
58
+ Date = date ,
59
+ Guid = Guid ,
60
+ AppVersion = appVersion ,
61
+ UnityVersion = unityVersion ,
62
+ } ;
52
63
Reports . Add ( currentUsage ) ;
53
64
}
54
65
Original file line number Diff line number Diff line change @@ -154,10 +154,8 @@ private async Task SendUsage()
154
154
155
155
private Usage GetCurrentUsage ( UsageStore usageStore )
156
156
{
157
- var usage = usageStore . Model . GetCurrentUsage ( ) ;
158
- usage . UnityVersion = unityVersion ;
157
+ var usage = usageStore . Model . GetCurrentUsage ( AppConfiguration . AssemblyName . Version . ToString ( ) , unityVersion ) ;
159
158
usage . Lang = CultureInfo . InstalledUICulture . IetfLanguageTag ;
160
- usage . AppVersion = AppConfiguration . AssemblyName . Version . ToString ( ) ;
161
159
usage . CurrentLang = CultureInfo . CurrentCulture . IetfLanguageTag ;
162
160
return usage ;
163
161
}
You can’t perform that action at this time.
0 commit comments