Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
109 stars 139 forks source link

Is there an iOS-specific equivalent of .getPushHistory? #329

Closed CodeWithOz closed 4 years ago

CodeWithOz commented 4 years ago

Hi, is there a recommended way to get the functionality of .getPushHistory on iOS? Obviously there isn't an equivalent method in the plugin's API, but is there a workaround? Thanks.

wfhm commented 4 years ago

Hi @CodeWithOz,

Plugin method for Android uses the internal getPushHistory method of our native Android SDK, which uses stored information about received pushes and returns it when the method is called. As for iOS, there simply is no such method, so you will need to create a NotificationServiceExtension in your Xcode project to intercept received pushes and handle them with the didReceive​ method to save them on a device. Then, you will need to create your own method to access this saved data and return a list of notifications when the method is called. Overall, this sounds too complicated to be done on your side, so may I ask you to describe your use-case in a bit more details? Do you think you can make use of our Inbox functionality?

CodeWithOz commented 4 years ago

@wfhm thanks for the explanation. Is there a guide on how to use the Inbox functionality? I only see docs for the endpoints but how about setting it up and the features/services it provides?

wfhm commented 4 years ago

@CodeWithOz,

For Cordova apps Inbox is available in the form of a customizable UI, which shows the list of all messages received by a user. These messages can be stored for a specified period of time, are interactable - the actions assigned to notifications will be performed if opened from the inbox. Also, push open statistics are counted. To show the UI, just call the presentInboxUI method. To customize the appearance of the UI you can use the InboxUiStyleManager class for Android and the PushwooshInboxUI.framework for iOS.