2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Switch desugaring lib to desugar_jdk_libs_nio

Enables desugaring of the `Files` class, which is otherwise only available on API 26+.
This commit is contained in:
Isira Seneviratne
2023-04-04 22:27:56 +00:00
committed by Albert Vaca Cintora
parent d4378ffe3e
commit 7efb1f81b5
2 changed files with 9 additions and 11 deletions

View File

@@ -136,7 +136,7 @@ ext {
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.2'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.3'
implementation 'androidx.media:media:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
@@ -155,7 +155,7 @@ dependencies {
implementation 'com.jaredrummler:android-device-names:1.1.9' //To get a human-friendly device name
implementation 'org.apache.sshd:sshd-core:0.14.0'
implementation 'org.apache.mina:mina-core:2.0.19' //For some reason, makes sshd-core:0.14.0 work without NIO, which isn't available until Android 8 (api 26)
implementation 'org.apache.mina:mina-core:2.0.19' // Desugar does not backport AsynchronousSocketChannel.
//implementation('com.github.bright:slf4android:0.1.6') { transitive = true } // For org.apache.sshd debugging
implementation 'org.bouncycastle:bcpkix-jdk15on:1.70' //For SSL certificate generation

View File

@@ -165,15 +165,13 @@ 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();
}
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();
}
}