-
Notifications
You must be signed in to change notification settings - Fork 555
fix : App crash while trying to editing a profile with no profile picture #684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@iamareebjamal Would you please review my PR? |
| .placeholder(icon) | ||
| .transform(CircleTransform()) | ||
| .into(rootView.profilePhoto) | ||
| if(!imageUrl.equals("")) { // picasso requires the imageUrl to be non empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use TextUtils.isEmpty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Follow commit message guidelines |
…icture This fix addresses the problem which crashed the app when a user with no profile picture tries to edit the profile. The imageUrl must not be an empty string, as required by Picasso.get() method
|
@iamareebjamal Updated, but I think I made another commit which is not advises as per the rules, I dont really know the procedure to amend a commit from a forked repo |
| val drawable = AppCompatResources.getDrawable(ctx, R.drawable.ic_account_circle_grey_24dp) | ||
| drawable?.let { icon -> | ||
| if(!imageUrl.equals("")) { // picasso requires the imageUrl to be non empty | ||
| if(!imageUrl.isEmpty()) { // picasso requires the imageUrl to be non empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll fail on null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val userFirstName = it.firstName.nullToEmpty()
val userLastName = it.lastName.nullToEmpty()
val imageUrl = it.avatarUrl.nullToEmpty()
rootView.firstName.setText(userFirstName)
rootView.lastName.setText(userLastName)
context?.let { ctx ->
val drawable = AppCompatResources.getDrawable(ctx, drawable.ic_account_circle_grey_24dp)
drawable?.let { icon ->
if(!imageUrl.isEmpty()) { // picasso requires the imageUrl to be non empty
Picasso.get()
.load(imageUrl).....
@iamareebjamal I think val imageUrl = it.avatarUrl.nullToEmpty() will take care of that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. So, we can add the if statement even above the context.let
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal Done
Just update the PR title |
…icture This fix addresses the problem which crashed the app when a user with no profile picture tries to edit the profile. The imageUrl must not be an empty string, as required by Picasso.get() method
| .transform(CircleTransform()) | ||
| .into(rootView.profilePhoto) | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal Done!
…icture This fix addresses the problem which crashed the app when a user with no profile picture tries to edit the profile. The imageUrl must not be an empty string, as required by Picasso.get() method
# Conflicts: # app/src/main/java/org/fossasia/openevent/general/auth/EditProfileFragment.kt
| .placeholder(icon) | ||
| .transform(CircleTransform()) | ||
| .into(rootView.profilePhoto) | ||
| if(!imageUrl.isEmpty()) { // picasso requires the imageUrl to be non empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal Sorry, missed that. I have removed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space should be added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal is it correctly done now ?
…icture This fix addresses the problem which crashed the app when a user with no profile picture tries to edit the profile. The imageUrl must not be an empty string, as required by Picasso.get() method
iamareebjamal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opposite of what I wanted
…icture This fix addresses the problem which crashed the app when a user with no profile picture tries to edit the profile. The imageUrl must not be an empty string, as required by Picasso.get() method
| if (!imageUrl.isEmpty()) { // picasso requires the imageUrl to be non empty | ||
| context?.let { ctx -> | ||
| val drawable = AppCompatResources.getDrawable(ctx, R.drawable.ic_account_circle_grey_24dp) | ||
| drawable?.let{ icon -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after let
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal Done
…icture This fix addresses the problem which crashed the app when a user with no profile picture tries to edit the profile. The imageUrl must not be an empty string, as required by Picasso.get() method
|
OK, now just change the PR title according to the commit guidelines and we are done |
|
@iamareebjamal I have changed the PR title as requested. |
Fixes #683
Changes: Added code to check if the profile picture URL is not empty, as Picasso requires a non-empty url. Thus if there is no profile picture initially, there should be no attempt to load such an image.