0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-23 11:45:11 +00:00

Error Messages Displayed Correctly

This commit is contained in:
ostajic 2020-08-24 23:20:48 +02:00
parent a21730a8bc
commit c48723be24
2 changed files with 15 additions and 14 deletions

View file

@ -86,20 +86,16 @@ class RootSplitInstallerService: Service() {
sendBroadcast(Intent(HomeFragment.VANCED_INSTALLED))
}
}
else
{
sendFailure(listOf("Install Failed").toMutableList(), applicationContext)
}
}
else
{
sendFailure(listOf("modApk Is Null Missing (dark.apk/black.apk) In apks Folder").toMutableList(), applicationContext)
sendFailure(listOf("ModApk_Missing").toMutableList(), applicationContext)
}
//installSplitApkFiles(fileInfoList)
}
else
{
sendFailure(listOf("Files are missing, Failed Download?").toMutableList(), applicationContext)
sendFailure(listOf("Files_Missing_VA").toMutableList(), applicationContext)
}
}
@ -224,7 +220,7 @@ class RootSplitInstallerService: Service() {
}
else
{
sendFailure(listOf("Download Went Corrupt, Retry or clear VanM Data").toMutableList(), applicationContext)
sendFailure(listOf("Corrupt_Data").toMutableList(), applicationContext)
}
@ -298,7 +294,7 @@ class RootSplitInstallerService: Service() {
{
return installSplitApkFiles(apkFiles)
}
with(localBroadcastManager) {sendFailure(listOf("Failed Uninstall Of Installed Version, Try Manually").toMutableList(), applicationContext)}
with(localBroadcastManager) {sendFailure(listOf("Failed_Uninstall").toMutableList(), applicationContext)}
return false
}
@ -342,7 +338,7 @@ class RootSplitInstallerService: Service() {
return if(Shell.su("chown system:system $path").exec().isSuccess) {
true
} else {
sendFailure(listOf("Failed To Chown, Try Again").toMutableList(), applicationContext)
sendFailure(listOf("Chown_Fail").toMutableList(), applicationContext)
false
}
@ -354,7 +350,7 @@ class RootSplitInstallerService: Service() {
}
}
else {
sendFailure(listOf("Input File Missing").toMutableList(), applicationContext)
sendFailure(listOf("IFile_Missing").toMutableList(), applicationContext)
return false
}
}
@ -379,20 +375,19 @@ class RootSplitInstallerService: Service() {
private fun checkSHA256(sha256: String, updateFile: File?): Boolean {
try {
// get the raw file data of the photo
val mInputPFD = contentResolver.openFileDescriptor(updateFile!!.toUri() , "r")
val mContentFileDescriptor = mInputPFD!!.fileDescriptor
val fIS = FileInputStream(mContentFileDescriptor)
val mGraphicBuffer = ByteArrayOutputStream()
val dataBuffer = ByteArrayOutputStream()
val buf = ByteArray(1024)
while (true) {
val readNum = fIS.read(buf)
if (readNum == -1) break
mGraphicBuffer.write(buf, 0, readNum)
dataBuffer.write(buf, 0, readNum)
}
// Generate the checksum
val sum = generateChecksum(mGraphicBuffer)
val sum = generateChecksum(dataBuffer)
return sum == sha256
} catch (e: Exception) {

View file

@ -39,6 +39,12 @@ object AppUtils {
status.contains("INSTALL_FAILED_INVALID_APK") -> context.getString(R.string.installation_invalid)
status.contains("INSTALL_FAILED_VERSION_DOWNGRADE") -> context.getString(R.string.installation_downgrade)
status.contains("INSTALL_PARSE_FAILED_NO_CERTIFICATES") -> context.getString(R.string.installation_signature)
status.contains("Failed_Uninstall") -> "Failed Uninstall Of Installed Version, Try Manually"
status.contains("Chown_Fail") -> "Failed To Chown, Try Again"
status.contains("IFile_Missing") -> "Input File Missing"
status.contains("ModApk_Missing") -> "modApk Is Null Missing (dark.apk/black.apk) In apks Folder"
status.contains("Files_Missing_VA") -> "Files are missing, Failed Download?"
status.contains("Corrupt_Data") -> "Download Went Corrupt, Retry or clear VanM Data"
else ->
if (MiuiHelper.isMiui())
context.getString(R.string.installation_miui)