mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 14:15:14 +00:00
Share plugin: Honor received last modified metadata
This commit is contained in:
@@ -32,6 +32,9 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -162,6 +165,18 @@ public class CompositeReceiveFileJob extends BackgroundJob<Device, Void> {
|
||||
publishFile(fileDocument, 0);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (currentNetworkPacket.has("lastModified")) {
|
||||
try {
|
||||
long lastModified = currentNetworkPacket.getLong("lastModified");
|
||||
Files.setLastModifiedTime(Paths.get(fileDocument.getUri().getPath()), FileTime.fromMillis(lastModified));
|
||||
} catch (Exception e) {
|
||||
Log.e("SharePlugin", "Can't set date on file");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean listIsEmpty;
|
||||
|
||||
synchronized (lock) {
|
||||
|
Reference in New Issue
Block a user