Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: switch artwork in playlist #1712

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/screen/playlists/view_playlist/view_playlist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:autonomy_flutter/screen/detail/preview/canvas_device_bloc.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/postcard_detail_page.dart';
import 'package:autonomy_flutter/screen/playlists/view_playlist/view_playlist_bloc.dart';
import 'package:autonomy_flutter/screen/playlists/view_playlist/view_playlist_state.dart';
import 'package:autonomy_flutter/service/canvas_client_service_v2.dart';
import 'package:autonomy_flutter/service/configuration_service.dart';
import 'package:autonomy_flutter/service/navigation_service.dart';
import 'package:autonomy_flutter/service/playlist_service.dart';
Expand Down Expand Up @@ -69,6 +70,7 @@ class _ViewPlaylistScreenState extends State<ViewPlaylistScreen> {
late CanvasDeviceBloc _canvasDeviceBloc;
late SortOrder _sortOrder;
late bool editable;
final _canvasClientServiceV2 = injector<CanvasClientServiceV2>();

List<SortOrder> _getAvailableOrders() {
switch (widget.payload.collectionType) {
Expand Down Expand Up @@ -483,6 +485,15 @@ class _ViewPlaylistScreenState extends State<ViewPlaylistScreen> {
});
}

Future<bool> _moveToArtwork(CompactedAssetToken compactedAssetToken) {
final controllingDevice = _canvasDeviceBloc.state.controllingDevice;
if (controllingDevice != null) {
return _canvasClientServiceV2.moveToArtwork(controllingDevice,
artworkId: compactedAssetToken.id);
}
return Future.value(false);
}

Widget _assetsWidget(
BuildContext context,
List<CompactedAssetToken> tokens, {
Expand Down Expand Up @@ -534,6 +545,9 @@ class _ViewPlaylistScreenState extends State<ViewPlaylistScreen> {
.where((e) => e.pending != true || e.hasMetadata)
.toList()
.indexOf(asset);

unawaited(_moveToArtwork(asset));

final payload = asset.isPostcard
? PostcardDetailPagePayload(
accountIdentities,
Expand Down
12 changes: 12 additions & 0 deletions lib/service/canvas_client_service_v2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,18 @@ class CanvasClientServiceV2 {
return response.ok;
}

Future<bool> moveToArtwork(CanvasDevice device,
{String? startTime, String? artworkId}) async {
final stub = _getStub(device);
final artwork = PlayArtworkV2(token: CastAssetToken(id: artworkId!));
ppupha marked this conversation as resolved.
Show resolved Hide resolved
ppupha marked this conversation as resolved.
Show resolved Hide resolved
final request = MoveToArtworkRequest(artwork: artwork);
final reply = await _retryWrapper(() => stub.moveToArtwork(
request,
options: _callOptions,
));
return reply.ok;
}

Future<bool> previousArtwork(CanvasDevice device, {String? startTime}) async {
final stub = _getStub(device);
final request = PreviousArtwortRequest();
Expand Down
44 changes: 22 additions & 22 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: b595a46c2946569c75040f44f78733b86a8b5df4
resolved-ref: b595a46c2946569c75040f44f78733b86a8b5df4
ref: dfa84af4d0c25196cc256628e20e4bfe1c9a04b5
resolved-ref: dfa84af4d0c25196cc256628e20e4bfe1c9a04b5
url: "https://github.com/autonomy-system/feralfile-app-tv-proto-communication"
source: git
version: "0.0.1"
Expand Down Expand Up @@ -1709,26 +1709,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.1"
libauk_dart:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1862,10 +1862,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.12.0"
mime:
dependency: "direct main"
description:
Expand All @@ -1886,10 +1886,10 @@ packages:
dependency: "direct dev"
description:
name: mockito
sha256: "7d5b53bcd556c1bc7ffbe4e4d5a19c3e112b7e925e9e172dd7c6ad0630812616"
sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917"
url: "https://pub.dev"
source: hosted
version: "5.4.2"
version: "5.4.4"
model_viewer_plus:
dependency: transitive
description:
Expand Down Expand Up @@ -2725,26 +2725,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f
sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073"
url: "https://pub.dev"
source: hosted
version: "1.24.9"
version: "1.25.2"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
test_core:
dependency: transitive
description:
name: test_core
sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
url: "https://pub.dev"
source: hosted
version: "0.5.9"
version: "0.6.0"
tezart:
dependency: "direct main"
description:
Expand Down Expand Up @@ -2998,10 +2998,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "13.0.0"
version: "14.2.1"
wakelock_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -3163,5 +3163,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.3 <4.0.0"
flutter: ">=3.16.6"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ dependencies:
feralfile_app_tv_proto:
git:
url: https://github.com/autonomy-system/feralfile-app-tv-proto-communication
ref: b595a46c2946569c75040f44f78733b86a8b5df4
ref: dfa84af4d0c25196cc256628e20e4bfe1c9a04b5
flutter_branch_sdk: ^7.0.2
flutter_rating_bar: ^4.0.1
multi_value_listenable_builder: ^0.0.2
Expand Down
Loading