use nullable context again

This commit is contained in:
IndusAryan 2024-03-08 18:39:56 +05:30
parent 3be0c2f293
commit 86165a23c8
3 changed files with 3 additions and 4 deletions

View file

@ -645,8 +645,7 @@ open class ResultFragmentPhone : FullScreenPlayer() {
),
null
) { click ->
runCatching { context ?: requireContext() }.getOrNull()
?.let { openBatteryOptimizationSettings(it) }
context?.let { openBatteryOptimizationSettings(it) }
when (click.action) {
DOWNLOAD_ACTION_DOWNLOAD -> {

View file

@ -205,7 +205,7 @@ class SettingsGeneral : PreferenceFragmentCompat() {
}
getPref(R.string.battery_optimisation_key)?.setOnPreferenceClickListener {
val ctx = context ?: requireContext()
val ctx = context ?: return@setOnPreferenceClickListener false
if (isAppRestricted(ctx)) {
intentOpenAppInfo(ctx)

View file

@ -73,7 +73,7 @@ object BatteryOptimizationChecker {
.setData(Uri.fromParts("package", packageName, null))
context.startActivity(intent, Bundle())
} catch (t: Throwable) {
Log.e(TAG, "Unable to invoke Intent for - CS3/App Info")
Log.e(TAG, "Unable to invoke intent for - CS3/App Info", t)
showToast(R.string.app_info_intent_error)
}
}