-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make use of
snap_name
in server replies (#1872)
Follow-up to ubuntu/app-center-ratings#153 Uses the `snap_name` field added to `Rating` and `Vote` server-side, which eliminates the need to resolve `snap_id`s into `snap_name`s in the app-center. Since this needs a regeneration of the protobuf files, I've also removed the `listMyVotes` methods following ubuntu/app-center-ratings#151. UDENG-5628
- Loading branch information
Showing
45 changed files
with
515 additions
and
1,599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
199 changes: 0 additions & 199 deletions
199
packages/app_center/lib/ratings/rated_category_model.g.dart
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,8 @@ | ||
import 'package:app_center/snapd/snapd_cache.dart'; | ||
import 'package:app_center/snapd/snapd_watcher.dart'; | ||
import 'package:collection/collection.dart'; | ||
import 'package:snapd/snapd.dart'; | ||
|
||
class SnapdService extends SnapdClient with SnapdCache, SnapdWatcher { | ||
Future<void> waitChange(String changeId) => | ||
watchChange(changeId).firstWhere((change) => change.ready); | ||
|
||
Future<Snap?> findById(String snapId) async { | ||
final queryParams = { | ||
'series': '16', | ||
'remote': 'true', | ||
'snap-id': snapId, | ||
}; | ||
Map<String, dynamic> result; | ||
try { | ||
result = await getAssertions( | ||
assertion: 'snap-declaration', | ||
params: queryParams, | ||
); | ||
} on Exception catch (_) { | ||
return null; | ||
} | ||
|
||
if (result.isEmpty) { | ||
return null; | ||
} | ||
final declaration = SnapDeclaration.fromJson(result); | ||
final findResult = await find(name: declaration.snapName); | ||
return findResult | ||
.singleWhereOrNull((element) => element.id == declaration.snapId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.