Skip to content

Commit 69879ff

Browse files
authored
Grant permission only if TIRAMISU or above
1 parent 331e8cf commit 69879ff

File tree

1 file changed

+5
-1
lines changed
  • feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou

1 file changed

+5
-1
lines changed

feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package com.google.samples.apps.nowinandroid.feature.foryou
1818

1919
import android.Manifest
20+
import android.os.Build.VERSION.SDK_INT
21+
import android.os.Build.VERSION_CODES.TIRAMISU
2022
import androidx.activity.ComponentActivity
2123
import androidx.compose.foundation.layout.BoxWithConstraints
2224
import androidx.compose.ui.test.assertHasClickAction
@@ -40,7 +42,9 @@ import org.junit.Test
4042
class ForYouScreenTest {
4143

4244
@get:Rule
43-
val permissionTestRule: GrantPermissionRule = grant(Manifest.permission.POST_NOTIFICATIONS)
45+
val permissionTestRule: GrantPermissionRule =
46+
if (SDK_INT < TIRAMISU) grant()
47+
else grant(Manifest.permission.POST_NOTIFICATIONS)
4448

4549
@get:Rule
4650
val composeTestRule = createAndroidComposeRule<ComponentActivity>()

0 commit comments

Comments
 (0)