Skip to content

Commit

Permalink
Api aligning with easypermissions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmadalin authored Dec 23, 2020
1 parent e2da43e commit 2237948
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EasyPermissions-ktx [![Build Status][1]][2] [![Code Coverage][3]][4] [![Kotlin Version][5]][6] [![Android API][7]][8] [![Apache License][9]][10]
# EasyPermissions-ktx [![Build Status][1]][2] [![Code Coverage][3]][4] [![Latest Version][5]][6] [![Android API][7]][8] [![Apache License][9]][10]

Kotlin version of the popular [googlesample/easypermissions](https://github.com/googlesamples/easypermissions) wrapper library to simplify basic system
permissions logic on Android M or higher.
Expand Down Expand Up @@ -130,7 +130,7 @@ override fun onPermissionsDenied(requestCode: Int, perms: List<String>) {

// (Optional) Check whether the user denied any permissions and checked "NEVER ASK AGAIN."
// This will display a dialog directing them to enable the permission in app settings.
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms.toString())) {
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
SettingsDialog.Builder(this).build().show()
}
}
Expand Down Expand Up @@ -198,8 +198,8 @@ Rationale callbacks don't necessarily imply permission changes. To check for tho
[2]: https://travis-ci.com/vmadalin/easypermissions-ktx
[3]: https://codecov.io/gh/vmadalin/easypermissions-ktx/branch/master/graph/badge.svg
[4]: https://codecov.io/gh/vmadalin/easypermissions-ktx
[5]: https://img.shields.io/badge/kotlin-1.4.10-blue.svg
[6]: http://kotlinlang.org/
[5]: https://api.bintray.com/packages/mvalceleanu/EasyPermissions-ktx/easypermissions-ktx/images/download.svg
[6]: https://bintray.com/mvalceleanu/EasyPermissions-ktx/easypermissions-ktx/_latestVersion
[7]: https://img.shields.io/badge/API-14%2B-blue.svg?style=flat
[8]: https://android-arsenal.com/api?level=14
[9]: https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class MainActivity : AppCompatActivity(),

// (Optional) Check whether the user denied any permissions and checked "NEVER ASK AGAIN."
// This will display a dialog directing them to enable the permission in app settings.
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms.toString())) {
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
SettingsDialog.Builder(this).build().show()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ object EasyPermissions {
@JvmStatic
fun somePermissionPermanentlyDenied(
host: Activity,
@Size(min = 1) vararg deniedPerms: String
deniedPerms: List<String>
): Boolean {
return PermissionsHelper.newInstance(host).somePermissionPermanentlyDenied(deniedPerms)
}
Expand All @@ -247,7 +247,7 @@ object EasyPermissions {
@JvmStatic
fun somePermissionPermanentlyDenied(
host: Fragment,
@Size(min = 1) vararg deniedPerms: String
deniedPerms: List<String>
): Boolean {
return PermissionsHelper.newInstance(host).somePermissionPermanentlyDenied(deniedPerms)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ abstract class PermissionsHelper<T>(val host: T) {
}
}

fun somePermissionPermanentlyDenied(perms: Array<out String>): Boolean {
fun somePermissionPermanentlyDenied(perms: List<String>): Boolean {
return perms.any { permissionPermanentlyDenied(it) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class EasyPermissionsTest {
assertThat(
EasyPermissions.somePermissionPermanentlyDenied(
spyActivity,
*ALL_PERMS
ALL_PERMS.toList()
)
).isTrue()
}
Expand All @@ -290,7 +290,7 @@ class EasyPermissionsTest {
assertThat(
EasyPermissions.somePermissionPermanentlyDenied(
spyActivity,
*ALL_PERMS
ALL_PERMS.toList()
)
).isFalse()
}
Expand Down Expand Up @@ -497,7 +497,7 @@ class EasyPermissionsTest {
assertThat(
EasyPermissions.somePermissionPermanentlyDenied(
spyAppCompatActivity,
*ALL_PERMS
ALL_PERMS.toList()
)
).isTrue()
}
Expand All @@ -509,7 +509,7 @@ class EasyPermissionsTest {
assertThat(
EasyPermissions.somePermissionPermanentlyDenied(
spyAppCompatActivity,
*ALL_PERMS
ALL_PERMS.toList()
)
).isFalse()
}
Expand Down Expand Up @@ -698,7 +698,7 @@ class EasyPermissionsTest {
assertThat(
EasyPermissions.somePermissionPermanentlyDenied(
spyFragment,
*ALL_PERMS
ALL_PERMS.toList()
)
).isTrue()
}
Expand All @@ -710,7 +710,7 @@ class EasyPermissionsTest {
assertThat(
EasyPermissions.somePermissionPermanentlyDenied(
spyFragment,
*ALL_PERMS
ALL_PERMS.toList()
)
).isFalse()
}
Expand Down

0 comments on commit 2237948

Please sign in to comment.