Skip to content

Commit

Permalink
Fix InlinedApi lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sabercodic committed Oct 2, 2023
1 parent bb3737b commit 1b52f0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.compose.dialog.ChangelogDialog
import net.mullvad.mullvadvpn.dataproxy.MullvadProblemReport
import net.mullvad.mullvadvpn.di.uiModule
import net.mullvad.mullvadvpn.lib.common.util.SdkUtils.isNotificationPermissionGranted
import net.mullvad.mullvadvpn.lib.common.util.SdkUtils.notificationPermissionIsNotGranted
import net.mullvad.mullvadvpn.lib.endpoint.ApiEndpointConfiguration
import net.mullvad.mullvadvpn.lib.endpoint.getApiEndpointConfigurationExtras
import net.mullvad.mullvadvpn.lib.theme.AppTheme
Expand Down Expand Up @@ -358,7 +358,7 @@ open class MainActivity : FragmentActivity() {
}

private fun checkForNotificationPermission() {
if (isNotificationPermissionGranted().not()) {
if (notificationPermissionIsNotGranted()) {
requestNotificationPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ object SdkUtils {
PackageManager.PERMISSION_GRANTED
}

fun Context.notificationPermissionIsNotGranted(): Boolean {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) &&
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) !=
PackageManager.PERMISSION_GRANTED
}

fun Tile.setSubtitleIfSupported(subtitleText: CharSequence) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
this.subtitle = subtitleText
Expand Down

0 comments on commit 1b52f0a

Please sign in to comment.