Commit a58f51b6 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Don't show battery optimization dialog when already ignoring battery optimizations

parent 3dba5c48
...@@ -5,7 +5,9 @@ import android.content.Context ...@@ -5,7 +5,9 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.net.* import android.net.*
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.PowerManager
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import com.frostnerd.general.service.isServiceRunning import com.frostnerd.general.service.isServiceRunning
...@@ -209,7 +211,9 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -209,7 +211,9 @@ class MainActivity : NavigationDrawerActivity() {
!getPreferences().ignoreServiceKilled && !getPreferences().ignoreServiceKilled &&
getPreferences().vpnLaunchLastVersion == BuildConfig.VERSION_CODE) { getPreferences().vpnLaunchLastVersion == BuildConfig.VERSION_CODE) {
getPreferences().vpnServiceState = VpnServiceState.STOPPED getPreferences().vpnServiceState = VpnServiceState.STOPPED
BatteryOptimizationInfoDialog(this).show() if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M|| !(getSystemService(POWER_SERVICE) as PowerManager).isIgnoringBatteryOptimizations(packageName)) {
BatteryOptimizationInfoDialog(this).show()
}
} }
registerLocalReceiver(listOf(BROADCAST_RELOAD_MENU), true) { registerLocalReceiver(listOf(BROADCAST_RELOAD_MENU), true) {
reloadMenuItems() reloadMenuItems()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment