Skip to content

Commit

Permalink
Remove DeveloperPacakgeData
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexios80 committed Nov 19, 2023
1 parent cf7a0a4 commit 018d6ba
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 209 deletions.
2 changes: 1 addition & 1 deletion pub_stats/lib/controller/data_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class DataController {

loadingDeveloperPackageStats.value = true;
try {
final packages = await _database.getDeveloperPackages();
final packages = await _pub.getDeveloperPackages();
final packageStatsFutures = packages.map(_fetchStats);
final packageStats = await Future.wait(packageStatsFutures);

Expand Down
9 changes: 0 additions & 9 deletions pub_stats/lib/repo/database_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ class DatabaseRepo {
}).toList();
}

Future<Set<String>> getDeveloperPackages() async {
final event = await _database.child('developer').once();
final value = event.snapshot.value as Map<String, dynamic>;
final data =
value.map((k, v) => MapEntry(k, DeveloperPackageData.fromJson(v)));
data.removeWhere((k, v) => v.isUnlisted || v.isDiscontinued);
return data.keys.toSet();
}

Future<List<AlertConfig>> getAlertConfigs(String uid) async {
final event = await _database.child('alerts').child(uid).once();
final value = event.snapshot.value as List?;
Expand Down
8 changes: 8 additions & 0 deletions pub_stats/lib/repo/pub_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ class PubRepo {
final results = await _pub.search(PackageTag.publisher(name));
return results.packages.isNotEmpty;
}

Future<Set<String>> getDeveloperPackages() async {
return {
...await _pub.fetchAllPackages(PackageTag.publisher('rexios.dev')),
...await _pub.fetchAllPackages(PackageTag.publisher('iodesignteam.com')),
...await _pub.fetchAllPackages(PackageTag.publisher('vrchat.community')),
}.map((e) => e.package).toSet();
}
}
1 change: 0 additions & 1 deletion pub_stats_core/lib/pub_stats_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ library pub_stats_core;

// model
export 'src/model/alert_config.dart';
export 'src/model/developer_package_data.dart';
export 'src/model/global_stats.dart';
export 'src/model/mini_package_score.dart';
export 'src/model/package_data.dart';
Expand Down
164 changes: 0 additions & 164 deletions pub_stats_core/lib/src/model/developer_package_data.dart

This file was deleted.

33 changes: 0 additions & 33 deletions pub_stats_core/lib/src/model/developer_package_data.g.dart

This file was deleted.

6 changes: 5 additions & 1 deletion pub_stats_core/lib/src/model/mini_package_score.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:pub_api_client/pub_api_client.dart';

part 'mini_package_score.g.dart';

/// Optimize the storage used by [PackageScore]s
@JsonSerializable()
class MiniPackageScore {
class MiniPackageScore extends Equatable {
/// Like count
@JsonKey(name: 'l')
final int likeCount;
Expand All @@ -28,4 +29,7 @@ class MiniPackageScore {
_$MiniPackageScoreFromJson(json);

Map<String, dynamic> toJson() => _$MiniPackageScoreToJson(this);

@override
List<Object?> get props => [likeCount, popularityScore];
}

0 comments on commit 018d6ba

Please sign in to comment.