Skip to content

Commit

Permalink
Merge pull request orgzly-revived#294 from Helle-Daryd/fix-image-loading
Browse files Browse the repository at this point in the history
Fixes the image loading
  • Loading branch information
amberin authored Jul 25, 2024
2 parents ce16fca + 74fe307 commit f762a4c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.orgzly.android.espresso

import android.os.Build
import android.os.Environment
import android.os.SystemClock
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.rule.GrantPermissionRule
import com.orgzly.R
import com.orgzly.android.App
import com.orgzly.android.OrgzlyTest
Expand All @@ -15,6 +17,7 @@ import com.orgzly.android.espresso.util.EspressoUtils.onNoteInBook
import com.orgzly.android.espresso.util.EspressoUtils.onSnackbar
import com.orgzly.android.ui.main.MainActivity
import org.hamcrest.Matchers.startsWith
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
Expand All @@ -25,6 +28,13 @@ class ExternalLinksTest(private val param: Parameter) : OrgzlyTest() {

data class Parameter(val link: String, val check: () -> Any)

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

companion object {
@JvmStatic
@Parameterized.Parameters(name = "{index}: {0}")
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

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

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

Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/orgzly/android/util/AppPermissions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ object AppPermissions {
Usage.BOOK_EXPORT -> Manifest.permission.WRITE_EXTERNAL_STORAGE
Usage.SYNC_START -> Manifest.permission.WRITE_EXTERNAL_STORAGE
Usage.SAVED_SEARCHES_EXPORT_IMPORT -> Manifest.permission.WRITE_EXTERNAL_STORAGE
Usage.EXTERNAL_FILES_ACCESS -> Manifest.permission.READ_EXTERNAL_STORAGE
Usage.EXTERNAL_FILES_ACCESS -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
Manifest.permission.READ_MEDIA_IMAGES
else
Manifest.permission.READ_EXTERNAL_STORAGE
Usage.POST_NOTIFICATIONS -> Manifest.permission.POST_NOTIFICATIONS
}
}
Expand Down

0 comments on commit f762a4c

Please sign in to comment.