Commit f8853cc9 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

XAPK: Migrate to getExternalFilesDir method

Current method has been deprecated

References:
- [1]: https://developer.android.com/reference/android/os/Environment#getExternalStorageDirectory()

Signed-off-by: Aayush Gupta's avatarAayush Gupta <theimpulson@e.email>
parent 160c1250
Pipeline #109621 passed with stage
in 3 minutes and 58 seconds
......@@ -19,6 +19,7 @@ package foundation.e.apps.XAPK
import android.os.Environment
import foundation.e.apps.BuildConfig
import foundation.e.apps.MainActivity
import java.io.File
object AppFolder {
......@@ -51,7 +52,8 @@ object AppFolder {
private val appFolder: File?
get() {
return if (FsUtils.isSdUsable) {
val appFolder = File(Environment.getExternalStorageDirectory(), APP_FOLDER_NAME)
val appContext = MainActivity.applicationContext()
val appFolder = File(appContext.getExternalFilesDir(null), APP_FOLDER_NAME)
FsUtils.createOnNotFound(appFolder)
} else {
null
......
......@@ -19,6 +19,7 @@ package foundation.e.apps.XAPK
import android.os.Environment
import android.text.TextUtils
import foundation.e.apps.MainActivity
import java.io.File
object FsUtils {
......@@ -28,7 +29,8 @@ object FsUtils {
fun getStorageDir(): File? {
return if (isSdUsable) {
Environment.getExternalStorageDirectory()
val appContext = MainActivity.applicationContext()
appContext.getExternalFilesDir(null)
} else {
null
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment