Skip to content

Commit

Permalink
Add final variable WRITE_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE for…
Browse files Browse the repository at this point in the history
… permission request
  • Loading branch information
QUIETTTTTTTTTT committed Nov 8, 2024
1 parent 59f140b commit 8d50540
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/fr/free/nrw/commons/edit/EditActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class EditActivity : AppCompatActivity() {
private val sourceExifAttributeList = mutableListOf<Pair<String, String?>>()
private lateinit var binding: ActivityEditBinding

private final var WRITE_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE = 7747;

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityEditBinding.inflate(layoutInflater)
Expand Down Expand Up @@ -248,9 +250,7 @@ class EditActivity : AppCompatActivity() {
//Get Permission to access
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
//The request code 7747 can be change to any other constant, because it was choose randomly.
//The random selection is to avoid future duplication of the same code, preventing confusion during debugging.
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 7747)
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), WRITE_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE)
}

val filePath = imageUri.toUri().path
Expand Down

0 comments on commit 8d50540

Please sign in to comment.