Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump org.jlleitschuh.gradle.ktlint from 11.1.0 to 11.2.0 #3334

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ private const val FATAL_CRASH_FILE = "/fatalcrash/last_crash"

fun initCrashReporting(context: Context, enabled: Boolean) {
// Don't init on debug builds or when disabled
if (!shouldEnableCrashHandling(enabled))
if (!shouldEnableCrashHandling(enabled)) {
return
}

SentryAndroid.init(context) { options ->
options.isEnableAutoSessionTracking = true
Expand Down Expand Up @@ -66,8 +67,9 @@ fun initCrashReporting(context: Context, enabled: Boolean) {
}

suspend fun getLatestFatalCrash(context: Context, enabled: Boolean): String? = withContext(Dispatchers.IO) {
if (!shouldEnableCrashHandling(enabled))
if (!shouldEnableCrashHandling(enabled)) {
return@withContext null
}

var toReturn: String? = null
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class HighAccuracyLocationService : Service() {

@Synchronized
fun stopService(context: Context) {

Log.d(TAG, "Try stopping high accuracy location service...")
LAUNCHER.stopService(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ class MatterCommissioningViewModel @Inject constructor(

val coreSupport = matterManager.coreSupportsCommissioning(id)
step =
if (coreSupport) CommissioningFlowStep.Confirmation
else CommissioningFlowStep.NotSupported
if (coreSupport) {
CommissioningFlowStep.Confirmation
} else {
CommissioningFlowStep.NotSupported
}
}
}

Expand All @@ -101,8 +104,11 @@ class MatterCommissioningViewModel @Inject constructor(

val result = matterManager.commissionDevice(code, serverId)
step =
if (result?.success == true) CommissioningFlowStep.Success
else CommissioningFlowStep.Failure(result?.errorCode)
if (result?.success == true) {
CommissioningFlowStep.Success
} else {
CommissioningFlowStep.Failure(result?.errorCode)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class ActivitySensorManager : BroadcastReceiver(), SensorManager {
}

override fun onReceive(context: Context, intent: Intent) {

when (intent.action) {
ACTION_UPDATE_ACTIVITY -> handleActivityUpdate(intent, context)
ACTION_SLEEP_ACTIVITY -> handleSleepUpdate(intent, context)
Expand Down Expand Up @@ -100,8 +99,9 @@ class ActivitySensorManager : BroadcastReceiver(), SensorManager {
val result = ActivityRecognitionResult.extractResult(intent)
var probActivity = result?.let { typeToString(it.mostProbableActivity) }

if (probActivity == "on_foot")
if (probActivity == "on_foot") {
probActivity = result?.let { getSubActivity(it) }
}

if (probActivity != null && result != null) {
onSensorUpdated(
Expand Down Expand Up @@ -274,7 +274,6 @@ class ActivitySensorManager : BroadcastReceiver(), SensorManager {
}

private fun getSensorIcon(activity: String): String {

return when (activity) {
"in_vehicle" -> "mdi:car"
"on_bicycle" -> "mdi:bike"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class AndroidAutoSensorManager : SensorManager, Observer<Int> {
get() = commonR.string.sensor_name_android_auto

override suspend fun getAvailableSensors(context: Context): List<SensorManager.BasicSensor> {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
listOf(androidAutoConnected)
else
} else {
emptyList()
}
}

override fun requiredPermissions(sensorId: String): Array<String> {
Expand Down Expand Up @@ -85,7 +86,7 @@ class AndroidAutoSensorManager : SensorManager, Observer<Int> {
androidAutoConnected.statelessIcon,
mapOf(
"connection_type" to typeString
),
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ class LocationSensorManager : LocationSensorManagerBase() {
when (command) {
DeviceCommandData.TURN_ON, DeviceCommandData.TURN_OFF, MessagingManager.FORCE_ON -> {
var turnOn = command != DeviceCommandData.TURN_OFF
if (turnOn) Log.d(TAG, "Forcing of high accuracy mode enabled")
else Log.d(TAG, "Forcing of high accuracy mode disabled")
if (turnOn) {
Log.d(TAG, "Forcing of high accuracy mode enabled")
} else {
Log.d(TAG, "Forcing of high accuracy mode disabled")
}
forceHighAccuracyModeOn = turnOn
forceHighAccuracyModeOff = false
setHighAccuracyModeSetting(latestContext, turnOn)
Expand All @@ -219,8 +222,9 @@ class LocationSensorManager : LocationSensorManagerBase() {
}

MessagingManager.HIGH_ACCURACY_SET_UPDATE_INTERVAL -> {
if (lastHighAccuracyMode)
if (lastHighAccuracyMode) {
restartHighAccuracyService(getHighAccuracyModeIntervalSetting(latestContext))
}
}
}
}
Expand Down Expand Up @@ -311,7 +315,6 @@ class LocationSensorManager : LocationSensorManagerBase() {
if (highAccuracyModeEnabled != lastHighAccuracyMode ||
updateIntervalHighAccuracySeconds != lastHighAccuracyUpdateInterval
) {

if (highAccuracyModeEnabled) {
Log.d(TAG, "High accuracy mode parameters changed. Enable high accuracy mode.")
if (updateIntervalHighAccuracySeconds != lastHighAccuracyUpdateInterval) {
Expand Down Expand Up @@ -416,7 +419,6 @@ class LocationSensorManager : LocationSensorManagerBase() {
}

private fun getHighAccuracyModeState(): Boolean {

var highAccuracyMode = getHighAccuracyModeSetting()

if (!highAccuracyMode) return false
Expand Down Expand Up @@ -447,7 +449,6 @@ class LocationSensorManager : LocationSensorManagerBase() {
}

private fun shouldEnableHighAccuracyMode(): Boolean {

val highAccuracyModeBTDevicesSetting = getSetting(
latestContext,
backgroundLocation,
Expand Down Expand Up @@ -485,8 +486,9 @@ class LocationSensorManager : LocationSensorManagerBase() {
if (foundDevices.isNotEmpty()) {
highAccuracyModeBTDevices.remove(it)
foundDevices.forEach { btDevice ->
if (!highAccuracyModeBTDevices.contains(btDevice.address))
if (!highAccuracyModeBTDevices.contains(btDevice.address)) {
highAccuracyModeBTDevices.add(btDevice.address)
}
}
updatedBtDeviceNames = true
}
Expand All @@ -506,8 +508,11 @@ class LocationSensorManager : LocationSensorManagerBase() {
btDevConnected = bluetoothDevices.any { it.connected && highAccuracyModeBTDevices.contains(it.address) }

if (!forceHighAccuracyModeOn && !forceHighAccuracyModeOff) {
if (!btDevConnected) Log.d(TAG, "High accuracy mode disabled, because defined ($highAccuracyModeBTDevices) bluetooth device(s) not connected (Connected devices: $bluetoothDevices)")
else Log.d(TAG, "High accuracy mode enabled, because defined ($highAccuracyModeBTDevices) bluetooth device(s) connected (Connected devices: $bluetoothDevices)")
if (!btDevConnected) {
Log.d(TAG, "High accuracy mode disabled, because defined ($highAccuracyModeBTDevices) bluetooth device(s) not connected (Connected devices: $bluetoothDevices)")
} else {
Log.d(TAG, "High accuracy mode enabled, because defined ($highAccuracyModeBTDevices) bluetooth device(s) connected (Connected devices: $bluetoothDevices)")
}
}
}

Expand All @@ -524,8 +529,11 @@ class LocationSensorManager : LocationSensorManagerBase() {
inZone = zoneExpEntered || zoneExited

if (!forceHighAccuracyModeOn && !forceHighAccuracyModeOff) {
if (!inZone) Log.d(TAG, "High accuracy mode disabled, because not in zone $highAccuracyExpZones")
else Log.d(TAG, "High accuracy mode enabled, because in zone $highAccuracyExpZones")
if (!inZone) {
Log.d(TAG, "High accuracy mode disabled, because not in zone $highAccuracyExpZones")
} else {
Log.d(TAG, "High accuracy mode enabled, because in zone $highAccuracyExpZones")
}
}
}

Expand Down Expand Up @@ -572,11 +580,14 @@ class LocationSensorManager : LocationSensorManagerBase() {
settingName = SETTING_SEND_LOCATION_AS,
settingType = SensorSettingType.LIST,
entries = listOf(
SEND_LOCATION_AS_EXACT, SEND_LOCATION_AS_ZONE_ONLY
SEND_LOCATION_AS_EXACT,
SEND_LOCATION_AS_ZONE_ONLY
),
default = SEND_LOCATION_AS_EXACT
)
} else SEND_LOCATION_AS_EXACT
} else {
SEND_LOCATION_AS_EXACT
}
}

private fun removeAllLocationUpdateRequests() {
Expand All @@ -590,7 +601,9 @@ class LocationSensorManager : LocationSensorManagerBase() {
Log.d(TAG, "Removing background location requests.")
val backgroundIntent = getLocationUpdateIntent(false)
fusedLocationProviderClient?.removeLocationUpdates(backgroundIntent)
} else Log.d(TAG, "Cannot remove background location requests. Location provider is not set.")
} else {
Log.d(TAG, "Cannot remove background location requests. Location provider is not set.")
}
}

private fun removeGeofenceUpdateRequests() {
Expand All @@ -601,7 +614,9 @@ class LocationSensorManager : LocationSensorManagerBase() {
geofenceRegistered.clear()
lastEnteredGeoZones.clear()
lastExitedGeoZones.clear()
} else Log.d(TAG, "Cannot remove geofence location requests. Geofence provider is not set.")
} else {
Log.d(TAG, "Cannot remove geofence location requests. Geofence provider is not set.")
}
}

private fun requestLocationUpdates() {
Expand Down Expand Up @@ -1148,8 +1163,9 @@ class LocationSensorManager : LocationSensorManagerBase() {
context: Context
) {
latestContext = context
if (isEnabled(context, zoneLocation) || isEnabled(context, backgroundLocation))
if (isEnabled(context, zoneLocation) || isEnabled(context, backgroundLocation)) {
setupLocationTracking()
}
val sensorDao = AppDatabase.getInstance(latestContext).sensorDao()
val sensorSetting = sensorDao.getSettings(singleAccurateLocation.id)
val includeSensorUpdate = sensorSetting.firstOrNull { it.name == SETTING_INCLUDE_SENSOR_UPDATE }?.value ?: "false"
Expand All @@ -1161,7 +1177,8 @@ class LocationSensorManager : LocationSensorManagerBase() {
}
)
}
} else
} else {
sensorDao.add(SensorSetting(singleAccurateLocation.id, SETTING_INCLUDE_SENSOR_UPDATE, "false", SensorSettingType.TOGGLE))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class SettingsWearActivity : AppCompatActivity(), CapabilityClient.OnCapabilityC
}

private suspend fun findWearDevicesWithApp() {

try {
val capabilityInfo = capabilityClient
.getCapability(CAPABILITY_WEAR_APP, CapabilityClient.FILTER_ALL)
Expand All @@ -135,7 +134,6 @@ class SettingsWearActivity : AppCompatActivity(), CapabilityClient.OnCapabilityC
}

private suspend fun findAllWearDevices() {

try {
val connectedNodes = nodeClient.connectedNodes.await()

Expand All @@ -151,7 +149,6 @@ class SettingsWearActivity : AppCompatActivity(), CapabilityClient.OnCapabilityC
}

private fun updateUI() {

val wearNodesWithApp = wearNodesWithApp
val allConnectedNodes = allConnectedNodes

Expand Down Expand Up @@ -185,7 +182,6 @@ class SettingsWearActivity : AppCompatActivity(), CapabilityClient.OnCapabilityC
}

private fun openPlayStoreOnWearDevicesWithoutApp() {

val wearNodesWithApp = wearNodesWithApp ?: return
val allConnectedNodes = allConnectedNodes ?: return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object SettingsWearDetection {
} catch (e: Exception) {
if (e is ApiException && e.statusCode == CommonStatusCodes.API_NOT_CONNECTED && e.message?.contains("API_UNAVAILABLE") == true) {
// Wearable.API is not available on this device.
Log.d(TAG, "API unavailable for discovering nodes (no Wear)",)
Log.d(TAG, "API unavailable for discovering nodes (no Wear)")
} else {
Log.e(TAG, "Exception while discovering nodes", e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ class SettingsWearViewModel @Inject constructor(
Log.e(TAG, "Exception while rendering template", e)
// JsonMappingException suggests that template is not a String (= error)
templateTileContentRendered.value = getApplication<Application>().getString(
if (e.cause is JsonMappingException) commonR.string.template_error
else commonR.string.template_render_error
if (e.cause is JsonMappingException) {
commonR.string.template_error
} else {
commonR.string.template_render_error
}
)
}
}
Expand All @@ -136,10 +139,11 @@ class SettingsWearViewModel @Inject constructor(
}

fun onEntitySelected(checked: Boolean, entityId: String) {
if (checked)
if (checked) {
favoriteEntityIds.add(entityId)
else
} else {
favoriteEntityIds.remove(entityId)
}
sendHomeFavorites(favoriteEntityIds.toList())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class SettingsWearMainView : AppCompatActivity() {
if (result != null) {
val (url, authCode, deviceName, deviceTrackingEnabled, _) = result
settingsWearViewModel.sendAuthToWear(url, authCode, deviceName, deviceTrackingEnabled, true)
} else
} else {
Log.e(TAG, "onOnboardingComplete: Activity result returned null intent data")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class EntityGridVehicleScreen(
carContext: CarContext,
val integrationRepository: IntegrationRepository,
val title: String,
val entitiesFlow: Flow<List<Entity<*>>>,
val entitiesFlow: Flow<List<Entity<*>>>
) : Screen(carContext) {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ class HaCarAppService : CarAppService() {
serverManager.integrationRepository(id).getEntities()
?.associate { it.entityId to it }
?.toMutableMap()
} else null
} else {
null
}
if (entities != null) {
allEntities.emit(entities.toImmutableMap())
serverManager.integrationRepository(id).getEntityUpdates()?.collect { entity ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ class MainVehicleScreen(
"lock" to commonR.string.locks,
"scene" to commonR.string.scenes,
"script" to commonR.string.scripts,
"switch" to commonR.string.switches,
"switch" to commonR.string.switches
)
private val SUPPORTED_DOMAINS = SUPPORTED_DOMAINS_WITH_STRING.keys

private val MAP_DOMAINS = listOf(
"device_tracker",
"person",
"sensor",
"zone",
"zone"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import io.homeassistant.companion.android.common.R as commonR
class MapVehicleScreen(
carContext: CarContext,
val integrationRepository: IntegrationRepository,
val entitiesFlow: Flow<List<Entity<*>>>,
val entitiesFlow: Flow<List<Entity<*>>>
) : Screen(carContext) {

companion object {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
android:resource="@xml/entity_widget_info" />
</receiver>

<receiver android:name=".widgets.media_player_controls.MediaPlayerControlsWidget" android:label="@string/widget_media_player_description"
<receiver android:name=".widgets.mediaplayer.MediaPlayerControlsWidget" android:label="@string/widget_media_player_description"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a breaking change for media player widgets, we experienced this after #1000 was merged a while back

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to make sure it makes it into the changelog.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, this note is a reminder to myself 😂

android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
Expand Down Expand Up @@ -205,7 +205,7 @@
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity android:name=".widgets.media_player_controls.MediaPlayerControlsWidgetConfigureActivity"
<activity android:name=".widgets.mediaplayer.MediaPlayerControlsWidgetConfigureActivity"
android:configChanges="orientation|screenSize"
android:exported="true">
<intent-filter>
Expand Down
Loading