kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
commit
2d706f5a4c
|
@ -17,8 +17,8 @@ android {
|
|||
applicationId "com.geeksville.mesh"
|
||||
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
|
||||
targetSdkVersion 29
|
||||
versionCode 10791 // format is Mmmss (where M is 1+the numeric major number
|
||||
versionName "0.7.91"
|
||||
versionCode 10793 // format is Mmmss (where M is 1+the numeric major number
|
||||
versionName "0.7.93"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
|
|
|
@ -332,25 +332,28 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
|
||||
/// Ask user to rate in play store
|
||||
private fun askToRate() {
|
||||
AppRate.with(this)
|
||||
.setInstallDays(10.toByte()) // default is 10, 0 means install day, 10 means app is launched 10 or more days later than installation
|
||||
.setLaunchTimes(10.toByte()) // default is 10, 3 means app is launched 3 or more times
|
||||
.setRemindInterval(1.toByte()) // default is 1, 1 means app is launched 1 or more days after neutral button clicked
|
||||
.setRemindLaunchesNumber(1.toByte()) // default is 0, 1 means app is launched 1 or more times after neutral button clicked
|
||||
.monitor() // Monitors the app launch times
|
||||
exceptionReporter { // Got one IllegalArgumentException from inside this lib, but we don't want to crash our app because of bugs in this optional feature
|
||||
|
||||
// Only ask to rate if the user has a suitable store
|
||||
if (AppRate.with(this).storeType == StoreType.GOOGLEPLAY) { // Checks that current app store type from library options is StoreType.GOOGLEPLAY
|
||||
if (GoogleApiAvailability.getInstance()
|
||||
.isGooglePlayServicesAvailable(this) != ConnectionResult.SERVICE_MISSING
|
||||
) { // Checks that Google Play is available
|
||||
AppRate.showRateDialogIfMeetsConditions(this) // Shows the Rate Dialog when conditions are met
|
||||
AppRate.with(this)
|
||||
.setInstallDays(10.toByte()) // default is 10, 0 means install day, 10 means app is launched 10 or more days later than installation
|
||||
.setLaunchTimes(10.toByte()) // default is 10, 3 means app is launched 3 or more times
|
||||
.setRemindInterval(1.toByte()) // default is 1, 1 means app is launched 1 or more days after neutral button clicked
|
||||
.setRemindLaunchesNumber(1.toByte()) // default is 0, 1 means app is launched 1 or more times after neutral button clicked
|
||||
.monitor() // Monitors the app launch times
|
||||
|
||||
// Force the dialog - for testing
|
||||
// AppRate.with(this).showRateDialog(this)
|
||||
// Only ask to rate if the user has a suitable store
|
||||
if (AppRate.with(this).storeType == StoreType.GOOGLEPLAY) { // Checks that current app store type from library options is StoreType.GOOGLEPLAY
|
||||
if (GoogleApiAvailability.getInstance()
|
||||
.isGooglePlayServicesAvailable(this) != ConnectionResult.SERVICE_MISSING
|
||||
) { // Checks that Google Play is available
|
||||
AppRate.showRateDialogIfMeetsConditions(this) // Shows the Rate Dialog when conditions are met
|
||||
|
||||
// Force the dialog - for testing
|
||||
// AppRate.with(this).showRateDialog(this)
|
||||
}
|
||||
} else {
|
||||
AppRate.showRateDialogIfMeetsConditions(this); // Shows the Rate Dialog when conditions are met
|
||||
}
|
||||
} else {
|
||||
AppRate.showRateDialogIfMeetsConditions(this); // Shows the Rate Dialog when conditions are met
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,7 +646,16 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
}
|
||||
.setPositiveButton(R.string.accept) { _, _ ->
|
||||
debug("Setting channel from URL")
|
||||
model.setChannel(channel.settings)
|
||||
try {
|
||||
model.setChannel(channel.settings)
|
||||
} catch (ex: RemoteException) {
|
||||
errormsg("Couldn't change channel ${ex.message}")
|
||||
Toast.makeText(
|
||||
this,
|
||||
"Couldn't change channel, because radio is not yet connected. Please try again.",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.geeksville.mesh.model.Channel
|
|||
import com.geeksville.mesh.model.ChannelOption
|
||||
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 com.google.protobuf.ByteString
|
||||
|
@ -170,13 +169,15 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
filled_exposed_dropdown.editableText.toString()
|
||||
val modemConfig = getModemConfig(selectedChannelOptionString)
|
||||
|
||||
if (modemConfig!=MeshProtos.ChannelSettings.ModemConfig.UNRECOGNIZED)
|
||||
if (modemConfig != MeshProtos.ChannelSettings.ModemConfig.UNRECOGNIZED)
|
||||
newSettings.modemConfig = modemConfig
|
||||
// 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) {
|
||||
errormsg("ignoring channel problem", ex)
|
||||
|
||||
setGUIfromModel() // Throw away user edits
|
||||
|
||||
// Tell the user to try again
|
||||
|
@ -185,7 +186,6 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
R.string.radio_sleeping,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
Exceptions.report(ex, "ignoring channel problem")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue