Fix parsing of timeDescription while using Family Sharing#2
Fix parsing of timeDescription while using Family Sharing#2afwolfe wants to merge 4 commits intoBergQuester:mainfrom
Conversation
|
Wow, thanks! I've been pretty busy lately so it's going to take me a while before I can truest look this over. I had a go at fixing this some months ago, but life events got in the way. |
|
No problem! Take your time, I totally understand. |
|
I just made a revision to improve the handling based on testing this branch on transactions since I first made these changes. There seems to sometimes be some inconsistent behavior when VisionKit parses the screenshot and separates the fields. To address this, I added an |
When parsing Apple Card transaction screenshots while using Family Sharing, family member's names are prepended on the date line, which causes the date to be improperly defaulted to "Just now."
This PR attempts to address that by:
timeDescriptioncontains spaces and is not a relative timestamp and splits after the first space (the family member's name.)TransactionReaderOCRTextTeststo verify that the date parsing changes work.Date+currentandDate+mockwhich statically set the date for testing, adapting examples from: https://dev.to/ivanmisuno/deterministic-unit-tests-for-current-date-dependent-code-in-swift-2h72Note: The article also recommends adding a pre-commit hook to verify that
Date()is no longer used in the code in favor of the newDate.currentwhich is easier to mock in testing.