From 6c1f49a00e8bfc8939096f7056a77ca120b81fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 3 Dec 2024 12:17:04 +0800 Subject: [PATCH] Fix check IBO resut --- .../main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt b/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt index 564d69d..ae6ff69 100644 --- a/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt +++ b/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt @@ -1,7 +1,6 @@ package io.nekohasekai.sfa.ui.main import android.annotation.SuppressLint -import android.app.Activity import android.content.Intent import android.net.Uri import android.os.Build @@ -48,8 +47,8 @@ class SettingsFragment : Fragment() { private val requestIgnoreBatteryOptimizations = registerForActivityResult( ActivityResultContracts.StartActivityForResult() ) { result -> - if (result.resultCode == Activity.RESULT_OK) { - binding.backgroundPermissionCard.isVisible = false + if (Application.powerManager.isIgnoringBatteryOptimizations(Application.application.packageName)) { + binding.backgroundPermissionCard.isGone = true } }