Update to kotlin 1.4

1.2-legacy
geeksville 2020-08-18 11:25:16 -07:00
rodzic 4e6c0140dd
commit 9a73da562c
5 zmienionych plików z 31 dodań i 12 usunięć

Wyświetl plik

@ -1,6 +1,22 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="PROTO">

Wyświetl plik

@ -122,7 +122,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// kotlin serialization
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc"
// rate this app
implementation "com.vorlonsoft:androidrate:1.2.1"

Wyświetl plik

@ -218,20 +218,20 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
/// Send a packet/command out the radio link
override fun handleSendToRadio(a: ByteArray) {
override fun handleSendToRadio(p: ByteArray) {
try {
safe?.let { s ->
val uuid = BTM_TORADIO_CHARACTER
debug("queuing ${a.size} bytes to $uuid")
debug("queuing ${p.size} bytes to $uuid")
// Note: we generate a new characteristic each time, because we are about to
// change the data and we want the data stored in the closure
val toRadio = getCharacteristic(uuid)
s.asyncWriteCharacteristic(toRadio, a) { r ->
s.asyncWriteCharacteristic(toRadio, p) { r ->
try {
r.getOrThrow()
debug("write of ${a.size} bytes to $uuid completed")
debug("write of ${p.size} bytes to $uuid completed")
if (isFirstSend) {
isFirstSend = false

Wyświetl plik

@ -36,7 +36,6 @@ import com.google.protobuf.InvalidProtocolBufferException
import kotlinx.coroutines.*
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonConfiguration
import java.util.*
import java.util.concurrent.TimeUnit
import kotlin.math.absoluteValue
@ -558,8 +557,8 @@ class MeshService : Service(), Logging {
nodeDB = nodeDBbyNodeNum.values.toTypedArray(),
messages = recentDataPackets.toTypedArray()
)
val json = Json(JsonConfiguration.Default)
val asString = json.stringify(SavedSettings.serializer(), settings)
val json = Json { isLenient = true }
val asString = json.encodeToString(SavedSettings.serializer(), settings)
debug("Saving settings")
getPrefs().edit(commit = true) {
// FIXME, not really ideal to store this bigish blob in preferences
@ -593,8 +592,8 @@ class MeshService : Service(), Logging {
try {
getPrefs().getString("json", null)?.let { asString ->
val json = Json(JsonConfiguration.Default)
val settings = json.parse(SavedSettings.serializer(), asString)
val json = Json { isLenient = true }
val settings = json.decodeFromString(SavedSettings.serializer(), asString)
installNewNodeDB(settings.myInfo, settings.nodeDB)
// Note: we do not haveNodeDB = true because that means we've got a valid db from a real device (rather than this possibly stale hint)
@ -866,7 +865,11 @@ class MeshService : Service(), Logging {
}
/// Update our DB of users based on someone sending out a Position subpacket
private fun handleReceivedPosition(fromNum: Int, p: MeshProtos.Position, defaultTime: Int = Position.currentTime()) {
private fun handleReceivedPosition(
fromNum: Int,
p: MeshProtos.Position,
defaultTime: Int = Position.currentTime()
) {
updateNodeInfo(fromNum) {
it.position = Position(p)
updateNodeInfoTime(it, defaultTime)

Wyświetl plik

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.4.0'
ext.coroutines_version = "1.3.9"
repositories {