Skip to content

Commit

Permalink
update target sdk version to 33
Browse files Browse the repository at this point in the history
  • Loading branch information
sangcomz committed Oct 3, 2022
1 parent 27bdd62 commit 4cb3b0f
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 21 deletions.
1 change: 1 addition & 0 deletions FishBun/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ buildscript {


android {
namespace 'com.sangcomz.fishbun'
compileSdkVersion gradle.compileSdk

defaultConfig {
Expand Down
3 changes: 1 addition & 2 deletions FishBun/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sangcomz.fishbun">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,35 @@ class PermissionCheck(private val context: Context) {
}
}

@TargetApi(Build.VERSION_CODES.M)
fun checkStoragePermission(requestCode: Int): Boolean {
return when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU -> {
checkStoragePermissionUnderAPI33(requestCode)
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> {
checkStoragePermissionOrHigherAPI33(requestCode)
}
else -> true
}
}

@TargetApi(Build.VERSION_CODES.M)
fun checkStoragePermissionUnderAPI33(requestCode: Int): Boolean {
return checkPermission(
arrayListOf(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE),
requestCode
)
}

@TargetApi(Build.VERSION_CODES.TIRAMISU)
fun checkStoragePermissionOrHigherAPI33(requestCode: Int): Boolean {
return checkPermission(
arrayListOf(READ_MEDIA_IMAGES),
requestCode
)
}

@TargetApi(Build.VERSION_CODES.M)
fun checkCameraPermission(requestCode: Int): Boolean {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ class AlbumActivity : BaseActivity(),
}

private fun checkPermission(): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
permissionCheck.checkStoragePermission(PERMISSION_STORAGE)
} else true
return permissionCheck.checkStoragePermission(PERMISSION_STORAGE)
}

private fun checkCameraPermission(): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,7 @@ class PickerActivity : BaseActivity(),
}

private fun checkPermission(): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (permissionCheck.checkStoragePermission(PERMISSION_STORAGE)) return true
} else return true
return false
return permissionCheck.checkStoragePermission(PERMISSION_STORAGE)
}

private fun checkCameraPermission(): Boolean {
Expand Down
6 changes: 5 additions & 1 deletion FishBunDemo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sangcomz.fishbundemo">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

buildscript {
ext {
kotlin_version = '1.5.21'
kotlin_version = '1.7.10'
androidx_version = '1.3.1'
recyclerview_version = '1.2.1'
material_version = '1.4.0'
Expand All @@ -19,7 +19,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.bjoernq:unmockplugin:0.7.9'
classpath "io.github.sabujak-sabujak:gradle-github-release-plugin:0.0.2"
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jan 04 21:58:21 KST 2021
#Mon Sep 26 23:18:15 KST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME
4 changes: 1 addition & 3 deletions publish/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ githubRelease {
tagName = version
targetCommitish = 'master'
body = """## Release Note
* add startAlbumWithActivityResultCallback function(#239)
* remove jcenter
* library version update
* update sdk version to 33
"""
name = version
}
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ gradle.ext.versionCode = 35
gradle.ext.versionName = '1.0.0-beta01'

gradle.ext.set('minSdk', 15)
gradle.ext.set('targetSdk', 31)
gradle.ext.set('compileSdk', 31)
gradle.ext.set('targetSdk', 33)
gradle.ext.set('compileSdk', 33)

0 comments on commit 4cb3b0f

Please sign in to comment.