-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use
snap_name
in Vote
and Rating
- Loading branch information
Showing
14 changed files
with
60 additions
and
44 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
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
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
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.