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

Allow custom base override #513

Merged
merged 3 commits into from
Jun 25, 2024
Merged

Allow custom base override #513

merged 3 commits into from
Jun 25, 2024

Conversation

bamx23
Copy link
Collaborator

@bamx23 bamx23 commented Jun 23, 2024

This PR removes constroctors of KSCrash class, but allows setting a custom base path via a helper static method.

As there are cases when shared instance of KSCrash is used from inside of the library code we need to make sure that base path is consistent.

Also, in general, KSCrash is intended to be a singletone as the most of C API under the hood operates with global state. Multiple instances of KSCrash was never supported.

@bamx23 bamx23 requested a review from GLinnik21 June 23, 2024 11:41
Sources/KSCrashRecording/include/KSCrash.h Outdated Show resolved Hide resolved
* @note This method SHOULD be called before any use of `sharedInstance` method.
* Any call of this method after that is ignored.
*/
(void) setBasePath:(nullable NSString*) basePath;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This means that user would try to change it after the installation. Maybe better move it to KSCrashConfiguration as a compulsory init parameter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Configuration only provided to install. And I can use KSCrash instance without calling install (e.g. to send reports).

Copy link
Collaborator

Choose a reason for hiding this comment

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

The dependency on the sharedInstance method call to determine whether the base path can be changed creates non-obvious behavior. It's not immediately clear to developers when they can or cannot change the base path. But I don't see a better solution without creating a separate instance of KSCrash.

@bamx23 bamx23 merged commit 118810e into master Jun 25, 2024
20 checks passed
@bamx23 bamx23 deleted the add-custom-base-path-api branch June 25, 2024 22:32
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.

None yet

2 participants