Skip to content

Commit 673f0e0

Browse files
committed
chore(sdk): min version 26
Signed-off-by: alperozturk96 <alper_ozturk@proton.me> # Conflicts: # library/src/main/java/com/owncloud/android/lib/resources/files/DownloadFileRemoteOperation.kt
1 parent 60e168f commit 673f0e0

8 files changed

Lines changed: 35 additions & 61 deletions

File tree

library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ android {
143143
}
144144

145145
defaultConfig {
146-
minSdkVersion 23
146+
minSdkVersion 26
147147

148148
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
149149
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"

library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
package com.owncloud.android.lib.resources.files
99

10-
import android.os.Build
1110
import com.owncloud.android.AbstractIT
1211
import com.owncloud.android.lib.common.utils.Log_OC
1312
import com.owncloud.android.lib.resources.files.model.RemoteFile
@@ -80,24 +79,19 @@ class UploadFileRemoteOperationIT : AbstractIT() {
8079
)
8180
}
8281

83-
private fun getCreationTimestamp(file: File): Long? {
84-
return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
85-
return null
86-
} else {
87-
try {
88-
Files
89-
.readAttributes(file.toPath(), BasicFileAttributes::class.java)
90-
.creationTime()
91-
.to(TimeUnit.SECONDS)
92-
} catch (e: IOException) {
93-
Log_OC.e(
94-
UploadFileRemoteOperation::class.java.simpleName,
95-
"Failed to read creation timestamp for file: " + file.name
96-
)
97-
null
98-
}
82+
private fun getCreationTimestamp(file: File): Long? =
83+
try {
84+
Files
85+
.readAttributes(file.toPath(), BasicFileAttributes::class.java)
86+
.creationTime()
87+
.to(TimeUnit.SECONDS)
88+
} catch (e: IOException) {
89+
Log_OC.e(
90+
UploadFileRemoteOperation::class.java.simpleName,
91+
"Failed to read creation timestamp for file: " + file.name
92+
)
93+
null
9994
}
100-
}
10195

10296
companion object {
10397
const val TIME_OFFSET = 10

library/src/main/java/com/nextcloud/common/DNSCache.kt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
package com.nextcloud.common
1010

11-
import android.os.Build
1211
import androidx.annotation.VisibleForTesting
1312
import com.nextcloud.android.lib.core.Clock
1413
import com.nextcloud.android.lib.core.ClockImpl
@@ -76,17 +75,12 @@ object DNSCache {
7675
hostname: String,
7776
preferIPV4: Boolean
7877
) {
79-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
80-
cache.compute(hostname) { _, old ->
81-
val addresses =
82-
old?.addresses?.let {
83-
sortAddresses(it, preferIPV4)
84-
} ?: emptyList()
85-
DNSInfo(addresses, preferIPV4)
86-
}
87-
} else {
88-
val addresses = cache[hostname]?.addresses?.let { sortAddresses(it, preferIPV4) } ?: emptyList()
89-
cache[hostname] = DNSInfo(addresses, preferIPV4)
78+
cache.compute(hostname) { _, old ->
79+
val addresses =
80+
old?.addresses?.let {
81+
sortAddresses(it, preferIPV4)
82+
} ?: emptyList()
83+
DNSInfo(addresses, preferIPV4)
9084
}
9185
}
9286

library/src/main/java/com/owncloud/android/lib/common/network/AdvancedSslSocketFactory.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,12 @@ public Socket createSocket(String host, int port, InetAddress clientHost, int cl
8989

9090
/*
9191
private void logSslInfo() {
92-
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {
93-
Log_OC.v(TAG, "SUPPORTED SSL PARAMETERS");
94-
logSslParameters(mSslContext.getSupportedSSLParameters());
95-
Log_OC.v(TAG, "DEFAULT SSL PARAMETERS");
96-
logSslParameters(mSslContext.getDefaultSSLParameters());
97-
Log_OC.i(TAG, "CURRENT PARAMETERS");
98-
Log_OC.i(TAG, "Protocol: " + mSslContext.getProtocol());
99-
}
92+
Log_OC.v(TAG, "SUPPORTED SSL PARAMETERS");
93+
logSslParameters(mSslContext.getSupportedSSLParameters());
94+
Log_OC.v(TAG, "DEFAULT SSL PARAMETERS");
95+
logSslParameters(mSslContext.getDefaultSSLParameters());
96+
Log_OC.i(TAG, "CURRENT PARAMETERS");
97+
Log_OC.i(TAG, "Protocol: " + mSslContext.getProtocol());
10098
Log_OC.i(TAG, "PROVIDER");
10199
logSecurityProvider(mSslContext.getProvider());
102100
}

library/src/main/java/com/owncloud/android/lib/common/network/AdvancedX509KeyManager.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import android.content.Intent;
2020
import android.content.SharedPreferences;
2121
import android.net.Uri;
22-
import android.os.Build;
2322
import android.security.KeyChain;
2423
import android.security.KeyChainException;
2524
import android.util.SparseArray;
@@ -514,13 +513,11 @@ private void startActivityNotification(@NonNull Intent intent, int decisionId, @
514513
flags |= PendingIntent.FLAG_IMMUTABLE;
515514
final PendingIntent call = PendingIntent.getActivity(context, 0, intent, flags);
516515
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
517-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
518-
NotificationChannel channel = new NotificationChannel(
519-
NOTIFICATION_CHANNEL_ID,
520-
context.getString(R.string.notification_channel_name),
521-
NotificationManager.IMPORTANCE_DEFAULT);
522-
notificationManager.createNotificationChannel(channel);
523-
}
516+
NotificationChannel channel = new NotificationChannel(
517+
NOTIFICATION_CHANNEL_ID,
518+
context.getString(R.string.notification_channel_name),
519+
NotificationManager.IMPORTANCE_DEFAULT);
520+
notificationManager.createNotificationChannel(channel);
524521
final Notification notification = new NotificationCompat
525522
.Builder(context, NOTIFICATION_CHANNEL_ID)
526523
.setContentTitle(context.getString(R.string.notification_title_select_client_cert))

library/src/main/java/com/owncloud/android/lib/resources/assistant/chat/model/Conversation.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
package com.owncloud.android.lib.resources.assistant.chat.model
1010

11-
import android.os.Build
12-
import androidx.annotation.RequiresApi
1311
import com.google.gson.annotations.SerializedName
1412
import java.time.ZoneId
1513
import java.time.format.DateTimeFormatter
@@ -34,9 +32,8 @@ data class Conversation(
3432
}
3533

3634
@OptIn(ExperimentalTime::class)
37-
@RequiresApi(Build.VERSION_CODES.O)
38-
fun titleRepresentation(): String {
39-
return if (title != null) {
35+
fun titleRepresentation(): String =
36+
if (title != null) {
4037
title
4138
} else {
4239
val instant = Instant.fromEpochSeconds(timestamp)
@@ -47,7 +44,6 @@ data class Conversation(
4744
.ofPattern(TITLE_PRESENTATION_TIME_PATTERN, Locale.getDefault())
4845
.withZone(deviceZone)
4946

50-
return formatter.format(instant.toJavaInstant())
47+
formatter.format(instant.toJavaInstant())
5148
}
52-
}
5349
}

sample_client/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ android {
3838
}
3939

4040
defaultConfig {
41-
minSdkVersion 23
41+
minSdkVersion 26
4242
targetSdkVersion 36
4343

4444
multiDexEnabled = true

sample_client/src/main/java/com/owncloud/android/lib/sampleclient/MainActivity.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import android.widget.TextView;
2424
import android.widget.Toast;
2525

26-
import androidx.annotation.RequiresApi;
27-
2826
import com.owncloud.android.lib.common.OwnCloudClient;
2927
import com.owncloud.android.lib.common.OwnCloudClientFactory;
3028
import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;
@@ -129,9 +127,7 @@ public void onClickHandler(View button) {
129127
startRemoteDeletion();
130128
break;
131129
case R.id.button_download:
132-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
133-
startDownload();
134-
}
130+
startDownload();
135131
break;
136132
case R.id.button_delete_local:
137133
startLocalDeletion();
@@ -174,7 +170,6 @@ private void startRemoteDeletion() {
174170
removeOperation.execute(mClient, this, mHandler);
175171
}
176172

177-
@RequiresApi(api = Build.VERSION_CODES.O)
178173
private void startDownload() {
179174
File downFolder = new File(getCacheDir(), getString(R.string.download_folder_path));
180175
downFolder.mkdir();

0 commit comments

Comments
 (0)