Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix favorite icon disappearing on shared files

ashilknad78d9fd6247
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart
index 378559985a..c447112a1f 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart
@@ -3,7 +3,6 @@ import "dart:async";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
import "package:logging/logging.dart";
-import "package:photos/core/configuration.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/file/file.dart";
import "package:photos/services/favorites_service.dart";
@@ -67,14 +66,19 @@ class _FavoriteWidgetState extends State<FavoriteWidget> {
}
void _handleRiveLoaded(rive.RiveLoaded loaded) {
- if (!mounted || _hasSetInitialState) return;
+ if (!mounted) return;
_stateMachine = loaded.controller.stateMachine;
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if (!mounted || _stateMachine == null || _isFavorite == null) return;
- _setInitialAnimationState();
- });
+ if (_hasSetInitialState) {
+ // Re-sync animation state after rebuild (e.g., when loading state clears)
+ _updateAnimationState();
+ } else {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (!mounted || _stateMachine == null || _isFavorite == null) return;
+ _setInitialAnimationState();
+ });
+ }
}
void _setInitialAnimationState() {
@@ -98,8 +102,7 @@ class _FavoriteWidgetState extends State<FavoriteWidget> {
final bool currentlyFavorite = _isFavorite!;
final bool newFavoriteState = !currentlyFavorite;
- if (widget.file.uploadedFileID == null ||
- widget.file.ownerID != Configuration.instance.getUserID()!) {
+ if (widget.file.uploadedFileID == null) {
setState(() {
_isLoading = true;
});