Skip to content
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

Fix crash: duplicate items when rendering payment methods list #1840

Merged

Conversation

atmamont
Copy link
Contributor

@atmamont atmamont commented Sep 26, 2024

Summary

iOS18 release introduced new crash which didn't happen before.

When rendering payments list, in rare occasions we could have multiple payment methods having same title and description.
Providing ListItem that is used to render the list uses title as part of it's Hashable and Equatable conformance, resulting in having two identical entries.
This list typically has few sections: stored payment methods and generic payment methods. While any stored payment method always has an unique identifier coming from the backend, the rest of the sections do not.

That's why this fix does not use any backend-provided identifiers and relies purely on UUID that is created upon ListItem instantiation and doesn't get exposed anywhere else.
It can be improved by providing a parameter in the init so it could be injected from the outside.

Note:

ListItem has identifier property that can be mistreated easily and abused. We use it so set an identifier that is later used as accessibilityIdentifier for UI elements. This is misleading as for such a case when we have two identical stored payment methods this could be a potential accessibility problem that will make second duped element on the list inaccessible.

Screenshot

image

COIOS-797

@atmamont atmamont added chore a pull request that has chore changes that shouldn't be in the release notes fixed a pull request that fixes a bug labels Sep 26, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 26, 2024
@atmamont atmamont removed the fixed a pull request that fixes a bug label Sep 26, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 27, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 27, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 27, 2024
@atmamont atmamont marked this pull request as ready for review September 27, 2024 10:54
github-actions[bot]
github-actions bot previously approved these changes Sep 27, 2024
erenbesel
erenbesel previously approved these changes Sep 27, 2024
goergisn
goergisn previously approved these changes Sep 27, 2024
Tests/UnitTests/Core/ListItemTests.swift Outdated Show resolved Hide resolved
nauaros
nauaros previously approved these changes Sep 27, 2024
Copy link
Contributor

✅ No changes detected

Comparing https://github.com/Adyen/adyen-ios.git @ bugfix/fix-diffabledatasource-crash-in-payment-methods to https://github.com/Adyen/adyen-ios.git @ develop


Analyzed targets: Adyen, AdyenActions, AdyenCard, AdyenCashAppPay, AdyenComponents, AdyenDelegatedAuthentication, AdyenDropIn, AdyenEncryption, AdyenSession, AdyenSwiftUI, AdyenTwint, AdyenWeChatPay

Copy link

sonarcloud bot commented Sep 27, 2024

@atmamont atmamont merged commit 6359ede into develop Sep 27, 2024
12 checks passed
@atmamont atmamont deleted the bugfix/fix-diffabledatasource-crash-in-payment-methods branch September 27, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore a pull request that has chore changes that shouldn't be in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants