remove deprecations

pull/257/head
Kevin Hester 2021-03-03 08:14:40 +08:00
rodzic 55d0110ff2
commit dbc91e4ac5
5 zmienionych plików z 15 dodań i 15 usunięć

Wyświetl plik

@ -9,7 +9,6 @@ import kotlinx.serialization.Serializable
data class MyNodeInfo(
val myNodeNum: Int,
val hasGPS: Boolean,
val region: String?,
val model: String?,
val firmwareVersion: String?,
val couldUpdate: Boolean, // this application contains a software load we _could_ install if you want
@ -20,14 +19,13 @@ data class MyNodeInfo(
val maxChannels: Int
) : Parcelable {
/** A human readable description of the software/hardware version */
val firmwareString: String get() = "$model $region/$firmwareVersion"
val firmwareString: String get() = "$model $firmwareVersion"
constructor(parcel: Parcel) : this(
parcel.readInt(),
parcel.readByte() != 0.toByte(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readByte() != 0.toByte(),
parcel.readByte() != 0.toByte(),
parcel.readLong(),
@ -40,7 +38,6 @@ data class MyNodeInfo(
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeInt(myNodeNum)
parcel.writeByte(if (hasGPS) 1 else 0)
parcel.writeString(region)
parcel.writeString(model)
parcel.writeString(firmwareVersion)
parcel.writeByte(if (couldUpdate) 1 else 0)

Wyświetl plik

@ -52,8 +52,8 @@ class MeshService : Service(), Logging {
/// Intents broadcast by MeshService
@Deprecated(message = "Does not filter by port number. For legacy reasons only broadcast for UNKNOWN_APP, switch to ACTION_RECEIVED")
const val ACTION_RECEIVED_DATA = "$prefix.RECEIVED_DATA"
/* @Deprecated(message = "Does not filter by port number. For legacy reasons only broadcast for UNKNOWN_APP, switch to ACTION_RECEIVED")
const val ACTION_RECEIVED_DATA = "$prefix.RECEIVED_DATA" */
fun actionReceived(portNum: String) = "$prefix.RECEIVED.$portNum"
@ -724,6 +724,7 @@ class MeshService : Service(), Logging {
// Handle new style routing info
Portnums.PortNum.ROUTING_APP_VALUE -> {
shouldBroadcast = true // We always send acks to other apps, because they might care about the messages they sent
val u = MeshProtos.Routing.parseFrom(data.payload)
if (u.errorReasonValue == MeshProtos.Routing.Error.NONE_VALUE)
handleAckNak(true, data.requestId)
@ -1231,7 +1232,6 @@ class MeshService : Service(), Logging {
MyNodeInfo(
myNodeNum,
hasGps,
region,
hwModel,
firmwareVersion,
firmwareUpdateFilename != null,
@ -1260,7 +1260,7 @@ class MeshService : Service(), Logging {
/// Track types of devices and firmware versions in use
GeeksvilleApplication.analytics.setUserInfo(
DataPair("region", mi.region),
// DataPair("region", mi.region),
DataPair("firmware", mi.firmwareVersion),
DataPair("has_gps", mi.hasGPS),
DataPair("hw_model", mi.model),
@ -1275,8 +1275,8 @@ class MeshService : Service(), Logging {
// We also include this info, because it is required to correctly decode address from the map file
DataPair("firmware", mi.firmwareVersion),
DataPair("hw_model", mi.model),
DataPair("region", mi.region)
DataPair("hw_model", mi.model)
// DataPair("region", mi.region)
)
}
}
@ -1301,7 +1301,8 @@ class MeshService : Service(), Logging {
}
if (curRegionValue == RadioConfigProtos.RegionCode.Unset_VALUE) {
// look for a legacy region
TODO("Need gui for setting region")
/* // look for a legacy region
val legacyRegex = Regex(".+-(.+)")
myNodeInfo?.region?.let { legacyRegion ->
val matches = legacyRegex.find(legacyRegion)
@ -1311,7 +1312,7 @@ class MeshService : Service(), Logging {
info("Upgrading legacy region $newRegion (code ${newRegion.number})")
curRegionValue = newRegion.number
}
}
} */
}
// If nothing was set in our (new style radio preferences, but we now have a valid setting - slam it in)

Wyświetl plik

@ -20,10 +20,12 @@ class MeshServiceBroadcasts(
explicitBroadcast(Intent(MeshService.actionReceived(payload.dataType)).putExtra(EXTRA_PAYLOAD, payload))
/*
// For the time being we ALSO broadcast using old ACTION_RECEIVED_DATA field for any oldschool opaque packets
// newer packets (that have a non zero portnum) are only broadcast using the standard mechanism.
if(payload.dataType == Portnums.PortNum.UNKNOWN_APP_VALUE)
explicitBroadcast(Intent(MeshService.ACTION_RECEIVED_DATA).putExtra(EXTRA_PAYLOAD, payload))
*/
}
fun broadcastNodeChange(info: NodeInfo) {

Wyświetl plik

@ -108,7 +108,6 @@ class MockInterface(private val service: RadioInterfaceService) : Logging, IRadi
MeshProtos.FromRadio.newBuilder().apply {
myInfo = MeshProtos.MyNodeInfo.newBuilder().apply {
myNodeNum = MY_NODE
region = "TW"
hwModel = "Sim"
messageTimeoutMsec = 5 * 60 * 1000
firmwareVersion = service.getString(R.string.cur_firmware_version)

Wyświetl plik

@ -9,6 +9,7 @@ import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@ -151,11 +152,11 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
if (isMe) {
marginParams.leftMargin = messageOffset
marginParams.rightMargin = 0
holder.card.setCardBackgroundColor(resources.getColor(R.color.colorMyMsg))
context?.let{ holder.card.setCardBackgroundColor(ContextCompat.getColor(it, R.color.colorMyMsg)) }
} else {
marginParams.rightMargin = messageOffset
marginParams.leftMargin = 0
holder.card.setCardBackgroundColor(resources.getColor(R.color.colorMsg))
context?.let{ holder.card.setCardBackgroundColor(ContextCompat.getColor(it, R.color.colorMsg)) }
}
// Hide the username chip for my messages
if (isMe) {