Skip to content

Commit

Permalink
DEL not necessary android manifest permissions #40
Browse files Browse the repository at this point in the history
  • Loading branch information
rafi0101 committed Dec 3, 2024
1 parent 42e68c9 commit 5ba36f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
15 changes: 1 addition & 14 deletions core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<manifest xmlns:tools="http://schemas.android.com/tools"
tools:ignore="ExtraText">

<!-- Required only if your app targets Android 13. -->
<!-- Declare one or more the following permissions only if your app needs
to access data thats protected by them. -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

<!-- Required to maintain app compatibility. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

/
</manifest>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.raphaelebner.roomdatabasebackup.core

import android.Manifest.permission.*
import android.app.Activity
import android.content.Context
import android.content.Intent
Expand All @@ -16,12 +15,19 @@ import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKey
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.common.io.Files.copy
import java.io.*
import java.text.SimpleDateFormat
import java.util.*
import javax.crypto.BadPaddingException
import kotlinx.coroutines.runBlocking
import org.apache.commons.io.comparator.LastModifiedFileComparator
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
import java.text.SimpleDateFormat
import java.util.Arrays
import java.util.Calendar
import java.util.Locale
import javax.crypto.BadPaddingException

/**
* MIT License
Expand Down Expand Up @@ -302,7 +308,9 @@ class RoomBackup(var context: Context) {
try {
INTERNAL_BACKUP_PATH.mkdirs()
TEMP_BACKUP_PATH.mkdirs()
} catch (e: FileAlreadyExistsException) {} catch (e: IOException) {}
} catch (_: FileAlreadyExistsException) {
} catch (_: IOException) {
}

if (enableLogDebug) {
Log.d(TAG, "DatabaseName: $dbName")
Expand Down Expand Up @@ -359,13 +367,7 @@ class RoomBackup(var context: Context) {
}
BACKUP_FILE_LOCATION_CUSTOM_DIALOG -> {
backupFilename = filename
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permissionRequestLauncher.launch(
arrayOf(READ_MEDIA_IMAGES, READ_MEDIA_AUDIO, READ_MEDIA_VIDEO)
)
} else {
permissionRequestLauncher.launch(arrayOf(READ_EXTERNAL_STORAGE))
}
permissionRequestLauncher.launch(arrayOf())
return
}
BACKUP_FILE_LOCATION_CUSTOM_FILE -> {
Expand Down Expand Up @@ -496,13 +498,7 @@ class RoomBackup(var context: Context) {
backupDirectory = File("$EXTERNAL_BACKUP_PATH/")
}
BACKUP_FILE_LOCATION_CUSTOM_DIALOG -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permissionRequestLauncher.launch(
arrayOf(READ_MEDIA_IMAGES, READ_MEDIA_AUDIO, READ_MEDIA_VIDEO)
)
} else {
permissionRequestLauncher.launch(arrayOf(READ_EXTERNAL_STORAGE))
}
permissionRequestLauncher.launch(arrayOf())
return
}
BACKUP_FILE_LOCATION_CUSTOM_FILE -> {
Expand Down

0 comments on commit 5ba36f4

Please sign in to comment.