fix(analytics): use Android ID and persist UUID fallbacks (#1624)

This commit is contained in:
Levi authored and GitHub committed 2026-10-28 22:33:13 +08:00
1 parent be0fb05edd
commit e0951de270
9 files changed
+61 -29

No files matched your search

@@ -81,7 +81,7 @@ void main() {
..createHistory = ['https://example.com/file.zip']
..runAsMenubarApp = true
..analyticsEnabled = false
..analyticsClientId = 'client-id';
..deviceId = 'client-id';
final decoded = DownloaderConfig.fromJson(config.toJson()).extra;
expect(decoded.windowState.isMaximized, isTrue);
@@ -91,7 +91,22 @@ void main() {
expect(decoded.createHistory, ['https://example.com/file.zip']);
expect(decoded.runAsMenubarApp, isTrue);
expect(decoded.analyticsEnabled, isFalse);
expect(decoded.analyticsClientId, 'client-id');
expect(decoded.deviceId, 'client-id');
});
test('legacy analytics client IDs are ignored without migration', () {
final config = ExtraConfig.fromJson({'analyticsClientId': 'AP3A.241105.008'});
expect(config.deviceId, isEmpty);
expect(config.toJson(), isNot(contains('analyticsClientId')));
});
test('analytics fallback ID uses only its dedicated config field', () {
final config = ExtraConfig.fromJson({'analyticsClientId': 'AP3A.241105.008', 'deviceId': 'stored-fallback'});
expect(config.deviceId, 'stored-fallback');
expect(config.toJson()['deviceId'], 'stored-fallback');
expect(config.toJson(), isNot(contains('analyticsClientId')));
});
test('categories and the auto-categorize switch round-trip through the config', () {