chore(mobile): update casting to new asset viewer (#19994)
* update casting to new asset viewer * handle websocket --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -141,13 +141,15 @@ class AppLifeCycleNotifier extends StateNotifier<AppLifeCycleEnum> {
|
||||
state = AppLifeCycleEnum.paused;
|
||||
_wasPaused = true;
|
||||
|
||||
if (!Store.isBetaTimelineEnabled &&
|
||||
_ref.read(authProvider).isAuthenticated) {
|
||||
// Do not cancel backup if manual upload is in progress
|
||||
if (_ref.read(backupProvider.notifier).backupProgress !=
|
||||
BackUpProgressEnum.manualInProgress) {
|
||||
_ref.read(backupProvider.notifier).cancelBackup();
|
||||
if (_ref.read(authProvider).isAuthenticated) {
|
||||
if (!Store.isBetaTimelineEnabled) {
|
||||
// Do not cancel backup if manual upload is in progress
|
||||
if (_ref.read(backupProvider.notifier).backupProgress !=
|
||||
BackUpProgressEnum.manualInProgress) {
|
||||
_ref.read(backupProvider.notifier).cancelBackup();
|
||||
}
|
||||
}
|
||||
|
||||
_ref.read(websocketProvider.notifier).disconnect();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/entities/asset.entity.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/entities/asset.entity.dart' as old_asset_entity;
|
||||
import 'package:immich_mobile/models/cast/cast_manager_state.dart';
|
||||
import 'package:immich_mobile/services/gcast.service.dart';
|
||||
|
||||
@@ -50,10 +51,29 @@ class CastNotifier extends StateNotifier<CastManagerState> {
|
||||
state = state.copyWith(castState: castState);
|
||||
}
|
||||
|
||||
void loadMedia(Asset asset, bool reload) {
|
||||
void loadMedia(RemoteAsset asset, bool reload) {
|
||||
_gCastService.loadMedia(asset, reload);
|
||||
}
|
||||
|
||||
// TODO: remove this when we migrate to new timeline
|
||||
void loadMediaOld(old_asset_entity.Asset asset, bool reload) {
|
||||
final remoteAsset = RemoteAsset(
|
||||
id: asset.remoteId.toString(),
|
||||
name: asset.name,
|
||||
ownerId: asset.ownerId.toString(),
|
||||
checksum: asset.checksum,
|
||||
type: asset.type == old_asset_entity.AssetType.image
|
||||
? AssetType.image
|
||||
: asset.type == old_asset_entity.AssetType.video
|
||||
? AssetType.video
|
||||
: AssetType.other,
|
||||
createdAt: asset.fileCreatedAt,
|
||||
updatedAt: asset.updatedAt,
|
||||
);
|
||||
|
||||
_gCastService.loadMedia(remoteAsset, reload);
|
||||
}
|
||||
|
||||
Future<void> connect(CastDestinationType type, dynamic device) async {
|
||||
switch (type) {
|
||||
case CastDestinationType.googleCast:
|
||||
|
||||
Reference in New Issue
Block a user