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

Add sunset banners guiding users to install Element X when registering against a server with MAS. #7890

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

pixlwave
Copy link
Member

@pixlwave pixlwave commented Jan 9, 2025

This PR makes the following changes:

  • Throw a specific error when configuring registration if the delegatedOIDCCompatibility flag is true.
  • Use this error to show the sunset banners when selecting a server with MAS for registration.
  • Ignore this error when starting the flow against the default server, instead configuring the registration screen to also show the sunset banners.

Closes #7889.

Selecting a server that requires MAS

ScreenRecording_01-09-2025.10-42-52.am_1.MP4

Default server requires MAS

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-01-08.at.15.56.30.mp4

@@ -148,8 +148,13 @@ class AuthenticationService: NSObject {
self.registrationWizard = registrationWizard
} catch {
guard homeserver.preferredLoginMode.hasSSO, error as? RegistrationError == .registrationDisabled else {
throw error
if homeserver.preferredLoginMode.providesDelegatedOIDCCompatibility {
throw RegistrationError.delegatedOIDCRequiresReplacementApp
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm mixed about this now I have implemented it. Maybe this shouldn't throw an error at all, instead letting the 2 screens read that providesDelegatedOIDCCompatibility property from the homeserver to show the banners. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

It probably would've been nice but the current solution isn't that bad either so probably not worth the trouble to change it.

@pixlwave pixlwave requested a review from stefanceriu January 9, 2025 10:50
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 48.40764% with 162 lines in your changes missing coverage. Please review.

Project coverage is 15.12%. Comparing base (d8bcc18) to head (da14867).
Report is 15 commits behind head on develop.

Files with missing lines Patch % Lines
...on/Test/UI/AuthenticationRegistrationUITests.swift 0.00% 25 Missing ⚠️
.../AuthenticationServerSelectionViewModelTests.swift 0.00% 25 Missing ⚠️
...nit/AuthenticationRegistrationViewModelTests.swift 0.00% 23 Missing ⚠️
...tor/AuthenticationServerSelectionCoordinator.swift 0.00% 22 Missing ⚠️
...inator/AuthenticationRegistrationCoordinator.swift 0.00% 17 Missing ⚠️
...Test/UI/AuthenticationServerSelectionUITests.swift 0.00% 12 Missing ⚠️
...stration/AuthenticationRegistrationViewModel.swift 33.33% 8 Missing ⚠️
...les/Authentication/AuthenticationCoordinator.swift 0.00% 7 Missing ⚠️
...s/Common/Sunset/SunsetOIDCRegistrationBanner.swift 81.25% 6 Missing ⚠️
...I/Modules/Common/Sunset/SunsetDownloadBanner.swift 87.80% 5 Missing ⚠️
... and 6 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7890      +/-   ##
===========================================
+ Coverage    15.08%   15.12%   +0.04%     
===========================================
  Files         1810     1812       +2     
  Lines       173591   173859     +268     
  Branches     67305    67389      +84     
===========================================
+ Hits         26185    26298     +113     
- Misses      147370   147523     +153     
- Partials        36       38       +2     
Flag Coverage Δ
uitests 52.76% <65.81%> (+0.01%) ⬆️
unittests 9.06% <8.30%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

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

Good stuff, lgtm 👍

Config/BuildSettings.swift Outdated Show resolved Hide resolved
Config/BuildSettings.swift Show resolved Hide resolved
@@ -148,8 +148,13 @@ class AuthenticationService: NSObject {
self.registrationWizard = registrationWizard
} catch {
guard homeserver.preferredLoginMode.hasSSO, error as? RegistrationError == .registrationDisabled else {
throw error
if homeserver.preferredLoginMode.providesDelegatedOIDCCompatibility {
throw RegistrationError.delegatedOIDCRequiresReplacementApp
Copy link
Member

Choose a reason for hiding this comment

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

It probably would've been nice but the current solution isn't that bad either so probably not worth the trouble to change it.

@pixlwave pixlwave merged commit 3d5171e into develop Jan 10, 2025
10 checks passed
@pixlwave pixlwave deleted the doug/mas-registration-banner branch January 10, 2025 13:22
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.

[Task] Guide new Element *classic* users with MAS HS to use EX
2 participants