Browse Source

Fix lint warnings.

test/jme/compound-poc
Benoit Marty 1 year ago committed by Benoit Marty
parent
commit
aa36398b4e
  1. 8
      libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/system/SystemUtils.kt
  2. 4
      libraries/permissions/impl/src/main/kotlin/io/element/android/libraries/permissions/impl/DefaultPermissionsPresenter.kt

8
libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/system/SystemUtils.kt

@ -16,6 +16,7 @@
package io.element.android.libraries.androidutils.system package io.element.android.libraries.androidutils.system
import android.annotation.SuppressLint
import android.annotation.TargetApi import android.annotation.TargetApi
import android.app.Activity import android.app.Activity
import android.content.ActivityNotFoundException import android.content.ActivityNotFoundException
@ -77,6 +78,7 @@ fun Context.getApplicationLabel(packageName: String): String {
* Note: If the user finally does not grant the permission, PushManager.isBackgroundSyncAllowed() * Note: If the user finally does not grant the permission, PushManager.isBackgroundSyncAllowed()
* will return false and the notification privacy will fallback to "LOW_DETAIL". * will return false and the notification privacy will fallback to "LOW_DETAIL".
*/ */
@SuppressLint("BatteryLife")
fun requestDisablingBatteryOptimization(activity: Activity, activityResultLauncher: ActivityResultLauncher<Intent>) { fun requestDisablingBatteryOptimization(activity: Activity, activityResultLauncher: ActivityResultLauncher<Intent>) {
val intent = Intent() val intent = Intent()
intent.action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS intent.action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
@ -114,9 +116,9 @@ fun startNotificationSettingsIntent(context: Context, activityResultLauncher: Ac
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName) intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
} else { } else {
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS intent.action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
intent.putExtra("app_package", context.packageName) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.putExtra("app_uid", context.applicationInfo?.uid) intent.data = Uri.fromParts("package", context.packageName, null)
} }
activityResultLauncher.launch(intent) activityResultLauncher.launch(intent)
} }

4
libraries/permissions/impl/src/main/kotlin/io/element/android/libraries/permissions/impl/DefaultPermissionsPresenter.kt

@ -58,7 +58,7 @@ class DefaultPermissionsPresenter @AssistedInject constructor(
override fun present(): PermissionsState { override fun present(): PermissionsState {
val localCoroutineScope = rememberCoroutineScope() val localCoroutineScope = rememberCoroutineScope()
// To reset the store: resetStore() // To reset the store: ResetStore()
val isAlreadyDenied: Boolean by permissionsStore val isAlreadyDenied: Boolean by permissionsStore
.isPermissionDenied(permission) .isPermissionDenied(permission)
@ -129,7 +129,7 @@ class DefaultPermissionsPresenter @AssistedInject constructor(
/* /*
@Composable @Composable
private fun resetStore() { private fun ResetStore() {
LaunchedEffect(this@DefaultPermissionsPresenter) { LaunchedEffect(this@DefaultPermissionsPresenter) {
launch { launch {
permissionsStore.resetStore() permissionsStore.resetStore()

Loading…
Cancel
Save