mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-04 14:13:47 -04:00
wait to show location missing toast until after we hear back from android
This commit is contained in:
@@ -351,6 +351,29 @@ class MainActivity : AppCompatActivity(), Logging,
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
|
||||
when(requestCode) {
|
||||
DID_REQUEST_PERM -> {
|
||||
// If request is cancelled, the result arrays are empty.
|
||||
if ((grantResults.isNotEmpty() &&
|
||||
grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
|
||||
// Permission is granted. Continue the action or workflow
|
||||
// in your app.
|
||||
|
||||
// yay!
|
||||
} else {
|
||||
// Explain to the user that the feature is unavailable because
|
||||
// the features requires a permission that the user has denied.
|
||||
// At the same time, respect the user's decision. Don't link to
|
||||
// system settings in an effort to convince the user to change
|
||||
// their decision.
|
||||
warnMissingPermissions()
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
// ignore other requests
|
||||
}
|
||||
}
|
||||
|
||||
updateBluetoothEnabled()
|
||||
}
|
||||
|
||||
@@ -421,9 +444,6 @@ class MainActivity : AppCompatActivity(), Logging,
|
||||
/// We now want to be informed of bluetooth state
|
||||
registerReceiver(btStateReceiver, btStateReceiver.intentFilter)
|
||||
|
||||
// if (!isInTestLab) - very important - even in test lab we must request permissions because we need location perms for some of our tests to pass
|
||||
requestPermission()
|
||||
|
||||
/* not yet working
|
||||
// Configure sign-in to request the user's ID, email address, and basic
|
||||
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
|
||||
@@ -463,8 +483,12 @@ class MainActivity : AppCompatActivity(), Logging,
|
||||
handleIntent(intent)
|
||||
|
||||
askToRate()
|
||||
|
||||
// if (!isInTestLab) - very important - even in test lab we must request permissions because we need location perms for some of our tests to pass
|
||||
requestPermission()
|
||||
}
|
||||
|
||||
|
||||
private fun initToolbar() {
|
||||
val toolbar =
|
||||
findViewById<View>(R.id.toolbar) as Toolbar
|
||||
@@ -994,8 +1018,6 @@ class MainActivity : AppCompatActivity(), Logging,
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
warnMissingPermissions()
|
||||
|
||||
// Ask to start bluetooth if no USB devices are visible
|
||||
val hasUSB = SerialInterface.findDrivers(this).isNotEmpty()
|
||||
if (!isInTestLab && !hasUSB) {
|
||||
|
||||
@@ -571,7 +571,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
when {
|
||||
permissionsWarning != null ->
|
||||
statusText.text = permissionsWarning
|
||||
|
||||
|
||||
region == RadioConfigProtos.RegionCode.Unset ->
|
||||
statusText.text = getString(R.string.must_set_region)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user