arleyandrada / PushClient

FREE and Open Source - Titanium PushClient Module
Other
44 stars 17 forks source link

oneSignal ios event callback returns number #146

Closed dpz3579 closed 7 years ago

dpz3579 commented 7 years ago

the onesignal event call back returns numbers for MODE_FOREGROUND as 1 MODE_CLICK as 2 & so on...

dpz3579 commented 7 years ago

onesignal issues on ios event callback...

arleyandrada commented 7 years ago

They are already integer (number) constants.

PushClient.MODE_FOREGROUND == 1
PushClient.MODE_CLICK == 2
PushClient.MODE_BACKGROUND == 3
PushClient.MODE_ACTION == 4

Check it out:

https://github.com/arleyandrada/PushClient/blob/master/modules/ios/iphone/Classes/BrComArlsoftPushclientModule.h

@property(nonatomic,readonly) NSNumber* MODE_FOREGROUND;
@property(nonatomic,readonly) NSNumber* MODE_CLICK;
@property(nonatomic,readonly) NSNumber* MODE_BACKGROUND;
@property(nonatomic,readonly) NSNumber* MODE_ACTION;

https://github.com/arleyandrada/PushClient/blob/master/modules/ios/iphone/Classes/BrComArlsoftPushclientModule.m

NSNumber* const CONST_MODE_FOREGROUND = 1;
NSNumber* const CONST_MODE_CLICK = 2;
NSNumber* const CONST_MODE_BACKGROUND = 3;
NSNumber* const CONST_MODE_ACTION = 4;

MAKE_SYSTEM_PROP(MODE_FOREGROUND,CONST_MODE_FOREGROUND);
MAKE_SYSTEM_PROP(MODE_CLICK,CONST_MODE_CLICK);
MAKE_SYSTEM_PROP(MODE_BACKGROUND,CONST_MODE_BACKGROUND);
MAKE_SYSTEM_PROP(MODE_ACTION,CONST_MODE_ACTION);

And it is not different to the onesignal or any other push notification provider.

dpz3579 commented 7 years ago

ok... i didn't try on ios 8 & above,

i was testing on my old iphone 4, with ios 7.2, and was unable to get the status, so posted..

even there was one more change in this merge...

alert('Callback from Click:\n\n' + (OS_ANDROID) ? (JSON.stringify(JSON.parse(event.data.custom).a)) : JSON.stringify(event.data.custom.a));

the callback for click custom data is obtained in different format in ios & android.

even confirmed push opener is like.. for android Provider.confirmPushOpened(JSON.parse(event.data.custom).i) & for ios is Provider.confirmPushOpened(event.data.custom.i)

i found it while testing on ios & android..