Skip to content

Commit

Permalink
Deprecating Embrace.Endpoints.developmentBaseURL (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoEmbrace authored Feb 27, 2025
1 parent a5d957a commit 24e72cb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
7 changes: 3 additions & 4 deletions Sources/EmbraceCore/Internal/Embrace+Setup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ extension Embrace {
return nil
}

let baseUrl = EMBDevice.isDebuggerAttached ? endpoints.developmentBaseURL : endpoints.baseURL
guard let spansURL = URL.spansEndpoint(basePath: baseUrl),
let logsURL = URL.logsEndpoint(basePath: baseUrl),
let attachmentsURL = URL.attachmentsEndpoint(basePath: baseUrl) else {
guard let spansURL = URL.spansEndpoint(basePath: endpoints.baseURL),
let logsURL = URL.logsEndpoint(basePath: endpoints.baseURL),
let attachmentsURL = URL.attachmentsEndpoint(basePath: endpoints.baseURL) else {
Embrace.logger.error("Failed to initialize endpoints!")
return nil
}
Expand Down
22 changes: 16 additions & 6 deletions Sources/EmbraceCore/Options/Embrace+Endpoints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,31 @@ extension Embrace {
/// The base URL to upload session data
@objc public let baseURL: String

/// The base URL to upload session data while a debugger is attached
@objc public let developmentBaseURL: String

/// The base URL to retrieve remote config
@objc public let configBaseURL: String

@available(*, deprecated, message: "Development base URL is not used anymore.")
@objc public let developmentBaseURL: String = ""

/// Initializer that allows for custom endpoints.
/// - Note: If you wish to use the default endpoints please refer to the convenience initializer: `init(appId: String)`.
/// - Parameters:
/// - baseURL: Endpoint for session data upload
/// - configBaseURL: Endpoint to fetch the remote config
@objc public init(baseURL: String, configBaseURL: String) {
self.baseURL = baseURL
self.configBaseURL = configBaseURL
}

/// Initializer that allows for custom endpoints.
/// - Note: If you wish to use the default endpoints please refer to the convenience initializer: `init(appId: String)`.
/// - Parameters:
/// - baseURL: Endpoint for session data upload
/// - developmentBaseURL: Endpoint for session data upload while debugging
/// - configBaseURL: Endpoint to fetch the remote config
@available(*, deprecated, message: "Use `init(baseURL:configBaseURL)` instead.")
@objc public init(baseURL: String, developmentBaseURL: String, configBaseURL: String) {
self.baseURL = baseURL
self.developmentBaseURL = developmentBaseURL
self.configBaseURL = configBaseURL
}
}
Expand All @@ -39,7 +49,7 @@ extension Embrace.Endpoints {
@objc convenience init(appId: String) {
self.init(
baseURL: "https://a-\(appId).data.emb-api.com",
developmentBaseURL: "https://data-dev.emb-api.com",
configBaseURL: "https://a-\(appId).config.emb-api.com")
configBaseURL: "https://a-\(appId).config.emb-api.com"
)
}
}
2 changes: 1 addition & 1 deletion Tests/EmbraceCoreTests/Options/Embrace+OptionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class Embrace_OptionsTests: XCTestCase {
}

func test_init_withEndpoints_setsEndpoints() throws {
let endpoints = Embrace.Endpoints(baseURL: "base", developmentBaseURL: "base", configBaseURL: "config")
let endpoints = Embrace.Endpoints(baseURL: "base", configBaseURL: "config")
let options = Embrace.Options(appId: "myApp", endpoints: endpoints, captureServices: [], crashReporter: nil)
XCTAssertEqual(options.endpoints, endpoints)
}
Expand Down
1 change: 0 additions & 1 deletion Tests/EmbraceCoreTests/Public/EmbraceCoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ final class EmbraceCoreTests: XCTestCase {
// use fake endpoints
let endpoints = Embrace.Endpoints(
baseURL: "https://embrace.\(testName).com/api",
developmentBaseURL: "https://embrace.\(testName).com/api-dev",
configBaseURL: "https://embrace.\(testName).com/config"
)

Expand Down
1 change: 0 additions & 1 deletion Tests/EmbraceCoreTests/Public/EmbraceEndpointsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ final class EmbraceEndpointsTests: XCTestCase {

// then the URLs have the correct domains
XCTAssert(endpoints.baseURL.contains("a-appId"))
XCTAssertFalse(endpoints.developmentBaseURL.contains("a-appId"))
XCTAssert(endpoints.configBaseURL.contains("a-appId"))
}
}

0 comments on commit 24e72cb

Please sign in to comment.