Skip to content

Conversation

@pm-dimagi
Copy link
Contributor

Product Description

Added user name and photo at the time of recovery of pin at the backup code page

Technical Summary

Feature Flag

Safety Assurance

Safety story

Automated test coverage

QA Plan

Labels and Review

  • Do we need to enhance the manual QA test coverage ? If yes, the "QA Note" label is set correctly
  • Does the PR introduce any major changes worth communicating ? If yes, the "Release Note" label is set and a "Release Note" is specified in PR description.
  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

String username = personalIdSessionDataViewModel.getPersonalIdSessionData().getUsername();
String photoBase64 = personalIdSessionDataViewModel.getPersonalIdSessionData().getPhotoBase64();

if (!TextUtils.isEmpty(username)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this as username can't be empty at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 127 to 134
if (!TextUtils.isEmpty(photoBase64)) {
try {
byte[] decodedBytes = Base64.decode(photoBase64, Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);
binding.userPhoto.setImageBitmap(bitmap);
} catch (IllegalArgumentException e) {
Logger.log("photo-decode-error", "Invalid Base64 image: " + e.getMessage());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can reuse displayImage by moving it to MediaUtil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pm-dimagi pm-dimagi requested a review from shubham1g5 May 28, 2025 08:54
}

private void displayImage(String photoAsBase64) {
String imageData = photoAsBase64.replace(MicroImageActivity.BASE_64_IMAGE_PREFIX, "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this code now ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pm-dimagi pm-dimagi requested a review from shubham1g5 May 28, 2025 09:32
// Remove the metadata prefix if it exists
if (base64Image.startsWith("data:image")) {
int commaIndex = base64Image.indexOf(',');
if (commaIndex != -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw an IllegalStateException if commaIndex == -1 instead.

byte[] decodedString = Base64.decode(base64Image, Base64.DEFAULT);
return BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
} catch(Exception e){
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove the generic catch from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pm-dimagi pm-dimagi requested a review from shubham1g5 May 28, 2025 10:04
@pm-dimagi pm-dimagi merged commit e213d13 into pm_ccct_1223 May 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants