Skip to content

Commit

Permalink
Send config requests unauthenticated so we can get feature flags befo…
Browse files Browse the repository at this point in the history
…re user is logged in
  • Loading branch information
KatherineInCode committed May 1, 2024
1 parent bc789c0 commit b0651c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions BitwardenShared/Core/Platform/Models/Domain/ServerConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ struct ThirdPartyServerConfig: Equatable, Codable {
/// Model for the environment URLs in a server configuration.
struct EnvironmentServerConfig: Equatable, Codable {
/// The API URL.
let api: String
let api: String?

/// The Cloud Region (e.g. "US")
let cloudRegion: String
let cloudRegion: String?

/// The Identity URL.
let identity: String
let identity: String?

/// The Notifications URL.
let notifications: String
let notifications: String?

/// The SSO URL.
let sso: String
let sso: String?

/// The Vault URL.
let vault: String
let vault: String?

init?(responseModel: EnvironmentServerConfigResponseModel?) {
guard let responseModel else { return nil }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ protocol ConfigAPIService {

extension APIService: ConfigAPIService {
func getConfig() async throws -> ConfigResponseModel {
try await apiService.send(ConfigRequest())
try await apiUnauthenticatedService.send(ConfigRequest())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ struct ThirdPartyConfigResponseModel: Equatable, JSONResponse {
/// API response model for the environment URLs in a configuration response.
struct EnvironmentServerConfigResponseModel: Equatable, JSONResponse {
/// The API URL.
let api: String
let api: String?

/// The Cloud Region (e.g. "US")
let cloudRegion: String
let cloudRegion: String?

/// The Identity URL.
let identity: String
let identity: String?

/// The Notifications URL.
let notifications: String
let notifications: String?

/// The SSO URL.
let sso: String
let sso: String?

/// The Vault URL.
let vault: String
let vault: String?
}
2 changes: 1 addition & 1 deletion BitwardenShared/Core/Platform/Services/ConfigService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class DefaultConfigService: ConfigService {
date: timeProvider.presentTime,
responseModel: configResponse
)
try await stateService.setServerConfig(serverConfig)
try? await stateService.setServerConfig(serverConfig)
return serverConfig
} catch {
errorReporter.log(error: error)
Expand Down

0 comments on commit b0651c1

Please sign in to comment.