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

Update iOS initialization to configure from code instead of plist #62

Merged
merged 9 commits into from
Aug 1, 2024

Conversation

jpmunz
Copy link
Contributor

@jpmunz jpmunz commented Jul 30, 2024

Documentation changes in progress separately

Updating the JS side to accept a configuration object that for now is just used for iOS setup and passing that through to the swift code. Only a subset of configuration is exposed to get feature parity with what we allowed to be configured in 5.x

@jpmunz jpmunz requested review from TheMutsi and a team July 30, 2024 20:25
Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.48%. Comparing base (74e2b92) to head (d6b6e69).
Report is 1 commits behind head on 5.0.

Files Patch % Lines
packages/core/src/index.ts 87.50% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              5.0      #62      +/-   ##
==========================================
+ Coverage   78.21%   78.48%   +0.27%     
==========================================
  Files          28       28              
  Lines        1207     1218      +11     
  Branches       93       96       +3     
==========================================
+ Hits          944      956      +12     
+ Misses        263      262       -1     
Files Coverage Δ
packages/core/src/index.ts 89.79% <87.50%> (+1.56%) ⬆️

Copy link
Collaborator

@TheMutsi TheMutsi left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines 33 to 50
public init(from: NSDictionary) {
for (key, value) in from {
if let key = key as? String {
// Keys defined in packages/core/interfaces/Config.ts
if key == "appId", let value = value as? String {
appId = value
} else if key == "appGroupId", let value = value as? String {
appGroupId = value
} else if key == "disableCrashReporter", let value = value as? Bool {
disableCrashReporter = value
} else if key == "disableAutomaticViewCapture", let value = value as? Bool {
disableAutomaticViewCapture = value
} else if key == "endpointBaseUrl", let value = value as? String {
endpointBaseUrl = value
}
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont see any advantage to use for if we are going to check with if each variable inside. Maybe just decode the json with JSONDecoder (but it will fail if there is a typo error, you could handle the error)

or just something like this

  self.appGroupId = from["appGroupId"] as? String
  self.disableCrashReporter = from["disableCrashReporter"] as? Bool ?? false
  self.disableAutomaticViewCapture = from["disableAutomaticViewCapture"] as? Bool ?? false
  self.endpointBaseUrl = from["endpointBaseUrl"] as? String```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep that's much better, I didn't think to do it that way

ios?: {
appId: string;
appGroupId?: string;
disableCrashReporter?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

mmm shouldn't be there other attribute to set other crash reporter than us? like crashlitics or something like that, or that is managed in other place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was to keep feature parity for what we currently talk about in the docs: https://embrace.io/docs/react-native/integration/add-embrace-sdk/

so allowing the user to just disable our crash reporter. Automatically configuring crashlytics in place of ours would be more complicated and something we decided not to provide for now, a customer would have to do this themselves in objective-c / swift

@jpmunz jpmunz merged commit 009ee6e into 5.0 Aug 1, 2024
1 check passed
@jpmunz jpmunz deleted the jpmunz/EMBR-4350-updated-ios-setup branch August 1, 2024 18:57
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.

2 participants