From f7e040efd2b5287a0ba15820d8a6ad923a15fc19 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Oct 2020 19:08:00 +0200 Subject: [PATCH] F-Droid compilation --- .../features/settings/troubleshoot/TestAutoStartBoot.kt | 6 ++++-- .../settings/troubleshoot/TestBackgroundRestrictions.kt | 4 +++- .../settings/troubleshoot/TestBatteryOptimization.kt | 7 ++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt index b7834ecf45..e46a07f712 100644 --- a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt +++ b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt @@ -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) { 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 diff --git a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt index 3e053d7fec..abdd696724 100644 --- a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt +++ b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt @@ -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) { context.getSystemService()!!.apply { // Checks if the device is on a metered network if (isActiveNetworkMetered) { diff --git a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt index 510ade0a33..b1eeae6681 100644 --- a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt +++ b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt @@ -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) { 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