Skip to content

Commit

Permalink
Merge branch 'development' into Material3
Browse files Browse the repository at this point in the history
  • Loading branch information
imbissbudenaesthetik committed Dec 25, 2024
2 parents 7701a68 + 363c78c commit cf1fac1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ enum class DeviceType {

}

fun canBeIgnored(): Boolean {
fun canBeIgnored(cs: ConnectionState? = null): Boolean {
// Only Devices with a constant identifier can be ignored
return when (this) {
TILE -> true
CHIPOLO -> true
PEBBLEBEE -> true
GOOGLE_FIND_MY_NETWORK -> cs == ConnectionState.OVERMATURE_OFFLINE
else -> false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import de.seemoo.at_tracking_detection.ATTrackingDetectionApplication
import de.seemoo.at_tracking_detection.R
import de.seemoo.at_tracking_detection.database.models.device.BaseDevice
import de.seemoo.at_tracking_detection.database.models.device.ConnectionState
import de.seemoo.at_tracking_detection.database.models.device.DeviceManager
import de.seemoo.at_tracking_detection.database.models.device.DeviceType
import de.seemoo.at_tracking_detection.database.models.device.types.GoogleFindMyNetworkType
Expand Down Expand Up @@ -161,7 +162,7 @@ class NotificationBuilder @Inject constructor(
)
)

if (baseDevice.deviceType != null && baseDevice.deviceType.canBeIgnored()) {
if (baseDevice.deviceType != null && baseDevice.deviceType.canBeIgnored(ConnectionState.OVERMATURE_OFFLINE)) {
notification = notification.addAction(
R.drawable.ic_warning,
context.getString(R.string.notification_ignore_device),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.lifecycle.*
import de.seemoo.at_tracking_detection.database.models.Beacon
import de.seemoo.at_tracking_detection.database.models.device.BaseDevice
import de.seemoo.at_tracking_detection.database.models.device.Connectable
import de.seemoo.at_tracking_detection.database.models.device.ConnectionState
import de.seemoo.at_tracking_detection.database.models.device.DeviceManager
import de.seemoo.at_tracking_detection.database.models.device.DeviceType
import de.seemoo.at_tracking_detection.database.repository.BeaconRepository
Expand Down Expand Up @@ -73,7 +74,7 @@ class TrackingViewModel @Inject constructor(
deviceIgnored.postValue(device.ignore)
noLocationsYet.postValue(false)
connectable.postValue(device.device is Connectable)
canBeIgnored.postValue(deviceType.value!!.canBeIgnored())
canBeIgnored.postValue(deviceType.value!!.canBeIgnored(ConnectionState.OVERMATURE_OFFLINE))
val notification = notificationRepository.notificationForDevice(device).firstOrNull()
notification?.let { notificationId.postValue(it.notificationId) }
} else {
Expand Down

0 comments on commit cf1fac1

Please sign in to comment.