OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com
Other
250 stars 197 forks source link

Wrong type definition of OneSignal.postNotification() jsonData parameter #757

Open dmitry-salnikov opened 2 years ago

dmitry-salnikov commented 2 years ago

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?

nan-li commented 2 years ago

Thank you for reporting this @dmitry-salnikov,

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