diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml
index 71ccf5b234..ef71c10dd5 100644
--- a/library/ui-strings/src/main/res/values/strings.xml
+++ b/library/ui-strings/src/main/res/values/strings.xml
@@ -635,6 +635,8 @@
${app_name} needs permission to access your microphone to perform audio calls.
${app_name} needs permission to access your camera and your microphone to perform video calls.\n\nPlease allow access on the next pop-ups to be able to make the call.
+
+ ${app_name} needs permission to display notifications. Notifications can display your messages, your invitations, etc.\n\nPlease allow access on the next pop-ups to be able to view notification.
To scan a QR code, you need to allow camera access.
Allow permission to access your contacts.
@@ -854,7 +856,9 @@
System Settings.
Notifications are enabled in the system settings.
Notifications are disabled in the system settings.\nPlease check system settings.
+ ${app_name} needs the permission to show notifications.\nPlease grant the permission.
Open Settings
+ Grant Permission
Account Settings.
Notifications are enabled for your account.
diff --git a/tools/adb/notification.sh b/tools/adb/notification.sh
new file mode 100755
index 0000000000..3c3c76c787
--- /dev/null
+++ b/tools/adb/notification.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+## From https://developer.android.com/develop/ui/views/notifications/notification-permission#test
+
+PACKAGE_NAME=im.vector.app.debug
+
+# App is newly installed on a device that runs Android 13 or higher:
+
+adb shell pm revoke ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS
+adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-set
+adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-fixed
+
+# The user keeps notifications enabled when the app is installed on a device that runs 12L or lower,
+# then the device upgrades to Android 13 or higher:
+
+# adb shell pm grant ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS
+# adb shell pm set-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-set
+# adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-fixed
+
+# The user manually disables notifications when the app is installed on a device that runs 12L or lower,
+# then the device upgrades to Android 13 or higher:
+
+# adb shell pm revoke ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS
+# adb shell pm set-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-set
+# adb shell pm clear-permission-flags ${PACKAGE_NAME} android.permission.POST_NOTIFICATIONS user-fixed
diff --git a/vector-app/src/debug/java/im/vector/app/features/debug/DebugPermissionActivity.kt b/vector-app/src/debug/java/im/vector/app/features/debug/DebugPermissionActivity.kt
index a9be5512e4..2b1b66e672 100644
--- a/vector-app/src/debug/java/im/vector/app/features/debug/DebugPermissionActivity.kt
+++ b/vector-app/src/debug/java/im/vector/app/features/debug/DebugPermissionActivity.kt
@@ -22,6 +22,7 @@ import android.os.Build
import android.widget.Toast
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
+import androidx.core.view.isVisible
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.core.utils.checkPermissions
@@ -46,7 +47,15 @@ class DebugPermissionActivity : VectorBaseActivity {
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ listOf(Manifest.permission.POST_NOTIFICATIONS)
+ } else {
+ emptyList()
+ }
+ }
private var lastPermissions = emptyList()
@@ -77,6 +86,14 @@ class DebugPermissionActivity : VectorBaseActivity= Build.VERSION_CODES.TIRAMISU) {
+ views.notification.setOnClickListener {
+ lastPermissions = listOf(Manifest.permission.POST_NOTIFICATIONS)
+ checkPerm()
+ }
+ } else {
+ views.notification.isVisible = false
+ }
}
private fun checkPerm() {
diff --git a/vector-app/src/debug/res/layout/activity_debug_permission.xml b/vector-app/src/debug/res/layout/activity_debug_permission.xml
index 6340d8faa7..0f1fef0b9b 100644
--- a/vector-app/src/debug/res/layout/activity_debug_permission.xml
+++ b/vector-app/src/debug/res/layout/activity_debug_permission.xml
@@ -30,43 +30,43 @@
android:id="@+id/camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="CAMERA"
- android:textAllCaps="false" />
+ android:text="CAMERA" />
+ android:text="RECORD_AUDIO" />
+ android:text="CAMERA + RECORD_AUDIO" />
+ android:text="WRITE_EXTERNAL_STORAGE" />
+ android:text="READ_EXTERNAL_STORAGE" />
+ android:text="READ_CONTACTS" />
+
+
diff --git a/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt b/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt
index e028ed0988..ce1263c67b 100644
--- a/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt
+++ b/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt
@@ -15,8 +15,6 @@
*/
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
@@ -32,7 +30,7 @@ class TestAutoStartBoot @Inject constructor(
) :
TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
if (vectorPreferences.autoStartOnBoot()) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_service_boot_success)
status = TestStatus.SUCCESS
@@ -42,7 +40,7 @@ class TestAutoStartBoot @Inject constructor(
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_service_boot_quickfix) {
override fun doFix() {
vectorPreferences.setAutoStartOnBoot(true)
- manager?.retry(activityResultLauncher)
+ manager?.retry(testParameters)
}
}
status = TestStatus.FAILED
diff --git a/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt b/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt
index ebd8d07540..a14d3b5c8a 100644
--- a/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt
+++ b/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt
@@ -15,9 +15,7 @@
*/
package im.vector.app.fdroid.features.settings.troubleshoot
-import android.content.Intent
import android.net.ConnectivityManager
-import androidx.activity.result.ActivityResultLauncher
import androidx.core.content.getSystemService
import androidx.core.net.ConnectivityManagerCompat
import androidx.fragment.app.FragmentActivity
@@ -32,7 +30,7 @@ class TestBackgroundRestrictions @Inject constructor(
) :
TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
context.getSystemService()!!.apply {
// Checks if the device is on a metered network
if (isActiveNetworkMetered) {
diff --git a/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt b/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt
index 57bdf721a2..075432c9d2 100644
--- a/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt
+++ b/vector-app/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBatteryOptimization.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.fdroid.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import androidx.fragment.app.FragmentActivity
import im.vector.app.R
import im.vector.app.core.resources.StringProvider
@@ -30,7 +28,7 @@ class TestBatteryOptimization @Inject constructor(
private val stringProvider: StringProvider
) : TroubleshootTest(R.string.settings_troubleshoot_test_battery_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
if (context.isIgnoringBatteryOptimizations()) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_battery_success)
status = TestStatus.SUCCESS
@@ -39,7 +37,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, activityResultLauncher)
+ requestDisablingBatteryOptimization(context, testParameters.activityResultLauncher)
}
}
status = TestStatus.FAILED
diff --git a/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt b/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt
index d6180a9fe8..8e7e4f43cc 100644
--- a/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt
+++ b/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.gplay.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import androidx.fragment.app.FragmentActivity
import com.google.firebase.messaging.FirebaseMessaging
import im.vector.app.R
@@ -36,7 +34,7 @@ class TestFirebaseToken @Inject constructor(
private val fcmHelper: FcmHelper,
) : TroubleshootTest(R.string.settings_troubleshoot_test_fcm_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
status = TestStatus.RUNNING
try {
FirebaseMessaging.getInstance().token
@@ -53,7 +51,7 @@ class TestFirebaseToken @Inject constructor(
"ACCOUNT_MISSING" -> {
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_fcm_failed_account_missing_quick_fix) {
override fun doFix() {
- startAddGoogleAccountIntent(context, activityResultLauncher)
+ startAddGoogleAccountIntent(context, testParameters.activityResultLauncher)
}
}
stringProvider.getString(R.string.settings_troubleshoot_test_fcm_failed_account_missing, errorMsg)
diff --git a/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt b/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt
index e78132908d..3ebcceb3fb 100644
--- a/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt
+++ b/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.gplay.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import androidx.fragment.app.FragmentActivity
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.GoogleApiAvailability
@@ -35,7 +33,7 @@ class TestPlayServices @Inject constructor(
) :
TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
val apiAvailability = GoogleApiAvailability.getInstance()
val resultCode = apiAvailability.isGooglePlayServicesAvailable(context)
if (resultCode == ConnectionResult.SUCCESS) {
diff --git a/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt b/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt
index 840bde77b1..cafc2d65e6 100644
--- a/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt
+++ b/vector-app/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.gplay.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Observer
import androidx.work.WorkInfo
@@ -42,7 +40,7 @@ class TestTokenRegistration @Inject constructor(
) :
TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
// Check if we have a registered pusher for this token
val fcmToken = fcmHelper.getFcmToken() ?: run {
status = TestStatus.FAILED
@@ -66,9 +64,9 @@ class TestTokenRegistration @Inject constructor(
WorkManager.getInstance(context).getWorkInfoByIdLiveData(workId).observe(context, Observer { workInfo ->
if (workInfo != null) {
if (workInfo.state == WorkInfo.State.SUCCEEDED) {
- manager?.retry(activityResultLauncher)
+ manager?.retry(testParameters)
} else if (workInfo.state == WorkInfo.State.FAILED) {
- manager?.retry(activityResultLauncher)
+ manager?.retry(testParameters)
}
}
})
diff --git a/vector/src/main/AndroidManifest.xml b/vector/src/main/AndroidManifest.xml
index f079d3429e..ad15bf4829 100644
--- a/vector/src/main/AndroidManifest.xml
+++ b/vector/src/main/AndroidManifest.xml
@@ -17,6 +17,9 @@
+
+
+
diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt
index 18c9e7e3b9..121436cd22 100644
--- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt
+++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt
@@ -48,6 +48,7 @@ import im.vector.app.core.platform.VectorMenuProvider
import im.vector.app.core.pushers.FcmHelper
import im.vector.app.core.pushers.PushersManager
import im.vector.app.core.pushers.UnifiedPushHelper
+import im.vector.app.core.utils.registerForPermissionsResult
import im.vector.app.core.utils.startSharePlainTextIntent
import im.vector.app.databinding.ActivityHomeBinding
import im.vector.app.features.MainActivity
@@ -143,6 +144,7 @@ class HomeActivity :
@Inject lateinit var fcmHelper: FcmHelper
@Inject lateinit var nightlyProxy: NightlyProxy
@Inject lateinit var disclaimerDialog: DisclaimerDialog
+ @Inject lateinit var notificationPermissionManager: NotificationPermissionManager
private var isNewAppLayoutEnabled: Boolean = false // delete once old app layout is removed
@@ -172,6 +174,10 @@ class HomeActivity :
}
}
+ private val postPermissionLauncher = registerForPermissionsResult { _, _ ->
+ // Nothing to do with the result.
+ }
+
private val fragmentLifecycleCallbacks = object : FragmentManager.FragmentLifecycleCallbacks() {
override fun onFragmentResumed(fm: FragmentManager, f: Fragment) {
if (f is MatrixToBottomSheet) {
@@ -273,6 +279,7 @@ class HomeActivity :
}
is HomeActivityViewEvents.OnCrossSignedInvalidated -> handleCrossSigningInvalidated(it)
HomeActivityViewEvents.ShowAnalyticsOptIn -> handleShowAnalyticsOptIn()
+ HomeActivityViewEvents.ShowNotificationDialog -> handleShowNotificationDialog()
HomeActivityViewEvents.ShowReleaseNotes -> handleShowReleaseNotes()
HomeActivityViewEvents.NotifyUserForThreadsMigration -> handleNotifyUserForThreadsMigration()
is HomeActivityViewEvents.MigrateThreads -> migrateThreadsIfNeeded(it.checkSession)
@@ -288,6 +295,10 @@ class HomeActivity :
homeActivityViewModel.handle(HomeActivityViewActions.ViewStarted)
}
+ private fun handleShowNotificationDialog() {
+ notificationPermissionManager.eventuallyRequestPermission(this, postPermissionLauncher)
+ }
+
private fun handleShowReleaseNotes() {
startActivity(Intent(this, ReleaseNotesActivity::class.java))
}
diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt
index 4147cf7186..e548fdb2f3 100644
--- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt
+++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt
@@ -31,6 +31,7 @@ sealed interface HomeActivityViewEvents : VectorViewEvents {
data class OnCrossSignedInvalidated(val userItem: MatrixItem.UserItem) : HomeActivityViewEvents
object PromptToEnableSessionPush : HomeActivityViewEvents
object ShowAnalyticsOptIn : HomeActivityViewEvents
+ object ShowNotificationDialog : HomeActivityViewEvents
object ShowReleaseNotes : HomeActivityViewEvents
object NotifyUserForThreadsMigration : HomeActivityViewEvents
data class MigrateThreads(val checkSession: Boolean) : HomeActivityViewEvents
diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt
index 9157d81333..749292924e 100644
--- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt
+++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt
@@ -143,6 +143,8 @@ class HomeActivityViewModel @AssistedInject constructor(
.onEach { didAskUser ->
if (!didAskUser) {
_viewEvents.post(HomeActivityViewEvents.ShowAnalyticsOptIn)
+ } else {
+ _viewEvents.post(HomeActivityViewEvents.ShowNotificationDialog)
}
}
.launchIn(viewModelScope)
@@ -162,6 +164,8 @@ class HomeActivityViewModel @AssistedInject constructor(
// do nothing
}
}
+ } else {
+ _viewEvents.post(HomeActivityViewEvents.ShowNotificationDialog)
}
}
diff --git a/vector/src/main/java/im/vector/app/features/home/NotificationPermissionManager.kt b/vector/src/main/java/im/vector/app/features/home/NotificationPermissionManager.kt
new file mode 100644
index 0000000000..bb75730377
--- /dev/null
+++ b/vector/src/main/java/im/vector/app/features/home/NotificationPermissionManager.kt
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2022 New Vector Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package im.vector.app.features.home
+
+import android.Manifest
+import android.app.Activity
+import android.content.pm.PackageManager
+import android.os.Build
+import androidx.activity.result.ActivityResultLauncher
+import androidx.annotation.RequiresApi
+import androidx.core.content.ContextCompat
+import im.vector.app.R
+import im.vector.app.core.utils.checkPermissions
+import im.vector.app.features.settings.VectorPreferences
+import org.matrix.android.sdk.api.util.BuildVersionSdkIntProvider
+import javax.inject.Inject
+
+class NotificationPermissionManager @Inject constructor(
+ private val sdkIntProvider: BuildVersionSdkIntProvider,
+ private val vectorPreferences: VectorPreferences,
+) {
+
+ fun isPermissionGranted(activity: Activity): Boolean {
+ return if (sdkIntProvider.isAtLeast(Build.VERSION_CODES.TIRAMISU)) {
+ ContextCompat.checkSelfPermission(
+ activity,
+ Manifest.permission.POST_NOTIFICATIONS
+ ) == PackageManager.PERMISSION_GRANTED
+ } else {
+ // No notification permission management before API 33.
+ true
+ }
+ }
+
+ fun eventuallyRequestPermission(
+ activity: Activity,
+ requestPermissionLauncher: ActivityResultLauncher>,
+ showRationale: Boolean = true,
+ ignorePreference: Boolean = false,
+ ) {
+ if (!sdkIntProvider.isAtLeast(Build.VERSION_CODES.TIRAMISU)) return
+ if (!vectorPreferences.areNotificationEnabledForDevice() && !ignorePreference) return
+ checkPermissions(
+ listOf(Manifest.permission.POST_NOTIFICATIONS),
+ activity,
+ activityResultLauncher = requestPermissionLauncher,
+ if (showRationale) R.string.permissions_rationale_msg_notification else 0
+ )
+ }
+
+ @RequiresApi(33)
+ fun askPermission(requestPermissionLauncher: ActivityResultLauncher>) {
+ requestPermissionLauncher.launch(
+ arrayOf(Manifest.permission.POST_NOTIFICATIONS)
+ )
+ }
+}
diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceFragment.kt
index b1e32c05d1..01eb277f27 100644
--- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceFragment.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceFragment.kt
@@ -43,9 +43,12 @@ import im.vector.app.core.pushers.UnifiedPushHelper
import im.vector.app.core.services.GuardServiceStarter
import im.vector.app.core.utils.combineLatest
import im.vector.app.core.utils.isIgnoringBatteryOptimizations
+import im.vector.app.core.utils.registerForPermissionsResult
import im.vector.app.core.utils.requestDisablingBatteryOptimization
+import im.vector.app.core.utils.startNotificationSettingsIntent
import im.vector.app.features.VectorFeatures
import im.vector.app.features.analytics.plan.MobileScreen
+import im.vector.app.features.home.NotificationPermissionManager
import im.vector.app.features.notifications.NotificationUtils
import im.vector.app.features.settings.BackgroundSyncMode
import im.vector.app.features.settings.BackgroundSyncModeChooserDialog
@@ -76,12 +79,24 @@ class VectorSettingsNotificationPreferenceFragment :
@Inject lateinit var vectorPreferences: VectorPreferences
@Inject lateinit var guardServiceStarter: GuardServiceStarter
@Inject lateinit var vectorFeatures: VectorFeatures
+ @Inject lateinit var notificationPermissionManager: NotificationPermissionManager
override var titleRes: Int = R.string.settings_notifications
override val preferenceXmlRes = R.xml.vector_settings_notifications
private var interactionListener: VectorSettingsFragmentInteractionListener? = null
+ private val notificationStartForActivityResult = registerStartForActivityResult { _ ->
+ // No op
+ }
+
+ private val postPermissionLauncher = registerForPermissionsResult { _, deniedPermanently ->
+ if (deniedPermanently) {
+ // Open System setting, to give a chance to the user to enable notification. Sometimes the permission dialog is not displayed
+ startNotificationSettingsIntent(requireContext(), notificationStartForActivityResult)
+ }
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
analyticsScreenName = MobileScreen.ScreenName.SettingsNotifications
@@ -118,6 +133,12 @@ class VectorSettingsNotificationPreferenceFragment :
findPreference(VectorPreferences.SETTINGS_NOTIFICATION_METHOD_KEY)
?.summary = unifiedPushHelper.getCurrentDistributorName()
}
+ notificationPermissionManager.eventuallyRequestPermission(
+ requireActivity(),
+ postPermissionLauncher,
+ showRationale = false,
+ ignorePreference = true
+ )
} else {
unifiedPushHelper.unregister(pushersManager)
session.pushersService().refreshPushers()
diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt
index 9fc55d14aa..c5d15e54e5 100644
--- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt
@@ -34,6 +34,8 @@ import im.vector.app.R
import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.registerStartForActivityResult
import im.vector.app.core.platform.VectorBaseFragment
+import im.vector.app.core.utils.registerForPermissionsResult
+import im.vector.app.core.utils.startNotificationSettingsIntent
import im.vector.app.databinding.FragmentSettingsNotificationsTroubleshootBinding
import im.vector.app.features.notifications.NotificationActionIds
import im.vector.app.features.push.NotificationTroubleshootTestManagerFactory
@@ -76,7 +78,7 @@ class VectorSettingsNotificationsTroubleshootFragment :
}
views.troubleshootRunButton.debouncedClicks {
- testManager?.retry(testStartForActivityResult)
+ testManager?.retry(TroubleshootTest.TestParameters(testStartForActivityResult, testStartForPermissionResult))
}
startUI()
}
@@ -125,7 +127,7 @@ class VectorSettingsNotificationsTroubleshootFragment :
}
}
views.troubleshootTestRecyclerView.adapter = testManager?.adapter
- testManager?.runDiagnostic(testStartForActivityResult)
+ testManager?.runDiagnostic(TroubleshootTest.TestParameters(testStartForActivityResult, testStartForPermissionResult))
}
override fun onDestroyView() {
@@ -139,8 +141,17 @@ class VectorSettingsNotificationsTroubleshootFragment :
}
}
+ private val testStartForPermissionResult = registerForPermissionsResult { allGranted, deniedPermanently ->
+ if (allGranted) {
+ retry()
+ } else if (deniedPermanently) {
+ // Open System setting
+ startNotificationSettingsIntent(requireContext(), testStartForActivityResult)
+ }
+ }
+
private fun retry() {
- testManager?.retry(testStartForActivityResult)
+ testManager?.retry(TroubleshootTest.TestParameters(testStartForActivityResult, testStartForPermissionResult))
}
override fun onDetach() {
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootTestManager.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootTestManager.kt
index 7e7ca57243..3419241c39 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootTestManager.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootTestManager.kt
@@ -15,10 +15,8 @@
*/
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
import android.os.Handler
import android.os.Looper
-import androidx.activity.result.ActivityResultLauncher
import androidx.fragment.app.Fragment
import kotlin.properties.Delegates
@@ -50,7 +48,7 @@ class NotificationTroubleshootTestManager(val fragment: Fragment) {
test.manager = this
}
- fun runDiagnostic(activityResultLauncher: ActivityResultLauncher) {
+ fun runDiagnostic(testParameters: TroubleshootTest.TestParameters) {
if (isCancelled) return
currentTestIndex = 0
val handler = Handler(Looper.getMainLooper())
@@ -69,7 +67,7 @@ class NotificationTroubleshootTestManager(val fragment: Fragment) {
// Cosmetic: Start with a small delay for UI/UX reason (better animation effect) for non async tests
handler.postDelayed({
if (fragment.isAdded) {
- troubleshootTest.perform(activityResultLauncher)
+ troubleshootTest.perform(testParameters)
}
}, 600)
} else {
@@ -81,18 +79,18 @@ class NotificationTroubleshootTestManager(val fragment: Fragment) {
}
}
if (fragment.isAdded) {
- testList.firstOrNull()?.perform(activityResultLauncher)
+ testList.firstOrNull()?.perform(testParameters)
}
}
- fun retry(activityResultLauncher: ActivityResultLauncher) {
+ fun retry(testParameters: TroubleshootTest.TestParameters) {
testList.forEach {
it.cancel()
it.description = null
it.quickFix = null
it.status = TroubleshootTest.TestStatus.NOT_STARTED
}
- runDiagnostic(activityResultLauncher)
+ runDiagnostic(testParameters)
}
fun hasQuickFix(): Boolean {
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt
index e8a92c9e3f..5032c97935 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.resources.StringProvider
@@ -38,7 +36,7 @@ class TestAccountSettings @Inject constructor(
) :
TroubleshootTest(R.string.settings_troubleshoot_test_account_settings_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
val session = activeSessionHolder.getSafeActiveSession() ?: return
val defaultRule = session.pushRuleService().getPushRules().getAllRules()
.find { it.ruleId == RuleIds.RULE_ID_DISABLE_ALL }
@@ -59,7 +57,7 @@ class TestAccountSettings @Inject constructor(
session.pushRuleService().updatePushRuleEnableStatus(RuleKind.OVERRIDE, defaultRule, !defaultRule.enabled)
}
withContext(Dispatchers.Main) {
- manager?.retry(activityResultLauncher)
+ manager?.retry(testParameters)
}
}
}
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAvailableUnifiedPushDistributors.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAvailableUnifiedPushDistributors.kt
index 89e7d8c204..e6fa59f597 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAvailableUnifiedPushDistributors.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAvailableUnifiedPushDistributors.kt
@@ -16,8 +16,6 @@
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.pushers.FcmHelper
import im.vector.app.core.pushers.UnifiedPushHelper
@@ -30,7 +28,7 @@ class TestAvailableUnifiedPushDistributors @Inject constructor(
private val fcmHelper: FcmHelper,
) : TroubleshootTest(R.string.settings_troubleshoot_test_distributors_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
val distributors = unifiedPushHelper.getExternalDistributors()
description = if (distributors.isEmpty()) {
stringProvider.getString(
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestCurrentUnifiedPushDistributor.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestCurrentUnifiedPushDistributor.kt
index d43fb1bfe3..bc291725fd 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestCurrentUnifiedPushDistributor.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestCurrentUnifiedPushDistributor.kt
@@ -16,8 +16,6 @@
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.pushers.UnifiedPushHelper
import im.vector.app.core.resources.StringProvider
@@ -28,7 +26,7 @@ class TestCurrentUnifiedPushDistributor @Inject constructor(
private val stringProvider: StringProvider,
) : TroubleshootTest(R.string.settings_troubleshoot_test_current_distributor_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
description = stringProvider.getString(
R.string.settings_troubleshoot_test_current_distributor,
unifiedPushHelper.getCurrentDistributorName()
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt
index e18c6ce4e1..a0be2a7077 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.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
@@ -31,7 +29,7 @@ class TestDeviceSettings @Inject constructor(
) :
TroubleshootTest(R.string.settings_troubleshoot_test_device_settings_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
if (vectorPreferences.areNotificationEnabledForDevice()) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_device_settings_success)
quickFix = null
@@ -40,7 +38,7 @@ class TestDeviceSettings @Inject constructor(
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_device_settings_quickfix) {
override fun doFix() {
vectorPreferences.setNotificationEnabledForDevice(true)
- manager?.retry(activityResultLauncher)
+ manager?.retry(testParameters)
}
}
description = stringProvider.getString(R.string.settings_troubleshoot_test_device_settings_failed)
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestEndpointAsTokenRegistration.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestEndpointAsTokenRegistration.kt
index 78eb372fef..3bbff0f2fe 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestEndpointAsTokenRegistration.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestEndpointAsTokenRegistration.kt
@@ -16,8 +16,6 @@
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Observer
import androidx.work.WorkInfo
@@ -38,7 +36,7 @@ class TestEndpointAsTokenRegistration @Inject constructor(
private val unifiedPushHelper: UnifiedPushHelper,
) : TroubleshootTest(R.string.settings_troubleshoot_test_endpoint_registration_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
// Check if we have a registered pusher for this token
val endpoint = unifiedPushHelper.getEndpointOrToken() ?: run {
status = TestStatus.FAILED
@@ -66,9 +64,9 @@ class TestEndpointAsTokenRegistration @Inject constructor(
WorkManager.getInstance(context).getWorkInfoByIdLiveData(workId).observe(context, Observer { workInfo ->
if (workInfo != null) {
if (workInfo.state == WorkInfo.State.SUCCEEDED) {
- manager?.retry(activityResultLauncher)
+ manager?.retry(testParameters)
} else if (workInfo.state == WorkInfo.State.FAILED) {
- manager?.retry(activityResultLauncher)
+ manager?.retry(testParameters)
}
}
})
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt
index 22fab0cad4..403c4a02c9 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt
@@ -16,8 +16,6 @@
package im.vector.app.features.settings.troubleshoot
import android.content.Context
-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.core.utils.startNotificationSettingsIntent
@@ -34,14 +32,14 @@ class TestNotification @Inject constructor(
) :
TroubleshootTest(R.string.settings_troubleshoot_test_notification_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
// Display the notification right now
notificationUtils.displayDiagnosticNotification()
description = stringProvider.getString(R.string.settings_troubleshoot_test_notification_notice)
quickFix = object : TroubleshootQuickFix(R.string.open_settings) {
override fun doFix() {
- startNotificationSettingsIntent(context, activityResultLauncher)
+ startNotificationSettingsIntent(context, testParameters.activityResultLauncher)
}
}
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushFromPushGateway.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushFromPushGateway.kt
index cf2bf3d5f1..1fec8691d7 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushFromPushGateway.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushFromPushGateway.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.error.ErrorFormatter
@@ -43,7 +41,7 @@ class TestPushFromPushGateway @Inject constructor(
private var action: Job? = null
private var pushReceived: Boolean = false
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
pushReceived = false
action = activeSessionHolder.getActiveSession().coroutineScope.launch {
val result = runCatching { pushersManager.testPush() }
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt
index 837b4952f0..0fe6ed3ad0 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt
@@ -15,8 +15,6 @@
*/
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.resources.StringProvider
@@ -39,7 +37,7 @@ class TestPushRulesSettings @Inject constructor(
RuleIds.RULE_ID_ALL_OTHER_MESSAGES_ROOMS
)
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
val session = activeSessionHolder.getSafeActiveSession() ?: return
val pushRules = session.pushRuleService().getPushRules().getAllRules()
var oneOrMoreRuleIsOff = false
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt
index 2c73bef701..0f362d5019 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt
@@ -15,34 +15,44 @@
*/
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import androidx.core.app.NotificationManagerCompat
import androidx.fragment.app.FragmentActivity
import im.vector.app.R
import im.vector.app.core.resources.StringProvider
import im.vector.app.core.utils.startNotificationSettingsIntent
+import im.vector.app.features.home.NotificationPermissionManager
import javax.inject.Inject
/**
* Checks if notifications are enable in the system settings for this app.
+ * On Android 13, it will check for the notification permission.
*/
class TestSystemSettings @Inject constructor(
private val context: FragmentActivity,
- private val stringProvider: StringProvider
-) :
- TroubleshootTest(R.string.settings_troubleshoot_test_system_settings_title) {
+ private val stringProvider: StringProvider,
+ private val notificationPermissionManager: NotificationPermissionManager,
+) : TroubleshootTest(R.string.settings_troubleshoot_test_system_settings_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
if (NotificationManagerCompat.from(context).areNotificationsEnabled()) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_system_settings_success)
quickFix = null
status = TestStatus.SUCCESS
} else {
- description = stringProvider.getString(R.string.settings_troubleshoot_test_system_settings_failed)
- quickFix = object : TroubleshootQuickFix(R.string.open_settings) {
- override fun doFix() {
- startNotificationSettingsIntent(context, activityResultLauncher)
+ if (notificationPermissionManager.isPermissionGranted(context)) {
+ description = stringProvider.getString(R.string.settings_troubleshoot_test_system_settings_failed)
+ quickFix = object : TroubleshootQuickFix(R.string.open_settings) {
+ override fun doFix() {
+ startNotificationSettingsIntent(context, testParameters.activityResultLauncher)
+ }
+ }
+ } else {
+ // In this case, we can ask for user permission
+ description = stringProvider.getString(R.string.settings_troubleshoot_test_system_settings_permission_failed)
+ quickFix = object : TroubleshootQuickFix(R.string.grant_permission) {
+ override fun doFix() {
+ notificationPermissionManager.askPermission(testParameters.permissionResultLauncher)
+ }
}
}
status = TestStatus.FAILED
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushEndpoint.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushEndpoint.kt
index a29d1ad812..632f145c01 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushEndpoint.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushEndpoint.kt
@@ -16,8 +16,6 @@
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.pushers.UnifiedPushHelper
import im.vector.app.core.resources.StringProvider
@@ -28,7 +26,7 @@ class TestUnifiedPushEndpoint @Inject constructor(
private val unifiedPushHelper: UnifiedPushHelper,
) : TroubleshootTest(R.string.settings_troubleshoot_test_current_endpoint_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
val endpoint = unifiedPushHelper.getPrivacyFriendlyUpEndpoint()
if (endpoint != null) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_current_endpoint_success, endpoint)
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushGateway.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushGateway.kt
index 19a4fd188f..52d5ad35a3 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushGateway.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestUnifiedPushGateway.kt
@@ -16,8 +16,6 @@
package im.vector.app.features.settings.troubleshoot
-import android.content.Intent
-import androidx.activity.result.ActivityResultLauncher
import im.vector.app.R
import im.vector.app.core.pushers.UnifiedPushHelper
import im.vector.app.core.resources.StringProvider
@@ -28,7 +26,7 @@ class TestUnifiedPushGateway @Inject constructor(
private val stringProvider: StringProvider
) : TroubleshootTest(R.string.settings_troubleshoot_test_current_gateway_title) {
- override fun perform(activityResultLauncher: ActivityResultLauncher) {
+ override fun perform(testParameters: TestParameters) {
description = stringProvider.getString(
R.string.settings_troubleshoot_test_current_gateway,
unifiedPushHelper.getPushGateway()
diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt
index 76ba2378a0..1e12f2e314 100644
--- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt
@@ -22,6 +22,11 @@ import kotlin.properties.Delegates
abstract class TroubleshootTest(@StringRes val titleResId: Int) {
+ data class TestParameters(
+ val activityResultLauncher: ActivityResultLauncher,
+ val permissionResultLauncher: ActivityResultLauncher>
+ )
+
enum class TestStatus {
NOT_STARTED,
RUNNING,
@@ -40,7 +45,7 @@ abstract class TroubleshootTest(@StringRes val titleResId: Int) {
var manager: NotificationTroubleshootTestManager? = null
- abstract fun perform(activityResultLauncher: ActivityResultLauncher)
+ abstract fun perform(testParameters: TestParameters)
fun isFinished(): Boolean = (status == TestStatus.FAILED || status == TestStatus.SUCCESS)