Browse Source

user last modification date for auto upload, e.g. take an image on 31.01.17 and upload it via autoupload on 10.02.17 it will be uploaded to Camera/2017/01

tobiasKaminsky 8 years ago
parent
commit
5e4ad8ab14

+ 1 - 2
src/com/owncloud/android/services/FileAlterationMagicListener.java

@@ -88,11 +88,10 @@ public class FileAlterationMagicListener implements FileAlterationListener {
                 @Override
                 public void run() {
                     PersistableBundle bundle = new PersistableBundle();
-                    // TODO extract
                     bundle.putString(SyncedFolderJobService.LOCAL_PATH, file.getAbsolutePath());
                     bundle.putString(SyncedFolderJobService.REMOTE_PATH, FileStorageUtils.getInstantUploadFilePath(
                             syncedFolder.getRemotePath(), file.getName(),
-                            new Date().getTime(),
+                            file.lastModified(),
                             syncedFolder.getSubfolderByDate()));
                     bundle.putString(SyncedFolderJobService.ACCOUNT, syncedFolder.getAccount());
                     bundle.putInt(SyncedFolderJobService.UPLOAD_BEHAVIOUR, syncedFolder.getUploadAction());

+ 4 - 4
src/com/owncloud/android/utils/FileStorageUtils.java

@@ -122,7 +122,7 @@ public class FileStorageUtils {
      * string is returned
      *
      * @param date: date in microseconds since 1st January 1970
-     * @return
+     * @return string: yyyy/mm/
      */
     private static String getSubpathFromDate(long date) {
         if (date == 0) {
@@ -140,11 +140,11 @@ public class FileStorageUtils {
     }
 
     /**
-     * Returns the InstantUploadFilePath on the owncloud instance
+     * Returns the InstantUploadFilePath on the nextcloud instance
      *
-     * @param fileName
+     * @param fileName complete file name
      * @param dateTaken: Time in milliseconds since 1970 when the picture was taken.
-     * @return
+     * @return instantUpload path, eg. /Camera/2017/01/fileName
      */
     public static String getInstantUploadFilePath(String remotePath, String fileName, long dateTaken,
                                                   Boolean subfolderByDate) {