Notification Integration in IOS
caution
To use this library it is necessary to have the trust-service.json file with valid access credentials. In case you do not have it, follow the following link
#
Multimedia SpecificationsTo get a good visualization of the multimedia content. The images and videos have to satisfy the following dimension constraints.
- Dialog Notifications: Image with 340x320 aspect ratio
- Banner Notifications: Image with 340x400 aspect ratio
- Video Notifications: Video with 320x515 aspect ratio
#
Implementation#
Adding the PodIf you don’t have any pods, run the following command into the terminal at the project's location:
The command generates a file called Podfile. Open this file and add the following lines to the Podfile:
Then again in the command line console, run:
This will install the library code and firebase into your project.
#
Linking with the firebase projectThe Trust Notification Service uses a Firebase project. Please contact us at app@trust.lat to configure a project for your app. We will send you a file GoogleService-Info.plist
. Add this file to your project.
#
Service Notification ExtensionThe Service Notification Extension handles the view of the notification outside the app. In the image below we have an example.
To support this content, add the Service Notification Extension to your project. To do this, add a new target to the project clicking on File ---> New ---> Target ... ---> Notification Service Extension. The procedure is in the images below.
#
InitializeFor notification initialization consider the following link to implement Firebase, considering the pertinent calls for the use of the library.
To TrustDeviceInfo delegate consider implement the next:
Once client credentials is saved set:
Once the TrustID is saved set:
Add this files in Notification Service Extension
DialogNotificationsStructs.siwft
ParseNotifications.swift
Replace content of NotificationService.swift
#
PushNotificationsInit some methodsFrom an instance of PushNotificationsInit
- To get last 20 notification saved list, you should use the next method:
getLastTwentyNotifications() return an "Slice" that could be cast as an array
- Usage example:
- Set one test notificatión:
- Delete notification list
- You could use "Arrived Notification" & "Receive Data" observers to know about that Events.
Add images to project assets.
download the notifications icons here
Call images with these names:
#
PermissionsFor the correct use of this library, it is necessary to grant the application overwriting permission
Enable capabilities:
For more details about Keycahin sharing, see the following link in the permissions section https://github.com/trusttechnologies/lat_trust_mobile_ios_trust-identify_library
#
LicenseTrustNotification is released under the MIT license. See LICENSE for details.