Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jun 25, 2024
1 parent 559c59c commit 6044c7e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
applicationId = "com.d4rk.cleaner"
minSdk = 26
targetSdk = 34
versionCode = 72
versionCode = 73
versionName = "2.0.0"
archivesName = "${applicationId}-v${versionName}"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
19 changes: 15 additions & 4 deletions app/src/main/kotlin/com/d4rk/cleaner/ui/home/HomeViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,21 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
private fun hasRequiredPermissions(): Boolean {
val hasStoragePermissions = when {
Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q ->
ContextCompat.checkSelfPermission(getApplication(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
Build.VERSION.SDK_INT <= Build.VERSION_CODES.S ->
ContextCompat.checkSelfPermission(getApplication(), Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(getApplication(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
ContextCompat.checkSelfPermission(
getApplication(),
Manifest.permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED

Build.VERSION.SDK_INT <= Build.VERSION_CODES.S ->
ContextCompat.checkSelfPermission(
getApplication(),
Manifest.permission.READ_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(
getApplication(),
Manifest.permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED

else -> true
}
val hasManageStoragePermission = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Expand Down

0 comments on commit 6044c7e

Please sign in to comment.