[PM-37864] feat: Hide create account button based on server disableUserRegistration config#2865
[PM-37864] feat: Hide create account button based on server disableUserRegistration config#2865fedemkr wants to merge 7 commits into
Conversation
… selector Adds a `.gov` RegionType case backed by bitwarden-gov.com default URLs so users can select the new government cloud environment from the region selector, ahead of the broader FedRAMP support work tracked in PM-35110.
# Conflicts: # BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLData.swift # BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLs.swift # BitwardenShared/Core/Platform/Models/Enum/RegionType.swift # BitwardenShared/Core/Platform/Models/Enum/RegionTypeTests.swift # BitwardenShared/Core/Platform/Services/EnvironmentService.swift # BitwardenShared/UI/Auth/Utilities/RegionHelper.swift
…erRegistration config Adds `settings.disableUserRegistration` to `ConfigResponseModel` and `ServerConfig`. The landing processor subscribes to `configPublisher` in `init` and reactively hides the "New around here? Create account" row whenever the server signals that user registration is disabled.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the addition of Code Review Details
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2865 +/- ##
===========================================
- Coverage 81.27% 40.57% -40.71%
===========================================
Files 1027 357 -670
Lines 66109 16675 -49434
===========================================
- Hits 53733 6766 -46967
+ Misses 12376 9909 -2467 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| Task { | ||
| for await metaConfig in await services.configService.configPublisher() { | ||
| guard metaConfig?.isPreAuth == true else { continue } | ||
| self.state.isCreateAccountButtonHidden = metaConfig?.serverConfig? | ||
| .settings?.disableUserRegistration == true | ||
| } | ||
| } |
There was a problem hiding this comment.
Task strongly captures self, leaking the processor.
Details and fix
configPublisher() is backed by a Never-failing subject that never completes, so this for await loop runs indefinitely and the Task retains self (the LandingProcessor) for the lifetime of the app. When the landing screen is dismissed, the processor cannot deallocate.
Unlike ClientService / ServerCommunicationConfigClientSingleton (which use this pattern but are app-lifetime singletons where the retain is harmless), a StateProcessor is screen-scoped and expected to deallocate. Other processors that hold long-lived tasks use [weak self] (e.g. VaultListProcessor, AppProcessor).
Task { [weak self] in
guard let configPublisher = await self?.services.configService.configPublisher() else { return }
for await metaConfig in configPublisher {
guard metaConfig?.isPreAuth == true else { continue }
self?.state.isCreateAccountButtonHidden = metaConfig?.serverConfig?
.settings?.disableUserRegistration == true
}
}
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-37864
📔 Objective
Adds a
settings.disableUserRegistrationfield toConfigResponseModeland theServerConfigdomain model, populated from the server's/configresponse.The landing processor subscribes to
configPublisherininitand reactively updatesLandingState.isCreateAccountButtonHiddenwhenever a pre-auth config is emitted. The "New around here? Create account" row inLandingViewis removed from the view hierarchy entirely when the flag istrue.