Skip to content

Conversation

@nicodh
Copy link
Member

@nicodh nicodh commented Oct 16, 2025

related to #5563

Introduce new type SCAN_CONTEXT_TYPE to handle qr codes scans more appropriate.

For now it just has impact for the "Add second device" & the "Use other server" context.

}

export const enum SCAN_CONTEXT_TYPE {
DEFAULT = 'DEFAULT', // default context, no restrictions on qr code types
Copy link
Member Author

Choose a reason for hiding this comment

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

TBD: we have a lot of use cases where we just pass the "DEFAULT" and only 2 where we pass other contexts. So we could make the parameter optional and have less code. At the same time it increases the risk to "forget" the scan context parameter in new use cases and introduce new wrong handlings in future.

Copy link
Member

Choose a reason for hiding this comment

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

makes more sense to protect against risk of forgetting cases by making things more explicit in this case IMO


const onClick = () => {
processQr(accountId, inviteLinkTrimmed)
processQr(accountId, inviteLinkTrimmed, SCAN_CONTEXT_TYPE.DEFAULT)
Copy link
Member Author

Choose a reason for hiding this comment

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

TBD: the qr button here comes with the text "New contact" but in fact it opens the general qr code scanner. We could restrict this context to only allow qr codes that in fact "introduce a new contact".
In Android the scanner opened here has no limitations like that...

The same applies to the dialogs in InvalidUncryptedMail & ProtectionStatusDialog.

Copy link
Member

Choose a reason for hiding this comment

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

I think it is fine in those cases, as there are specific dialogs for scanning account creation codes
image
and add as second device codes:
image

Copy link
Member

@Simon-Laux Simon-Laux Oct 16, 2025

Choose a reason for hiding this comment

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

although the multi-device setup dialog text should be updated, the account switcher is not behind a "logout" action anymore. ideally it should also just say "you are about to sync your existing profile to this device, this will not overwrite your current profile, continue?" or sth. like that. and the ok button would just create a new unconfigured profile and execute the code again, like it is done for scanning dcaccount: links

@nicodh nicodh marked this pull request as draft October 16, 2025 06:58
@nicodh nicodh force-pushed the handle-scan-context branch from c31797c to d523f73 Compare October 16, 2025 07:07
@nicodh nicodh changed the title Introduce new type SCAN_CONTEXT_TYPE fix: handöe wrong qr code scans Oct 16, 2025
@nicodh nicodh changed the title fix: handöe wrong qr code scans fix: handle wrong qr code scans Oct 16, 2025
@nicodh nicodh marked this pull request as ready for review October 16, 2025 14:43
Copy link
Member

@WofWca WofWca left a comment

Choose a reason for hiding this comment

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

I have confirmed that the "add as second device" and "scan invitation code" workflows are not broken, at least for askVerifyContact and login.
And this works otherwise.

@nicodh nicodh merged commit 9dc87a8 into main Oct 22, 2025
10 checks passed
@nicodh nicodh deleted the handle-scan-context branch October 22, 2025 11:40
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.

4 participants