Drop dependency upon apache's commons-io library
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -128,7 +128,6 @@ dependencies {
|
|||||||
implementation "com.google.protobuf:protobuf-javalite:3.22.3"
|
implementation "com.google.protobuf:protobuf-javalite:3.22.3"
|
||||||
|
|
||||||
//Apache's Goodies
|
//Apache's Goodies
|
||||||
implementation "commons-io:commons-io:2.11.0"
|
|
||||||
implementation "org.apache.commons:commons-text:1.10.0"
|
implementation "org.apache.commons:commons-text:1.10.0"
|
||||||
|
|
||||||
//Google's Goodies
|
//Google's Goodies
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import com.aurora.extensions.isSAndAbove
|
|||||||
import com.aurora.extensions.isTAndAbove
|
import com.aurora.extensions.isTAndAbove
|
||||||
import com.aurora.store.BuildConfig
|
import com.aurora.store.BuildConfig
|
||||||
import com.aurora.store.util.Log
|
import com.aurora.store.util.Log
|
||||||
import org.apache.commons.io.IOUtils
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class SessionInstaller(context: Context) : InstallerBase(context) {
|
class SessionInstaller(context: Context) : InstallerBase(context) {
|
||||||
@@ -81,19 +80,12 @@ class SessionInstaller(context: Context) : InstallerBase(context) {
|
|||||||
Log.i("Writing splits to session for $packageName")
|
Log.i("Writing splits to session for $packageName")
|
||||||
|
|
||||||
for (uri in uriList) {
|
for (uri in uriList) {
|
||||||
val inputStream = context.contentResolver.openInputStream(uri)
|
context.contentResolver.openInputStream(uri)?.use { input ->
|
||||||
val outputStream = session.openWrite(
|
session.openWrite("${packageName}_${System.currentTimeMillis()}", 0, -1).use {
|
||||||
"${packageName}_${System.currentTimeMillis()}",
|
input.copyTo(it)
|
||||||
0,
|
session.fsync(it)
|
||||||
-1
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
IOUtils.copy(inputStream, outputStream)
|
|
||||||
|
|
||||||
session.fsync(outputStream)
|
|
||||||
|
|
||||||
IOUtils.close(inputStream)
|
|
||||||
IOUtils.close(outputStream)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val callBackIntent = Intent(context, InstallerService::class.java)
|
val callBackIntent = Intent(context, InstallerService::class.java)
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ import com.tonyodev.fetch2core.Reason
|
|||||||
import nl.komponents.kovenant.task
|
import nl.komponents.kovenant.task
|
||||||
import nl.komponents.kovenant.ui.failUi
|
import nl.komponents.kovenant.ui.failUi
|
||||||
import nl.komponents.kovenant.ui.successUi
|
import nl.komponents.kovenant.ui.successUi
|
||||||
import org.apache.commons.io.FileUtils
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.locks.ReentrantLock
|
import java.util.concurrent.locks.ReentrantLock
|
||||||
import kotlin.concurrent.timerTask
|
import kotlin.concurrent.timerTask
|
||||||
@@ -565,7 +565,7 @@ class UpdateService: LifecycleService() {
|
|||||||
var filesExist = true
|
var filesExist = true
|
||||||
|
|
||||||
downloads.forEach { download ->
|
downloads.forEach { download ->
|
||||||
filesExist = filesExist && FileUtils.getFile(download.file).exists()
|
filesExist = filesExist && File(download.file).exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filesExist) {
|
if (filesExist) {
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import android.os.Build
|
|||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import com.aurora.extensions.isLAndAbove
|
import com.aurora.extensions.isLAndAbove
|
||||||
import com.aurora.store.util.PackageUtil.getPackageInfo
|
import com.aurora.store.util.PackageUtil.getPackageInfo
|
||||||
import org.apache.commons.io.IOUtils
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -92,10 +91,10 @@ class ApkCopier(private val context: Context, private val packageName: String) {
|
|||||||
val zipOutputStream = ZipOutputStream(fileOutputStream)
|
val zipOutputStream = ZipOutputStream(fileOutputStream)
|
||||||
|
|
||||||
for (file in fileList) {
|
for (file in fileList) {
|
||||||
file?.let {
|
file?.inputStream()?.use {
|
||||||
val zipEntry = ZipEntry(file.name)
|
val zipEntry = ZipEntry(file.name)
|
||||||
zipOutputStream.putNextEntry(zipEntry)
|
zipOutputStream.putNextEntry(zipEntry)
|
||||||
IOUtils.copy(it.inputStream(), zipOutputStream)
|
it.copyTo(zipOutputStream)
|
||||||
zipOutputStream.closeEntry()
|
zipOutputStream.closeEntry()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,10 +66,10 @@ import com.tonyodev.fetch2core.DownloadBlock
|
|||||||
import nl.komponents.kovenant.task
|
import nl.komponents.kovenant.task
|
||||||
import nl.komponents.kovenant.ui.failUi
|
import nl.komponents.kovenant.ui.failUi
|
||||||
import nl.komponents.kovenant.ui.successUi
|
import nl.komponents.kovenant.ui.successUi
|
||||||
import org.apache.commons.io.FileUtils
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class AppDetailsActivity : BaseDetailsActivity() {
|
class AppDetailsActivity : BaseDetailsActivity() {
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
var filesExist = true
|
var filesExist = true
|
||||||
|
|
||||||
files.forEach { download ->
|
files.forEach { download ->
|
||||||
filesExist = filesExist && FileUtils.getFile(download.file).exists()
|
filesExist = filesExist && File(download.file).exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filesExist)
|
if (filesExist)
|
||||||
@@ -683,7 +683,8 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
if (groupId == app.getGroupId(this@AppDetailsActivity)) {
|
if (groupId == app.getGroupId(this@AppDetailsActivity)) {
|
||||||
status = download.status
|
status = download.status
|
||||||
flip(1)
|
flip(1)
|
||||||
FileUtils.touch(inProgressMarker)
|
inProgressMarker.parentFile?.mkdirs()
|
||||||
|
inProgressMarker.createNewFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import com.tonyodev.fetch2.AbstractFetchGroupListener
|
|||||||
import com.tonyodev.fetch2.Download
|
import com.tonyodev.fetch2.Download
|
||||||
import com.tonyodev.fetch2.FetchGroup
|
import com.tonyodev.fetch2.FetchGroup
|
||||||
import nl.komponents.kovenant.task
|
import nl.komponents.kovenant.task
|
||||||
import org.apache.commons.io.FileUtils
|
import java.io.File
|
||||||
|
|
||||||
class UpdatesFragment : BaseFragment() {
|
class UpdatesFragment : BaseFragment() {
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ class UpdatesFragment : BaseFragment() {
|
|||||||
var filesExist = true
|
var filesExist = true
|
||||||
|
|
||||||
downloads.forEach { download ->
|
downloads.forEach { download ->
|
||||||
filesExist = filesExist && FileUtils.getFile(download.file).exists()
|
filesExist = filesExist && File(download.file).exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filesExist) {
|
if (filesExist) {
|
||||||
|
|||||||
Reference in New Issue
Block a user