Merge pull request #155 from geeksville/dev

Dev
This commit is contained in:
Kevin Hester
2020-09-08 12:37:53 -07:00
committed by GitHub
4 changed files with 16 additions and 9 deletions

View File

@@ -28,8 +28,8 @@ android {
applicationId "com.geeksville.mesh"
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
targetSdkVersion 29
versionCode 10906 // format is Mmmss (where M is 1+the numeric major number
versionName "0.9.06"
versionCode 10980 // format is Mmmss (where M is 1+the numeric major number
versionName "0.9.80"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -113,7 +113,7 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.android.material:material:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'

View File

@@ -4,7 +4,6 @@ import android.graphics.Bitmap
import android.net.Uri
import android.util.Base64
import com.geeksville.mesh.MeshProtos
import com.geeksville.util.anonymize
import com.google.zxing.BarcodeFormat
import com.google.zxing.MultiFormatWriter
import com.journeyapps.barcodescanner.BarcodeEncoder
@@ -44,7 +43,7 @@ data class Channel(
// Let the path optionally include the # character (or not) so we can work with old URLs generated by old versions of the app
val pathRegex = Regex("$prefixRoot#?(.*)")
val (base64) = pathRegex.find(urlStr)?.destructured
?: throw MalformedURLException("Not a meshtastic URL: ${urlStr.anonymize(40)}")
?: throw MalformedURLException("Not a meshtastic URL: ${urlStr.take(40)}")
val bytes = Base64.decode(base64, base64Flags)
return MeshProtos.ChannelSettings.parseFrom(bytes)

View File

@@ -457,7 +457,8 @@ class MeshService : Service(), Logging {
* tell android not to kill us
*/
private fun startForeground() {
val wantForeground = RadioInterfaceService.getBondedDeviceAddress(this) != null
val a = RadioInterfaceService.getBondedDeviceAddress(this)
val wantForeground = a != null && a != "n"
info("Requesting foreground service=$wantForeground")

View File

@@ -88,7 +88,11 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
val modemConfig = radioConfig?.channelSettings?.modemConfig
val channelOption = ChannelOption.fromConfig(modemConfig)
filled_exposed_dropdown.setText(getString(channelOption?.configRes ?: R.string.modem_config_unrecognized), false)
filled_exposed_dropdown.setText(
getString(
channelOption?.configRes ?: R.string.modem_config_unrecognized
), false
)
} else {
qrView.visibility = View.INVISIBLE
@@ -138,7 +142,9 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
requireActivity().hideKeyboard()
}
editableCheckbox.setOnCheckedChangeListener { _, checked ->
// Note: Do not use setOnCheckedChanged here because we don't want to be called when we programmatically disable editing
editableCheckbox.setOnClickListener { _ ->
val checked = editableCheckbox.isChecked
if (checked) {
// User just unlocked for editing - remove the # goo around the channel name
UIViewModel.getChannel(model.radioConfig.value)?.let { channel ->
@@ -171,7 +177,8 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
newSettings.psk = ByteString.copyFrom(bytes)
} else {
debug("ASSIGNING NEW default AES128 KEY")
newSettings.name = Channel.defaultChannelName // Fix any case errors
newSettings.name =
Channel.defaultChannelName // Fix any case errors
newSettings.psk = ByteString.copyFrom(Channel.channelDefaultKey)
}