浏览代码

fix(mobile) invalid creation time on local asset show 1970 as year (#1391)

Alex 2 年之前
父节点
当前提交
171ba84741
共有 2 个文件被更改,包括 46 次插入2 次删除
  1. 10 2
      mobile/lib/shared/models/asset.dart
  2. 36 0
      mobile/pubspec.lock

+ 10 - 2
mobile/lib/shared/models/asset.dart

@@ -32,8 +32,16 @@ class Asset {
   double? get longitude =>
   double? get longitude =>
       isLocal ? local!.longitude : remote!.exifInfo?.longitude?.toDouble();
       isLocal ? local!.longitude : remote!.exifInfo?.longitude?.toDouble();
 
 
-  DateTime get createdAt =>
-      isLocal ? local!.createDateTime : DateTime.parse(remote!.createdAt);
+  DateTime get createdAt {
+    if (isLocal) {
+      if (local!.createDateTime.year == 1970) {
+        return local!.modifiedDateTime;
+      }
+      return local!.createDateTime;
+    } else {
+      return DateTime.parse(remote!.createdAt);
+    }
+  }
 
 
   bool get isImage => isLocal
   bool get isImage => isLocal
       ? local!.type == AssetType.image
       ? local!.type == AssetType.image

+ 36 - 0
mobile/pubspec.lock

@@ -307,6 +307,11 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "0.4.0"
     version: "0.4.0"
+  flutter_driver:
+    dependency: transitive
+    description: flutter
+    source: sdk
+    version: "0.0.0"
   flutter_hooks:
   flutter_hooks:
     dependency: "direct main"
     dependency: "direct main"
     description:
     description:
@@ -392,6 +397,11 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "2.1.2"
     version: "2.1.2"
+  fuchsia_remote_debug_protocol:
+    dependency: transitive
+    description: flutter
+    source: sdk
+    version: "0.0.0"
   glob:
   glob:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -504,6 +514,11 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "2.5.0"
     version: "2.5.0"
+  integration_test:
+    dependency: "direct dev"
+    description: flutter
+    source: sdk
+    version: "0.0.0"
   intl:
   intl:
     dependency: "direct main"
     dependency: "direct main"
     description:
     description:
@@ -1041,6 +1056,13 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "1.1.1"
     version: "1.1.1"
+  sync_http:
+    dependency: transitive
+    description:
+      name: sync_http
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.3.1"
   synchronized:
   synchronized:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -1202,6 +1224,13 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "2.0.10"
     version: "2.0.10"
+  vm_service:
+    dependency: transitive
+    description:
+      name: vm_service
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "9.0.0"
   wakelock:
   wakelock:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -1251,6 +1280,13 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "2.2.0"
     version: "2.2.0"
+  webdriver:
+    dependency: transitive
+    description:
+      name: webdriver
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "3.0.0"
   win32:
   win32:
     dependency: transitive
     dependency: transitive
     description:
     description: