mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
add logging and toasts if current user was null
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
e9dbcc554a
commit
f73d1c14fc
@ -324,9 +324,9 @@ class AccountVerificationController(args: Bundle? = null) :
|
|||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(displayName)) {
|
if (!TextUtils.isEmpty(displayName)) {
|
||||||
storeProfile(
|
storeProfile(
|
||||||
displayName, userProfileOverall.ocs!!.data!!.userId!!,
|
displayName,
|
||||||
capabilities.ocs!!.data!!
|
userProfileOverall.ocs!!.data!!.userId!!,
|
||||||
.capabilities!!
|
capabilities.ocs!!.data!!.capabilities!!
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
|
@ -209,26 +209,30 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
private fun loadUserAvatar(
|
private fun loadUserAvatar(
|
||||||
target: Target
|
target: Target
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
val url = ApiUtils.getUrlForAvatar(
|
if (currentUser != null) {
|
||||||
currentUser!!.baseUrl,
|
val url = ApiUtils.getUrlForAvatar(
|
||||||
currentUser!!.userId,
|
currentUser!!.baseUrl,
|
||||||
true
|
currentUser!!.userId,
|
||||||
)
|
true
|
||||||
|
)
|
||||||
|
|
||||||
val credentials = ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token)
|
val credentials = ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token)
|
||||||
|
|
||||||
context.imageLoader.enqueue(
|
context.imageLoader.enqueue(
|
||||||
ImageRequest.Builder(context)
|
ImageRequest.Builder(context)
|
||||||
.data(url)
|
.data(url)
|
||||||
.addHeader("Authorization", credentials)
|
.addHeader("Authorization", credentials)
|
||||||
.placeholder(R.drawable.ic_user)
|
.placeholder(R.drawable.ic_user)
|
||||||
.transformations(CircleCropTransformation())
|
.transformations(CircleCropTransformation())
|
||||||
.crossfade(true)
|
.crossfade(true)
|
||||||
.target(target)
|
.target(target)
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "currentUser was null in loadUserAvatar")
|
||||||
|
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +242,7 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
override fun onStart(placeholder: Drawable?) {
|
override fun onStart(placeholder: Drawable?) {
|
||||||
button.icon = placeholder
|
button.icon = placeholder
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(result: Drawable) {
|
override fun onSuccess(result: Drawable) {
|
||||||
button.icon = result
|
button.icon = result
|
||||||
}
|
}
|
||||||
@ -251,6 +256,7 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
override fun onStart(placeholder: Drawable?) {
|
override fun onStart(placeholder: Drawable?) {
|
||||||
menuItem.icon = placeholder
|
menuItem.icon = placeholder
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(result: Drawable) {
|
override fun onSuccess(result: Drawable) {
|
||||||
menuItem.icon = result
|
menuItem.icon = result
|
||||||
}
|
}
|
||||||
@ -288,6 +294,9 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
.colorMaterialTextButton((activity as MainActivity?)!!.binding.switchAccountButton)
|
.colorMaterialTextButton((activity as MainActivity?)!!.binding.switchAccountButton)
|
||||||
}
|
}
|
||||||
fetchRooms()
|
fetchRooms()
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "currentUser was null in ConversationsListController.onAttach")
|
||||||
|
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user