diff --git a/app/build.gradle b/app/build.gradle index 09532674..249fd174 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId = 'com.tutpro.baresip' minSdkVersion 21 targetSdkVersion 27 - versionCode = 44 - versionName = '5.4.1' + versionCode = 45 + versionName = '5.4.2' externalNativeBuild { cmake { cFlags '-DHAVE_INTTYPES_H' diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt index 6e08a749..af0bb6b5 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt @@ -474,7 +474,8 @@ class MainActivity : AppCompatActivity() { Log.e("Baresip", "Incoming call $callp not found") return } - if (ua != UserAgent.uas()[aorSpinner.selectedItemPosition]) { + if ((aorSpinner.selectedItemPosition == -1) || + (ua != UserAgent.uas()[aorSpinner.selectedItemPosition])) { aorSpinner.setSelection(account_index) } else { callTitle.text = "Incoming call from ..." @@ -655,7 +656,8 @@ class MainActivity : AppCompatActivity() { Message.add(Message(aor, peerUri, R.drawable.arrow_down_green, msgText, time.toLong(), true)) if (Utils.isVisible()) { - if (ua != UserAgent.uas()[aorSpinner.selectedItemPosition]) + if ((aorSpinner.selectedItemPosition == -1) || + (ua != UserAgent.uas()[aorSpinner.selectedItemPosition])) aorSpinner.setSelection(account_index) val i = Intent(applicationContext, ChatsActivity::class.java) i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) @@ -678,11 +680,12 @@ class MainActivity : AppCompatActivity() { } } if ((aorSpinner.selectedItemPosition >= 0) && - (ua == UserAgent.uas()[aorSpinner.selectedItemPosition])) + (ua == UserAgent.uas()[aorSpinner.selectedItemPosition])) { if (acc.vmNew > 0) voicemailButton.setImageResource(R.drawable.voicemail_new) else voicemailButton.setImageResource(R.drawable.voicemail) + } } else -> Log.w("Baresip", "Unknown event '${ev[0]}'") } diff --git a/fastlane/metadata/android/en-US/changelogs/5.4.2.txt b/fastlane/metadata/android/en-US/changelogs/5.4.2.txt new file mode 100644 index 00000000..032f891a --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/5.4.2.txt @@ -0,0 +1,2 @@ +- Fixed rare crash that can happen when first account is created and + message or call comes in before user has returned to main activity.