0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-10 12:55:06 +00:00

removed useless logging

This commit is contained in:
X1nto 2020-08-07 10:18:23 +04:00
parent 6c0d0016c4
commit a12754123f
7 changed files with 16 additions and 23 deletions

View file

@ -33,7 +33,7 @@ class AppInstallerService: Service() {
sendBroadcast(Intent(HomeFragment.MICROG_INSTALLED))
}
}
else -> sendFailure(this, intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999))
else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this)
}
stopSelf()
return START_NOT_STICKY

View file

@ -72,14 +72,8 @@ class RootSplitInstallerService: Service() {
sendBroadcast(Intent(HomeFragment.REFRESH_HOME))
sendBroadcast(Intent(HomeFragment.VANCED_INSTALLED))
}
} else {
sendFailure(this, installResult.code)
/*
val mIntent = Intent(HomeFragment.INSTALL_FAILED)
mIntent.putExtra("errorMsg", getString(R.string.installation_signature))
localBroadcastManager.sendBroadcast(mIntent)
*/
}
} else
sendFailure(installResult.code, this)
}
private fun SimpleDateFormat.tryParse(str: String) = try {

View file

@ -32,7 +32,7 @@ class SplitInstallerService: Service() {
sendBroadcast(Intent(HomeFragment.VANCED_INSTALLED))
}
}
else -> sendFailure(this, intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999))
else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this)
}
stopSelf()

View file

@ -75,7 +75,6 @@ class MainActivity : AppCompatActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (isInstallationRunning(this)) {
Log.d("VMService", "Installation is already running")
return false
}

View file

@ -40,7 +40,7 @@ class ChosenPreferenceDialogFragment : DialogFragment() {
newPrefs.add(loc.getDisplayLanguage(loc).capitalize(Locale.ROOT))
}
}
binding.chosenTheme.text = requireActivity().getString(R.string.chosen_theme, prefs.getString("theme", "dark")).capitalize(Locale.ROOT)
binding.chosenTheme.text = requireActivity().getString(R.string.chosen_theme, prefs.getString("theme", "dark")?.capitalize(Locale.ROOT))
binding.chosenLang.text = requireActivity().getString(R.string.chosen_lang, newPrefs.joinToString())
binding.chosenPrefsClose.setOnClickListener { dismiss() }

View file

@ -5,7 +5,7 @@ import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.util.Log
import android.os.Handler
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.vanced.manager.R
import com.vanced.manager.core.downloader.*
@ -27,18 +27,18 @@ object AppUtils {
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val runningServices = activityManager.getRunningServices(Int.MAX_VALUE)
runningServices.forEach { info ->
if (info.service.className == cls.name) {
Log.d("VMService", "${cls.name} is running")
return true
}
return info.service.className == cls.name
}
return false
}
fun sendFailure(context: Context, status: Int) {
val intent = Intent(HomeFragment.INSTALL_FAILED)
intent.putExtra("errorMsg", getErrorMessage(status, context))
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
fun sendFailure(status: Int, context: Context) {
//Delay error broadcast until activity (and fragment) get back to the screen
Handler().postDelayed({
val intent = Intent(HomeFragment.INSTALL_FAILED)
intent.putExtra("errorMsg", getErrorMessage(status, context))
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
}, 500)
}
private fun getErrorMessage(status: Int, context: Context): String {

View file

@ -53,7 +53,7 @@
<string name="category_interface">Interface</string>
<string name="category_manager">Manager</string>
<string name="chosen_install_values">Chosen installation preferences</string>
<string name="chosen_lang">Language: %1$s</string>
<string name="chosen_lang">Language(s): %1$s</string>
<string name="chosen_theme">Theme: %1$s</string>
<string name="link_title">Use Chrome Custom Tabs</string>
<string name="link_custom_tabs">Links will open in Chrome Custom Tabs</string>
@ -74,7 +74,7 @@
<string name="button_dismiss">Dismiss</string>
<string name="guide">Guide</string>
<string name="hold_on">Hold on!</string>
<string name="magisk_vanced">Looks like you\'re using the Magisk version of Vanced, which is discontinued and can not be updated using this app. Please remove it first by removing the magisk module.</string>
<string name="magisk_vanced">Looks like you\'re using the Magisk/TWRP version of Vanced, which is discontinued and can not be updated using this app. Please remove it first by removing the magisk module/using TWRP Vanced uninstaller.</string>
<string name="miui_one_title">MIUI detected!</string>
<string name="miui_one">Hey! it looks like you\'re a MIUI user. in order to properly use this application, you will have to disable MIUI optimisations in the developer settings. (You can safely ignore this warning if you are on a 20.2.20 or later ROM based on xiaomi.eu)</string>
<string name="error">Error</string>