Skip to content

Support IHateMoney QR codes - #93

Merged
InteractionEngineer merged 11 commits into
InteractionEngineer:mainfrom
magshee:fix/i-hate-money-qr-codes
Jul 22, 2026
Merged

Support IHateMoney QR codes#93
InteractionEngineer merged 11 commits into
InteractionEngineer:mainfrom
magshee:fix/i-hate-money-qr-codes

Conversation

@magshee

@magshee magshee commented May 28, 2026

Copy link
Copy Markdown
Contributor

Closes #90

This required a little more work than I had expected, but I’m really happy to made progress in this PR.

Here are the changes:

  • IHateMoney QR codes contain a PROJECT_TOKEN that can be used a as Bearer token for authentication. For some reason, the project identifier was stored in a variable called token. I decided to store the project identifier in a new field and use the token variable for the IHateMoney token.
  • I wanted to keep the existing functionality of adding a IHateMoneyProject via project identifier and password. And since Cospend QR codes also still provide these information instead of a project token, I chose to replace the usage of Tupels with actual data types that differ, depending on whether password or access token was used.
  • IHM projects can also be added by pasting the invite link via paste button

Thoughts for further consideration:

  • Some blocks of code (i.e. in AddProjectQRViewModel were already commented. If they are not used/required, maybe consider removing them
  • What is missing is the possibility to create a QR to share a IHateMoney project. This is currently only supported for Cospend projects.
  • Do you have any idea, what a MoneyBuster string is? I opened MoneyBuster and shared a project, and got a regular (not masked) project link

Eventually there are still things in here that can be improved, looking forward to your feedback!

@magshee
magshee force-pushed the fix/i-hate-money-qr-codes branch from 25a839f to ba76d31 Compare May 28, 2026 12:15
@InteractionEngineer
InteractionEngineer self-requested a review May 29, 2026 10:17
@InteractionEngineer

Copy link
Copy Markdown
Owner

Thank you very much for the extra effort, I'm happy to see it working now!

Unfortunately, during testing I finally got "the too many requests error" with my own cloud (no matter your new feature changes or my previous attempts to fix #81). I'd like to look into this first before continuing reviewing and testing you changes. A bit tight on capacity right now, but I'll try my best!

@magshee

magshee commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

Thank you very much for the extra effort, I'm happy to see it working now!

Unfortunately, during testing I finally got "the too many requests error" with my own cloud (no matter your new feature changes or my previous attempts to fix #81). I'd like to look into this first before continuing reviewing and testing you changes. A bit tight on capacity right now, but I'll try my best!

No worries, take your time!
Let me know when i should update my branch. The PR #94 already looks promising. I hope you finally got it fixed!

@InteractionEngineer

Copy link
Copy Markdown
Owner

Hi @magshee and happy WWDC! I catered to two issues seemingly more severe first and gladly none of those fixes touch any file you changed, so I'll be able to review and test your code regardless of that.

This is next on my list and I'm sorry it took so long, still – or even more so, I really appreciate your contribution and will try my best to merge it soon. Then it becomes time to push all the latest improvements to the AppStore. Liquid Glass will also be mandatory from Xcode 27 onwards, so that's another small exercise before getting the update out there. But also a great opportunity for some UI fixes I honestly feel more at home with. 😄

Comment thread PayForMe/Services/NetworkService.swift Outdated
Comment thread PayForMe/Util/Util.swift Outdated
Comment thread PayForMe/Services/ProjectManager.swift Outdated
Comment thread PayForMe/Views/Projects/QRCodes/AddProjectQRViewModel.swift Outdated
Comment thread PayForMe/Util/Util.swift
Comment thread PayForMeTests/UrlExtensionsTests.swift

@InteractionEngineer InteractionEngineer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for your patience! I am thrilled about the new functionalities, thanks for your work! I've had a look on the changes and left some comments that came to my mind – sorry, I fell back to German with those.

Regarding MoneyBuster: Unfortunately I don't have access to Android systems and assumed it must be a deep-link, like in iOS that opens within an app directly. If you see MoneyBuster works differently, please feel free to adjust our code.

One last important bit: Changing from token to projectId, or rather adding it and alter the previous token duty might / will affect historic app data. Were you able to test migration and see effects on projects added before your update? I confirmed it'll work really well with a blank database.

@magshee
magshee force-pushed the fix/i-hate-money-qr-codes branch from a7f4d83 to 0eef44d Compare June 26, 2026 10:42
@magshee
magshee force-pushed the fix/i-hate-money-qr-codes branch from 0eef44d to fea620e Compare June 26, 2026 10:49
@magshee

magshee commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your feedback! I'll address the last comment at some point in the next days!

@magshee

magshee commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

One last important bit: Changing from token to projectId, or rather adding it and alter the previous token duty might / will affect historic app data. Were you able to test migration and see effects on projects added before your update? I confirmed it'll work really well with a blank database.

I was currently testing the migration and stumbled upon a problem. I thought I had already done a successful test a few weeks ago, but this might only be with a cospend project. I'll let you know as soon as I could verify that both existing Cospend and IHM projects are sill working. It might take me a couple of days though, but thanks for your patience!

@InteractionEngineer

Copy link
Copy Markdown
Owner

I was currently testing the migration and stumbled upon a problem. I thought I had already done a successful test a few weeks ago, but this might only be with a cospend project. I'll let you know as soon as I could verify that both existing Cospend and IHM projects are sill working. It might take me a couple of days though, but thanks for your patience!

Thanks for your endurance and I'm really glad we caught it so early!

@magshee

magshee commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

I was finally able to test the migration for both Cospend and I Hate Money Projects.

I used the current state of the main branch, added a Cospend and a IHM Project and verified that both are working by adding an expense to each. I then started the "new" version from my branch, saw that the migration was successful and verified it by adding an expense to each project again.

I am fairly sure, that no more problems should arise here, but feel free to test it on your side again!

Sorry that this took more time than I had expected. I am glad, that I could finally give you an update here! If any new problems arise that could be caused by the migration, feel free to add me in the comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for iHateMoney QR codes / invite links and updates the data model so “project identifier” and “access token” are represented separately (via a new projectId field), including a storage migration and updated URL decoding.

Changes:

  • Introduces Project.projectId (and corresponding StoredProject.projectId) plus a GRDB migration to backfill legacy rows.
  • Refactors QR / URL decoding from tuple returns to typed ProjectData* models, adding iHateMoney QR decoding and invite-link paste support.
  • Updates networking to use projectId in iHateMoney API paths and to support Bearer-token auth in addition to Basic auth.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
PayForMeTests/UrlExtensionsTests.swift Updates URL decoding tests for typed project data; adds iHateMoney QR decoding coverage.
PayForMeTests/TestHelpers.swift Updates test project factories to include projectId.
PayForMeTests/StorageMigrationTests.swift Adds migration test for legacy iHateMoney rows (token → projectId).
PayForMeTests/NetworkRequestTests.swift Updates request URL expectations to use projectId for iHateMoney paths.
PayForMeTests/BalanceCalculationTests.swift Updates test project construction to include projectId.
PayForMe/Views/Projects/ShareProjectQRCodeViewModel.swift Shares Cospend QR codes using projectId instead of token.
PayForMe/Views/Projects/QRCodes/AddProjectQRViewModel.swift Updates QR scanning flow to handle password-based vs token-based project data.
PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift Adds invite token handling and paste parsing for iHateMoney links/tokens.
PayForMe/Views/Projects/Manual/AddProjectManualView.swift Updates manual add UI to support pasting links and entering invite tokens.
PayForMe/Util/Util.swift Replaces tuple “ProjectData” with typed models; adds iHateMoney decoding and updated QR dispatch.
PayForMe/Services/StorageService.swift Adds v4 migration and exposes migrator for tests; backfills projectId.
PayForMe/Services/ProjectManager.swift Allows app-opened URLs for both Cospend and iHateMoney schemes.
PayForMe/Services/NetworkService.swift Uses projectId for iHateMoney paths; adds Bearer invite-token project-name lookup.
PayForMe/SceneDelegate.swift Accepts ihatemoney scheme in openURLContexts.
PayForMe/Model/Project.swift Adds projectId to Project/StoredProject and updates initializers/previews.
PayForMe.xcodeproj/project.pbxproj Adds StorageMigrationTests.swift to the test target.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift
Comment thread PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift
Comment thread PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift
Comment thread PayForMe/Util/Util.swift
Comment thread PayForMe/Services/NetworkService.swift
Comment thread PayForMeTests/UrlExtensionsTests.swift
@InteractionEngineer

Copy link
Copy Markdown
Owner

Hi @magshee – awesome, thank you for your contribution!

I ran the copilot review, evaluated the findings and pushed some minor improvements. It's now ready to be merged and I think we have enough fixes for an iOS update. As I wasn't the fastest myself with further (frontend) improvements, I don't want the community to have to wait any longer for all the fixes on the main branch right now. I'll take care of the publishing process and handle the past due Liquid Glass changes at the same time.

@InteractionEngineer
InteractionEngineer merged commit 28c874b into InteractionEngineer:main Jul 22, 2026
1 check passed
@magshee

magshee commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Sound good! Looking forward to the new release!

@magshee
magshee deleted the fix/i-hate-money-qr-codes branch July 30, 2026 06:33
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.

IHateMoney QR Codes

3 participants