Преглед изворни кода

Add support for updating mvi values for existing files

Neeraj Gupta пре 2 година
родитељ
комит
7a19ce9c1b
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      lib/ui/viewer/file/zoomable_live_image.dart

+ 10 - 0
lib/ui/viewer/file/zoomable_live_image.dart

@@ -5,10 +5,13 @@ import 'package:chewie/chewie.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:logging/logging.dart';
 import 'package:motion_photos/motion_photos.dart';
 import 'package:motion_photos/motion_photos.dart';
+import "package:photos/core/configuration.dart";
 import 'package:photos/core/constants.dart';
 import 'package:photos/core/constants.dart';
 import "package:photos/generated/l10n.dart";
 import "package:photos/generated/l10n.dart";
 import 'package:photos/models/file.dart';
 import 'package:photos/models/file.dart';
 import "package:photos/models/file_type.dart";
 import "package:photos/models/file_type.dart";
+import "package:photos/models/magic_metadata.dart";
+import "package:photos/services/file_magic_service.dart";
 import 'package:photos/ui/viewer/file/zoomable_image.dart';
 import 'package:photos/ui/viewer/file/zoomable_image.dart';
 import 'package:photos/utils/file_util.dart';
 import 'package:photos/utils/file_util.dart';
 import 'package:photos/utils/toast_util.dart';
 import 'package:photos/utils/toast_util.dart';
@@ -177,6 +180,13 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
       final motionPhoto = MotionPhotos(imageFile.path);
       final motionPhoto = MotionPhotos(imageFile.path);
       final index = motionPhoto.getMotionVideoIndex();
       final index = motionPhoto.getMotionVideoIndex();
       if (index != null) {
       if (index != null) {
+        if (widget.file.pubMagicMetadata?.mvi == null &&
+            (widget.file.ownerID ?? 0) == Configuration.instance.getUserID()!) {
+          FileMagicService.instance.updatePublicMagicMetadata(
+            [widget.file],
+            {pubMotionVideoIndex: index.start},
+          ).ignore();
+        }
         return motionPhoto.getMotionVideoFile(
         return motionPhoto.getMotionVideoFile(
           index: index,
           index: index,
         );
         );