OneSignal-Cordova-SDK icon indicating copy to clipboard operation
OneSignal-Cordova-SDK copied to clipboard

Wrong type definition of OneSignal.postNotification() jsonData parameter

Open dmitry-salnikov opened this issue 3 years ago • 1 comments

OneSignal Cordova SDK version 3.0.1

The type definition says that notification data is passed as string:

https://github.com/OneSignal/OneSignal-Cordova-SDK/blob/5372e152c5057c30f65bd3506f07995b50214015/types/OneSignalPlugin.d.ts#L189-L196

However, the iOS native code expects NSDictionary

https://github.com/OneSignal/OneSignal-Cordova-SDK/blob/5372e152c5057c30f65bd3506f07995b50214015/src/ios/OneSignalPush.m#L307-L310

OneSignal.postNotification definition (OneSignal iOS SDK v3.9.1 as mentioned in release notes of OneSignal Cordova SDK v3.0.1):

https://github.com/OneSignal/OneSignal-iOS-SDK/blob/fd06483b314f842c16e0a6f74dfb27a04dc7df66/iOS_SDK/OneSignalSDK/Source/OneSignal.h#L502-L504

#pragma mark Post Notification
+ (void)postNotification:(NSDictionary* _Nonnull)jsonData;
+ (void)postNotification:(NSDictionary* _Nonnull)jsonData onSuccess:(OSResultSuccessBlock _Nullable)successBlock onFailure:(OSFailureBlock _Nullable)failureBlock;

Could you please fix this type definition?

dmitry-salnikov avatar Dec 11 '21 18:12 dmitry-salnikov

Thank you for reporting this @dmitry-salnikov,

We are making some typescript changes and this definition will be fixed.

nan-li avatar Apr 25 '22 22:04 nan-li