Skip to content
This repository was archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
Sample updates, logging tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
afollestad committed May 14, 2019
1 parent 311cb3b commit 228a08d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class PermissionFragment : Fragment() {
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
log("onRequestPermissionsResult(\n\tpermissions = $permissions,\n\tgrantResults = $grantResults\n))")
onPermissionsResponse(
permissions = permissions,
grantResults = grantResults
Expand All @@ -77,7 +76,11 @@ internal fun Fragment.onPermissionsResponse(
permissions: Array<out String>,
grantResults: IntArray
) = synchronized(Assent.LOCK) {
log("onPermissionsResponse(\n\tpermissions = $permissions,\n\tgrantResults = $grantResults\n))")
log(
"onPermissionsResponse(\n\tpermissions = %s,\n\tgrantResults = %s\n))",
permissions.joinToString(),
grantResults.joinToString()
)

val currentRequest = get().currentPendingRequest
if (currentRequest == null) {
Expand Down
3 changes: 2 additions & 1 deletion sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
package="com.afollestad.assentsample">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>

<application
android:name=".SampleApp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MainActivity : AppCompatActivity() {

override fun onResume() {
super.onResume()
if (isAllGranted(WRITE_EXTERNAL_STORAGE, CALL_PHONE)) {
if (isAllGranted(READ_CONTACTS, WRITE_EXTERNAL_STORAGE, READ_SMS)) {
statusText.setText(R.string.all_granted)
} else {
statusText.setText(R.string.none_granted)
Expand Down

0 comments on commit 228a08d

Please sign in to comment.