diff --git a/CHANGELOG.md b/CHANGELOG.md index 4654def..237072d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.5.2] - 2023-09-26 +- Extend Android minSdkVersion to 21 + ## [1.5.1] - 2023-08-22 - Fix cancellation of upload workers for the WorkManager API diff --git a/README.md b/README.md index ec1147f..68b83bd 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Add this dependency to your project's POM: video.api android-api-client - 1.5.1 + 1.5.2 compile ``` @@ -67,7 +67,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -implementation "video.api:android-api-client:1.5.1" +implementation "video.api:android-api-client:1.5.2" ``` ### Others @@ -80,7 +80,7 @@ mvn clean package Then manually install the following JARs: -* `target/android-api-client-1.5.1.jar` +* `target/android-api-client-1.5.2.jar` * `target/lib/*.jar` ## Code sample diff --git a/build.gradle b/build.gradle index 4d857c4..93966c7 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'maven-publish' apply plugin: 'kotlin-android' group = 'video.api' -version = '1.5.1' +version = '1.5.2' buildscript { repositories { @@ -36,7 +36,7 @@ if(hasProperty('target') && target == 'android') { compileSdkVersion 33 buildToolsVersion '30.0.3' defaultConfig { - minSdkVersion 24 + minSdkVersion 21 targetSdkVersion 33 multiDexEnabled true diff --git a/examples/service/build.gradle b/examples/service/build.gradle index 70d8d42..d69ab5e 100644 --- a/examples/service/build.gradle +++ b/examples/service/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "video.api.client.service.example" - minSdkVersion 24 + minSdkVersion 21 targetSdkVersion 33 versionCode 1 versionName "1.0" diff --git a/examples/service/src/main/java/video/api/client/service/example/ReadStorePermissionManager.kt b/examples/service/src/main/java/video/api/client/service/example/ReadStorePermissionManager.kt index 91adf16..680eb8d 100644 --- a/examples/service/src/main/java/video/api/client/service/example/ReadStorePermissionManager.kt +++ b/examples/service/src/main/java/video/api/client/service/example/ReadStorePermissionManager.kt @@ -16,13 +16,21 @@ class ReadStorePermissionManager( } else { android.Manifest.permission.READ_EXTERNAL_STORAGE } + private val hasPermission: Boolean - get() = activity.checkSelfPermission(requiredPermission) == PackageManager.PERMISSION_GRANTED + get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + activity.checkSelfPermission(requiredPermission) == PackageManager.PERMISSION_GRANTED + } else { + true + } fun requestPermission() { if (hasPermission) { onGranted() } else { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + throw IllegalStateException("Permission should be granted") + } if (activity.shouldShowRequestPermissionRationale(requiredPermission)) { onShowPermissionRationale(requiredPermission) { requestPermission.launch(requiredPermission) @@ -41,4 +49,4 @@ class ReadStorePermissionManager( onDenied() } } -} \ No newline at end of file +} diff --git a/examples/workmanager/build.gradle b/examples/workmanager/build.gradle index 7f976da..cc355f8 100644 --- a/examples/workmanager/build.gradle +++ b/examples/workmanager/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "video.api.client.work.example" - minSdkVersion 24 + minSdkVersion 21 targetSdkVersion 33 versionCode 1 versionName "1.0" diff --git a/examples/workmanager/src/main/java/video/api/client/work/example/ReadStorePermissionManager.kt b/examples/workmanager/src/main/java/video/api/client/work/example/ReadStorePermissionManager.kt index b1430d5..92bae48 100644 --- a/examples/workmanager/src/main/java/video/api/client/work/example/ReadStorePermissionManager.kt +++ b/examples/workmanager/src/main/java/video/api/client/work/example/ReadStorePermissionManager.kt @@ -16,13 +16,21 @@ class ReadStorePermissionManager( } else { android.Manifest.permission.READ_EXTERNAL_STORAGE } + private val hasPermission: Boolean - get() = activity.checkSelfPermission(requiredPermission) == PackageManager.PERMISSION_GRANTED + get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + activity.checkSelfPermission(requiredPermission) == PackageManager.PERMISSION_GRANTED + } else { + true + } fun requestPermission() { if (hasPermission) { onGranted() } else { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + throw IllegalStateException("Permission should be granted") + } if (activity.shouldShowRequestPermissionRationale(requiredPermission)) { onShowPermissionRationale(requiredPermission) { requestPermission.launch(requiredPermission) @@ -41,4 +49,4 @@ class ReadStorePermissionManager( onDenied() } } -} \ No newline at end of file +} diff --git a/maven-push.gradle b/maven-push.gradle index 14e4a15..f11bc08 100644 --- a/maven-push.gradle +++ b/maven-push.gradle @@ -18,7 +18,7 @@ apply plugin: 'maven-publish' apply plugin: 'signing' def isReleaseBuild() { - return !"1.5.1".contains("SNAPSHOT") + return !"1.5.2".contains("SNAPSHOT") } def getReleaseRepositoryUrl() { @@ -47,7 +47,7 @@ afterEvaluate { project -> groupId = "video.api" artifactId = "android-api-client" - version = "1.5.1" + version = "1.5.2" pom { name = "video.api:android-api-client" diff --git a/pom.xml b/pom.xml index c54724c..b3f6c17 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ android-api-client jar ${project.groupId}:${project.artifactId} - 1.5.1 + 1.5.2 https://github.com/apivideo/api.video-android-client api.video Android API client diff --git a/src/main/java/video/api/client/api/ApiClient.java b/src/main/java/video/api/client/api/ApiClient.java index b58b932..7d6483d 100644 --- a/src/main/java/video/api/client/api/ApiClient.java +++ b/src/main/java/video/api/client/api/ApiClient.java @@ -118,7 +118,7 @@ private OkHttpClient initHttpClient(List interceptors) { private void init() { verifyingSsl = true; json = new JSON(); - addDefaultHeader("AV-Origin-Client", "android:1.5.1"); + addDefaultHeader("AV-Origin-Client", "android:1.5.2"); } private boolean isValid(String regex, String field) { diff --git a/src/main/java/video/api/client/api/notifications/NotificationExtensions.kt b/src/main/java/video/api/client/api/notifications/NotificationExtensions.kt index 53332ab..b2c0cde 100644 --- a/src/main/java/video/api/client/api/notifications/NotificationExtensions.kt +++ b/src/main/java/video/api/client/api/notifications/NotificationExtensions.kt @@ -4,6 +4,7 @@ import android.content.Context import androidx.annotation.ColorRes import androidx.annotation.DrawableRes import androidx.core.app.NotificationCompat +import androidx.core.content.ContextCompat fun NotificationCompat.Builder.setStyle( context: Context, @@ -11,5 +12,5 @@ fun NotificationCompat.Builder.setStyle( @ColorRes notificationColorResourceId: Int ): NotificationCompat.Builder = apply { setSmallIcon(notificationIconResourceId) - color = context.getColor(notificationColorResourceId) + color = ContextCompat.getColor(context, notificationColorResourceId) } \ No newline at end of file