mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
Android 6: App crash when read Contact permission is granted (#2064)
This commit is contained in:
parent
751c870a4a
commit
be9a91e3fe
4 changed files with 28 additions and 3 deletions
|
@ -26,6 +26,7 @@ Bugfix 🐛:
|
|||
- Login with Matrix-Id | Autodiscovery fails if identity server is invalid and Homeserver ok (#2027)
|
||||
- Support for image compression on Android 10
|
||||
- Verification popup won't show
|
||||
- Android 6: App crash when read Contact permission is granted (#2064)
|
||||
|
||||
Translations 🗣:
|
||||
- The SDK is now using SAS string translations from [Weblate Matrix-doc project](https://translate.riot.im/projects/matrix-doc/) (#1909)
|
||||
|
|
|
@ -345,6 +345,14 @@ abstract class VectorBaseActivity : AppCompatActivity(), HasScreenInjector {
|
|||
}
|
||||
}
|
||||
|
||||
protected var postResumeScheduledAction: Runnable? = null
|
||||
|
||||
override fun onPostResume() {
|
||||
super.onPostResume()
|
||||
postResumeScheduledAction?.run()
|
||||
postResumeScheduledAction = null
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
Timber.i("onPause Activity ${this.javaClass.simpleName}")
|
||||
|
|
|
@ -49,8 +49,10 @@ import im.vector.app.features.userdirectory.UserDirectorySharedAction
|
|||
import im.vector.app.features.userdirectory.UserDirectorySharedActionViewModel
|
||||
import im.vector.app.features.userdirectory.UserDirectoryViewModel
|
||||
import kotlinx.android.synthetic.main.activity.*
|
||||
import org.matrix.android.sdk.api.extensions.tryThis
|
||||
import org.matrix.android.sdk.api.failure.Failure
|
||||
import org.matrix.android.sdk.api.session.room.failure.CreateRoomFailure
|
||||
import timber.log.Timber
|
||||
import java.net.HttpURLConnection
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -113,7 +115,13 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
|||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
if (allGranted(grantResults)) {
|
||||
if (requestCode == PERMISSION_REQUEST_CODE_READ_CONTACTS) {
|
||||
addFragmentToBackstack(R.id.container, ContactsBookFragment::class.java)
|
||||
try {
|
||||
addFragmentToBackstack(R.id.container, ContactsBookFragment::class.java)
|
||||
} catch (throwable: Throwable) {
|
||||
Timber.w(throwable)
|
||||
// Bug on API23
|
||||
postResumeScheduledAction = Runnable { tryThis { addFragmentToBackstack(R.id.container, ContactsBookFragment::class.java) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,11 @@ import im.vector.app.features.userdirectory.UserDirectoryFragment
|
|||
import im.vector.app.features.userdirectory.UserDirectorySharedAction
|
||||
import im.vector.app.features.userdirectory.UserDirectorySharedActionViewModel
|
||||
import im.vector.app.features.userdirectory.UserDirectoryViewModel
|
||||
import org.matrix.android.sdk.api.failure.Failure
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.synthetic.main.activity.*
|
||||
import org.matrix.android.sdk.api.extensions.tryThis
|
||||
import org.matrix.android.sdk.api.failure.Failure
|
||||
import timber.log.Timber
|
||||
import java.net.HttpURLConnection
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -114,7 +116,13 @@ class InviteUsersToRoomActivity : SimpleFragmentActivity() {
|
|||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
if (allGranted(grantResults)) {
|
||||
if (requestCode == PERMISSION_REQUEST_CODE_READ_CONTACTS) {
|
||||
addFragmentToBackstack(R.id.container, ContactsBookFragment::class.java)
|
||||
try {
|
||||
addFragmentToBackstack(R.id.container, ContactsBookFragment::class.java)
|
||||
} catch (throwable: Throwable) {
|
||||
Timber.w(throwable)
|
||||
// Bug on API23
|
||||
postResumeScheduledAction = Runnable { tryThis { addFragmentToBackstack(R.id.container, ContactsBookFragment::class.java) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue