mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-07 09:00:47 +00:00
fix(analytics): use Android ID and persist UUID fallbacks (#1624)
This commit is contained in:
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', () {
|
||||
|
||||
Reference in new issue
Block a user