0.3.9 - fix channel setting autobug and update to latest google libs

pull/28/head
geeksville 2020-04-15 07:49:39 -07:00
rodzic 55f9208f47
commit 7fa168ab2c
5 zmienionych plików z 29 dodań i 16 usunięć

Wyświetl plik

@ -16,8 +16,8 @@ android {
applicationId "com.geeksville.mesh"
minSdkVersion 22 // The oldest emulator image I have tried is 22 (though 21 probably works)
targetSdkVersion 29
versionCode 138
versionName "0.3.8"
versionCode 139
versionName "0.3.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -97,8 +97,8 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
@ -123,10 +123,10 @@ dependencies {
implementation 'com.google.android.gms:play-services-location:17.0.0'
// For Google Sign-In (owner name accesss)
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
// Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta03'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'
// alas implementation bug deep in the bowels when I tried it for my SyncBluetoothDevice class
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3"

Wyświetl plik

@ -73,7 +73,8 @@ class UIViewModel(app: Application) : AndroidViewModel(app), Logging {
fun setRadioConfig(c: MeshProtos.RadioConfig) {
debug("Setting new radio config!")
meshService?.radioConfig = c.toByteArray()
radioConfig.value = c
radioConfig.value =
c // Must be done after calling the service, so we will will properly throw if the service failed (and therefore not cache invalid new settings)
getPreferences(context).edit(commit = true) {
this.putString("channel-url", getChannel(c)!!.getChannelUrl().toString())

Wyświetl plik

@ -4,6 +4,7 @@ import android.content.Intent
import android.graphics.ColorMatrix
import android.graphics.ColorMatrixColorFilter
import android.os.Bundle
import android.os.RemoteException
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -19,7 +20,9 @@ import com.geeksville.android.hideKeyboard
import com.geeksville.mesh.R
import com.geeksville.mesh.model.UIViewModel
import com.geeksville.mesh.service.MeshService
import com.geeksville.util.Exceptions
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.channel_fragment.*
@ -128,12 +131,6 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
editableCheckbox.setOnCheckedChangeListener { _, checked ->
if (!checked) {
// User just locked it, we should warn and then apply changes to radio
/* Snackbar.make(
editableCheckbox,
"Changing channels is not yet supported",
Snackbar.LENGTH_SHORT
).show() */
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.change_channel)
.setMessage(R.string.are_you_sure_channel)
@ -146,8 +143,22 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
val newSettings = old.settings.toBuilder()
newSettings.name = channelNameEdit.text.toString().trim()
// FIXME, regenerate a new preshared key!
model.setChannel(newSettings.build())
// Since we are writing to radioconfig, that will trigger the rest of the GUI update (QR code etc)
// Try to change the radio, if it fails, tell the user why and throw away their redits
try {
model.setChannel(newSettings.build())
// Since we are writing to radioconfig, that will trigger the rest of the GUI update (QR code etc)
} catch (ex: RemoteException) {
setGUIfromModel() // Throw away user edits
// Tell the user to try again
Snackbar.make(
editableCheckbox,
R.string.radio_sleeping,
Snackbar.LENGTH_SHORT
).show()
Exceptions.report(ex, "ignoring channel problem")
}
}
}
.show()

Wyświetl plik

@ -36,4 +36,5 @@
If you would like to see the map, you\'ll need to turn on analytics in the Settings pane (also, for the time being you might need to force restart the application).\n\n
If you are interested in us paying for mapbox (or switching to a different map provider), please post in our forum.</string>
<string name="permission_missing">A required permission is missing, Meshtastic won\'t be able to work properly. Please enable in application settings.</string>
<string name="radio_sleeping">Radio was sleeping, could not change channel</string>
</resources>

Wyświetl plik

@ -19,7 +19,7 @@ buildscript {
// Check that you have the Google Services Gradle plugin v4.3.2 or later
// (if not, add it).
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta03'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta04'
// protobuf plugin - docs here https://github.com/google/protobuf-gradle-plugin
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'