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

[PLAT-7597] Load config when starting with API key #1245

Merged
merged 1 commit into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Bugsnag/Bugsnag.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ + (BugsnagClient *_Nonnull)start {
}

+ (BugsnagClient *_Nonnull)startWithApiKey:(NSString *_Nonnull)apiKey {
BugsnagConfiguration *configuration = [[BugsnagConfiguration alloc] initWithApiKey:apiKey];
BugsnagConfiguration *configuration = [BugsnagConfiguration loadConfig];
configuration.apiKey = apiKey;
return [self startWithConfiguration:configuration];
}

Expand Down
8 changes: 8 additions & 0 deletions features/app_and_device_attributes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ Feature: App and Device attributes present
And the error payload field "events.0.device.manufacturer" equals "Nokia"
And the error payload field "events.0.device.modelNumber" equals "0898"

Scenario: Info.plist settings are used when calling startWithApiKey
When I run "AppAndDeviceAttributesScenarioStartWithApiKey"
And I wait to receive an error
Then the error is valid for the error reporting API
And the error "Bugsnag-API-Key" header equals "12312312312312312312312312312312"

And the error payload field "events.0.app.releaseStage" equals "beta2"

Scenario: Duration value increments as expected
When I run "AppDurationScenario"
And I wait to receive 3 errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,25 @@ class AppAndDeviceAttributesScenarioCallbackOverride: Scenario {

// MARK: -

/**
* Call startWithApiKey
*/
class AppAndDeviceAttributesScenarioStartWithApiKey: Scenario {

override func startBugsnag() {
Bugsnag.start(withApiKey: "12312312312312312312312312312312")

super.startBugsnag()
}

override func run() {
let error = NSError(domain: "AppAndDeviceAttributesScenarioStartWithApiKey", code: 100, userInfo: nil)
Bugsnag.notifyError(error)
}
}

// MARK: -

class AppAndDeviceAttributesInfiniteLaunchDurationScenario: Scenario {

override func startBugsnag() {
Expand Down