- No need to ask for READ_PHONE_STATE permission,
- Improved no_calls string.
This commit is contained in:
@@ -130,6 +130,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
aorSpinner.adapter = uaAdapter
|
aorSpinner.adapter = uaAdapter
|
||||||
aorSpinner.setSelection(-1)
|
aorSpinner.setSelection(-1)
|
||||||
aorSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
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) {
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
Log.d("Baresip", "aorSpinner selecting $position")
|
Log.d("Baresip", "aorSpinner selecting $position")
|
||||||
val acc = UserAgent.uas()[position].account
|
val acc = UserAgent.uas()[position].account
|
||||||
@@ -911,14 +913,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if ((grantResults.size > 0) && (grantResults[0] != PackageManager.PERMISSION_GRANTED))
|
if ((grantResults.size > 0) && (grantResults[0] != PackageManager.PERMISSION_GRANTED))
|
||||||
Toast.makeText(applicationContext, getString(R.string.no_calls),
|
Toast.makeText(applicationContext, getString(R.string.no_calls),
|
||||||
Toast.LENGTH_LONG).show()
|
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 ->
|
BACKUP_PERMISSION_REQUEST_CODE ->
|
||||||
if ((grantResults.size > 0) && (grantResults[0] == PackageManager.PERMISSION_GRANTED))
|
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 {
|
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.makeText(applicationContext, getString(R.string.no_calls),
|
||||||
Toast.LENGTH_LONG).show()
|
Toast.LENGTH_LONG).show()
|
||||||
return false
|
return false
|
||||||
@@ -1379,8 +1373,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
const val BACKUP_PERMISSION_REQUEST_CODE = 1
|
const val BACKUP_PERMISSION_REQUEST_CODE = 1
|
||||||
const val RESTORE_PERMISSION_REQUEST_CODE = 2
|
const val RESTORE_PERMISSION_REQUEST_CODE = 2
|
||||||
const val RECORD_PERMISSION_REQUEST_CODE = 3
|
const val RECORD_PERMISSION_REQUEST_CODE = 3
|
||||||
const val PHONE_PERMISSION_REQUEST_CODE = 4
|
const val RESTART_REQUEST_CODE = 4
|
||||||
const val RESTART_REQUEST_CODE = 5
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -325,7 +325,4 @@
|
|||||||
<string name="no_calls">Et voi soittaa puheluita tai vastata niihin
|
<string name="no_calls">Et voi soittaa puheluita tai vastata niihin
|
||||||
ilman Mikrofoni-käyttöoikeutta.
|
ilman Mikrofoni-käyttöoikeutta.
|
||||||
</string>
|
</string>
|
||||||
<string name="no_call_awareness">Ilman Puhelin-käyttöoikeutta baresip ei voi tietää, onko
|
|
||||||
toinen puhelu parhaillaan jo käynnissä.
|
|
||||||
</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -298,11 +298,8 @@
|
|||||||
baresip → Permissions → Storage and that backup file \'baresip.bs\' exists in the folder
|
baresip → Permissions → Storage and that backup file \'baresip.bs\' exists in the folder
|
||||||
and, if so, you gave correct Decrypt Password.
|
and, if so, you gave correct Decrypt Password.
|
||||||
</string>
|
</string>
|
||||||
<string name="no_calls">You are not able to place or answer calls without Record Audio
|
<string name="no_calls">You are not able to place or answer calls without Microphone
|
||||||
permission.
|
permission.
|
||||||
</string>
|
</string>
|
||||||
<string name="no_call_awareness">Without Phone permission, baresip cannot be aware if another
|
|
||||||
phone call has already been established.
|
|
||||||
</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user