diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt index 980a06e4..65923cd6 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt @@ -130,6 +130,8 @@ class MainActivity : AppCompatActivity() { aorSpinner.adapter = uaAdapter aorSpinner.setSelection(-1) aorSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { + // Have to allow NULL view, since sometimes when onItemSelected is called, view is NULL. + // Haven't found any explanation why this can happen. override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) { Log.d("Baresip", "aorSpinner selecting $position") val acc = UserAgent.uas()[position].account @@ -423,7 +425,7 @@ class MainActivity : AppCompatActivity() { baresipService.setAction("Start") startService(baresipService) Utils.requestPermission(this, Manifest.permission.RECORD_AUDIO, - RECORD_PERMISSION_REQUEST_CODE) + RECORD_PERMISSION_REQUEST_CODE) } if (intent.hasExtra("onStartup")) @@ -911,14 +913,6 @@ class MainActivity : AppCompatActivity() { if ((grantResults.size > 0) && (grantResults[0] != PackageManager.PERMISSION_GRANTED)) Toast.makeText(applicationContext, getString(R.string.no_calls), Toast.LENGTH_LONG).show() - else - Utils.requestPermission(this, Manifest.permission.READ_PHONE_STATE, - PHONE_PERMISSION_REQUEST_CODE) - - PHONE_PERMISSION_REQUEST_CODE -> - if ((grantResults.size > 0) && (grantResults[0] != PackageManager.PERMISSION_GRANTED)) - Toast.makeText(applicationContext, getString(R.string.no_call_awareness), - Toast.LENGTH_LONG).show() BACKUP_PERMISSION_REQUEST_CODE -> if ((grantResults.size > 0) && (grantResults[0] == PackageManager.PERMISSION_GRANTED)) @@ -1102,7 +1096,7 @@ class MainActivity : AppCompatActivity() { } private fun call(ua: UserAgent, uri: String, status: String): Boolean { - if (Utils.checkPermission(this, Manifest.permission.RECORD_AUDIO)) { + if (!Utils.checkPermission(this, Manifest.permission.RECORD_AUDIO)) { Toast.makeText(applicationContext, getString(R.string.no_calls), Toast.LENGTH_LONG).show() return false @@ -1379,8 +1373,7 @@ class MainActivity : AppCompatActivity() { const val BACKUP_PERMISSION_REQUEST_CODE = 1 const val RESTORE_PERMISSION_REQUEST_CODE = 2 const val RECORD_PERMISSION_REQUEST_CODE = 3 - const val PHONE_PERMISSION_REQUEST_CODE = 4 - const val RESTART_REQUEST_CODE = 5 + const val RESTART_REQUEST_CODE = 4 } diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 82cdd609..4b6db276 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -325,7 +325,4 @@ Et voi soittaa puheluita tai vastata niihin ilman Mikrofoni-käyttöoikeutta. - Ilman Puhelin-käyttöoikeutta baresip ei voi tietää, onko - toinen puhelu parhaillaan jo käynnissä. - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d9fcfe81..e47edacb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -298,11 +298,8 @@ baresip → Permissions → Storage and that backup file \'baresip.bs\' exists in the folder and, if so, you gave correct Decrypt Password. - You are not able to place or answer calls without Record Audio + You are not able to place or answer calls without Microphone permission. - Without Phone permission, baresip cannot be aware if another - phone call has already been established. -