sforkowany z mirror/meshtastic-android
Update to kotlin 1.4
rodzic
4e6c0140dd
commit
9a73da562c
|
@ -1,6 +1,22 @@
|
||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
<JetCodeStyleSettings>
|
<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" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="PROTO">
|
<codeStyleSettings language="PROTO">
|
||||||
|
|
|
@ -122,7 +122,7 @@ dependencies {
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
|
||||||
// kotlin serialization
|
// 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
|
// rate this app
|
||||||
implementation "com.vorlonsoft:androidrate:1.2.1"
|
implementation "com.vorlonsoft:androidrate:1.2.1"
|
||||||
|
|
|
@ -218,20 +218,20 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
|
||||||
|
|
||||||
|
|
||||||
/// Send a packet/command out the radio link
|
/// Send a packet/command out the radio link
|
||||||
override fun handleSendToRadio(a: ByteArray) {
|
override fun handleSendToRadio(p: ByteArray) {
|
||||||
try {
|
try {
|
||||||
safe?.let { s ->
|
safe?.let { s ->
|
||||||
val uuid = BTM_TORADIO_CHARACTER
|
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
|
// 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
|
// change the data and we want the data stored in the closure
|
||||||
val toRadio = getCharacteristic(uuid)
|
val toRadio = getCharacteristic(uuid)
|
||||||
|
|
||||||
s.asyncWriteCharacteristic(toRadio, a) { r ->
|
s.asyncWriteCharacteristic(toRadio, p) { r ->
|
||||||
try {
|
try {
|
||||||
r.getOrThrow()
|
r.getOrThrow()
|
||||||
debug("write of ${a.size} bytes to $uuid completed")
|
debug("write of ${p.size} bytes to $uuid completed")
|
||||||
|
|
||||||
if (isFirstSend) {
|
if (isFirstSend) {
|
||||||
isFirstSend = false
|
isFirstSend = false
|
||||||
|
|
|
@ -36,7 +36,6 @@ import com.google.protobuf.InvalidProtocolBufferException
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonConfiguration
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.math.absoluteValue
|
import kotlin.math.absoluteValue
|
||||||
|
@ -558,8 +557,8 @@ class MeshService : Service(), Logging {
|
||||||
nodeDB = nodeDBbyNodeNum.values.toTypedArray(),
|
nodeDB = nodeDBbyNodeNum.values.toTypedArray(),
|
||||||
messages = recentDataPackets.toTypedArray()
|
messages = recentDataPackets.toTypedArray()
|
||||||
)
|
)
|
||||||
val json = Json(JsonConfiguration.Default)
|
val json = Json { isLenient = true }
|
||||||
val asString = json.stringify(SavedSettings.serializer(), settings)
|
val asString = json.encodeToString(SavedSettings.serializer(), settings)
|
||||||
debug("Saving settings")
|
debug("Saving settings")
|
||||||
getPrefs().edit(commit = true) {
|
getPrefs().edit(commit = true) {
|
||||||
// FIXME, not really ideal to store this bigish blob in preferences
|
// FIXME, not really ideal to store this bigish blob in preferences
|
||||||
|
@ -593,8 +592,8 @@ class MeshService : Service(), Logging {
|
||||||
try {
|
try {
|
||||||
getPrefs().getString("json", null)?.let { asString ->
|
getPrefs().getString("json", null)?.let { asString ->
|
||||||
|
|
||||||
val json = Json(JsonConfiguration.Default)
|
val json = Json { isLenient = true }
|
||||||
val settings = json.parse(SavedSettings.serializer(), asString)
|
val settings = json.decodeFromString(SavedSettings.serializer(), asString)
|
||||||
installNewNodeDB(settings.myInfo, settings.nodeDB)
|
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)
|
// 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
|
/// 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) {
|
updateNodeInfo(fromNum) {
|
||||||
it.position = Position(p)
|
it.position = Position(p)
|
||||||
updateNodeInfoTime(it, defaultTime)
|
updateNodeInfoTime(it, defaultTime)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.72'
|
ext.kotlin_version = '1.4.0'
|
||||||
ext.coroutines_version = "1.3.9"
|
ext.coroutines_version = "1.3.9"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
Ładowanie…
Reference in New Issue