Skip to content

Commit 47f9b98

Browse files
asutermoandrew
andauthored
Auto grab event tokens from Solitaire and ETW (#483)
Co-authored-by: andrew <andrew@forming.ai>
1 parent 56d64ce commit 47f9b98

12 files changed

Lines changed: 1056 additions & 49 deletions

File tree

XAU/Models/XAUSettings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ public class XAUSettings
1111
public bool UseAcrylic { get; set; }
1212
public bool PrivacyMode { get; set; }
1313
public bool OAuthLogin { get; set; }
14+
public bool AutoGrabEventsToken { get; set; }
15+
public string? CachedEventsToken { get; set; }
16+
public DateTime? EventsTokenObtainedAt { get; set; }
17+
public string? EventsUserHash { get; set; }
1418
}

XAU/Networking/XboxRestApi.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,16 @@ public async Task UnlockEventBasedAchievement(string eventsToken, StringContent
351351

352352
SetDefaultEventBasedHeaders();
353353
_eventBasedClient.DefaultRequestHeaders.Add("tickets", $"\"1\"=\"{eventsToken}\"");
354-
await _eventBasedClient.PostAsync(BasicXboxAPIUris.TelemetryUrl, requestBody);
354+
var response = await _eventBasedClient.PostAsync(BasicXboxAPIUris.TelemetryUrl, requestBody);
355+
var responseBody = await response.Content.ReadAsStringAsync();
356+
HomeViewModel.EventsLog($"POST {BasicXboxAPIUris.TelemetryUrl} => {(int)response.StatusCode} {response.StatusCode}");
357+
HomeViewModel.EventsLog($"Response: {responseBody}");
358+
if (!response.IsSuccessStatusCode)
359+
{
360+
HomeViewModel.EventsLog("Response headers:");
361+
foreach (var header in response.Headers)
362+
HomeViewModel.EventsLog($" {header.Key}: {string.Join(", ", header.Value)}");
363+
}
355364
}
356365

357366
public async Task<GamePassProducts?> GetTitleIdsFromGamePass(string prodId)

XAU/Util/Constants/Constants.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ public struct InterpolatedXboxAPIUrls
8080
public struct ProcessNames
8181
{
8282
public const string XboxPcApp = @"XboxPcApp";
83+
public const string Solitaire = @"Solitaire";
84+
}
85+
86+
public struct AppLaunchUris
87+
{
88+
public const string Solitaire = @"shell:appsFolder\Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe!App";
8389
}
8490

8591
public struct EventsUrls

0 commit comments

Comments
 (0)