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

feat(native-storage): add initWithSuiteName #3365

Merged
merged 2 commits into from
May 5, 2020

Conversation

tatham
Copy link
Contributor

@tatham tatham commented Apr 3, 2020

Required if you want to provide access to storage shared between apps in an app group in iOS.
Relevant section of the documentation for the plugin:
https://github.com/TheCocoaProject/cordova-plugin-nativestorage#usage

* @returns {Promise<any>}
*/
@Cordova()
initWithSuiteName(reference: string): Promise<any> {
Copy link
Owner

Choose a reason for hiding this comment

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

Please add an callback interface of set the return type to Promsie<void> if the callback is empty

Copy link
Contributor Author

@tatham tatham Apr 16, 2020

Choose a reason for hiding this comment

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

I don't understand, do you mean that the return type should be changed to Promise<void> or that it needs some logic to check for empty? I've found that the underlying plugin code doesn't recognise an undefined variable (or an empty string) as a null parameter, and so it never returns an error message.

Copy link
Owner

Choose a reason for hiding this comment

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

If your promise callback contains Data you should add an interface describing the data like Promise<MyCallbackInterface>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I was following the style of the other methods, which return Promise<any>, but I will change this to Promise<void>, as the plugin implementation never returns the error message.
I have two other questions:

  • I've realised that I can add platforms: ['iOS'] to the decorator, as this is iOS only. Should I do that?
  • Do I need to raise a separate PR if I want to add the same changes to the v4 branch?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, you should add the platform. Ionic Native 4 is not supported anymore so you don't have to create another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great, thanks. Requested changes have been made.

@danielsogl danielsogl self-assigned this Apr 15, 2020
@danielsogl danielsogl added the target: patch This PR is targeted for the next patch release label Apr 15, 2020
@danielsogl danielsogl merged commit a391e37 into danielsogl:master May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants