F-Droid compilation

This commit is contained in:
Benoit Marty 2020-10-07 19:08:00 +02:00
parent e67fe1476c
commit f7e040efd2
3 changed files with 11 additions and 6 deletions

View File

@ -15,6 +15,8 @@
*/
package im.vector.app.fdroid.features.settings.troubleshoot
import android.content.Intent
import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.resources.StringProvider
import im.vector.app.features.settings.VectorPreferences
@ -28,7 +30,7 @@ class TestAutoStartBoot @Inject constructor(private val vectorPreferences: Vecto
private val stringProvider: StringProvider)
: TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) {
override fun perform() {
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
if (vectorPreferences.autoStartOnBoot()) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_service_boot_success)
status = TestStatus.SUCCESS
@ -38,7 +40,7 @@ class TestAutoStartBoot @Inject constructor(private val vectorPreferences: Vecto
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_service_boot_quickfix) {
override fun doFix() {
vectorPreferences.setAutoStartOnBoot(true)
manager?.retry()
manager?.retry(activityResultLauncher)
}
}
status = TestStatus.FAILED

View File

@ -15,7 +15,9 @@
*/
package im.vector.app.fdroid.features.settings.troubleshoot
import android.content.Intent
import android.net.ConnectivityManager
import androidx.activity.result.ActivityResultLauncher
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.getSystemService
import androidx.core.net.ConnectivityManagerCompat
@ -28,7 +30,7 @@ class TestBackgroundRestrictions @Inject constructor(private val context: AppCom
private val stringProvider: StringProvider)
: TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) {
override fun perform() {
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
context.getSystemService<ConnectivityManager>()!!.apply {
// Checks if the device is on a metered network
if (isActiveNetworkMetered) {

View File

@ -15,12 +15,13 @@
*/
package im.vector.app.fdroid.features.settings.troubleshoot
import android.content.Intent
import androidx.activity.result.ActivityResultLauncher
import androidx.appcompat.app.AppCompatActivity
import im.vector.app.R
import im.vector.app.core.resources.StringProvider
import im.vector.app.core.utils.isIgnoringBatteryOptimizations
import im.vector.app.core.utils.requestDisablingBatteryOptimization
import im.vector.app.features.settings.troubleshoot.NotificationTroubleshootTestManager
import im.vector.app.features.settings.troubleshoot.TroubleshootTest
import javax.inject.Inject
@ -29,7 +30,7 @@ class TestBatteryOptimization @Inject constructor(
private val stringProvider: StringProvider
) : TroubleshootTest(R.string.settings_troubleshoot_test_battery_title) {
override fun perform() {
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
if (isIgnoringBatteryOptimizations(context)) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_battery_success)
status = TestStatus.SUCCESS
@ -38,7 +39,7 @@ class TestBatteryOptimization @Inject constructor(
description = stringProvider.getString(R.string.settings_troubleshoot_test_battery_failed)
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_battery_quickfix) {
override fun doFix() {
requestDisablingBatteryOptimization(context, null, NotificationTroubleshootTestManager.REQ_CODE_FIX)
requestDisablingBatteryOptimization(context, activityResultLauncher)
}
}
status = TestStatus.FAILED