Skip to content

Commit

Permalink
Grant permission when running the relevant API version
Browse files Browse the repository at this point in the history
  • Loading branch information
amberin committed Jul 24, 2024
1 parent cddd287 commit 1323925
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.orgzly.android.espresso

import android.os.Build
import android.os.Environment
import android.os.SystemClock
import androidx.test.core.app.ActivityScenario
Expand Down Expand Up @@ -28,9 +29,11 @@ class ExternalLinksTest(private val param: Parameter) : OrgzlyTest() {
data class Parameter(val link: String, val check: () -> Any)

@get:Rule
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
android.Manifest.permission.READ_MEDIA_IMAGES
)
val grantPermissionRule: GrantPermissionRule = if (Build.VERSION.SDK_INT >= 33) {
GrantPermissionRule.grant(android.Manifest.permission.READ_MEDIA_IMAGES)
} else {
GrantPermissionRule.grant()
}

companion object {
@JvmStatic
Expand Down

0 comments on commit 1323925

Please sign in to comment.