Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sangcomz committed Oct 3, 2022
2 parents c1aa38a + c81cbde commit bed56f5
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 31 deletions.
3 changes: 2 additions & 1 deletion 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 Expand Up @@ -54,7 +55,7 @@ android {
}
}

apply plugin: 'co.riiid.gradle'
apply plugin: "io.github.sabujak-sabujak"

apply from: '../publish/release.gradle'

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
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ _FishBun_ is a highly customizable image picker for Android.
<img src="/pic/fishbuns.png">


## What's New in _FishBun_ 1.0.0-beta01? :tada:
## What's New in _FishBun_ 1.1.0? :tada:

- add startAlbumWithActivityResultCallback function(#239)
- remove jcenter
- library version update
- sdk version update


## Customizable Styles
Expand Down Expand Up @@ -112,7 +110,7 @@ Fishbun 0.10.0 and above only supports projects that have been migrated to [andr
Setting up _FishBun_ requires to add this Gradle configuration:

dependencies {
implementation 'io.github.sangcomz:fishbun:1.0.0-alpha06'
implementation 'io.github.sangcomz:fishbun:x.x.x'
implementation 'io.coil-kt:coil:0.11.0'
or
Expand All @@ -133,6 +131,14 @@ If your app targets Android 11 with compileSdk/targetSdk >= 30 then you will nee
</intent>
</queries>

If your app targets Android 13 with compileSdk/targetSdk >= 33 then you will need to add this to the manifest. [Android documentation here](https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions):

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

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

## How to Use

Use _FishBun_ in an activity:
Expand Down
8 changes: 6 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 @@ -14,11 +14,15 @@ buildscript {
repositories {
mavenCentral()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
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"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
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
6 changes: 2 additions & 4 deletions publish/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,14 @@ afterEvaluate {
}
}

github {
githubRelease {
owner = 'sangcomz'
repo = 'Fishbun'
token = githubAccessTokens
tagName = version
targetCommitish = 'master'
body = """## Release Note
* add startAlbumWithActivityResultCallback function(#239)
* remove jcenter
* library version update
* update sdk version to 33
"""
name = version
}
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./gradlew clean fishbun:publishAllPublicationsToMavenRepository githubRelease
./gradlew clean fishbun:publishAllPublicationsToMavenRepository createGithubRelease
8 changes: 4 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include ':FishBunDemo', ':FishBun'

gradle.ext.versionCode = 35
gradle.ext.versionName = '1.0.0-beta01'
gradle.ext.versionCode = 36
gradle.ext.versionName = '1.1.0'

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 bed56f5

Please sign in to comment.