Bu sayfada bulabilecekleriniz:
...
Code Block | ||
---|---|---|
| ||
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { RelatedDigital.handlePush(pushDictionary: userInfo) } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { RelatedDigital.handlePush(pushDictionary: userInfo) } func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { if completionHandler([.alert, .badge, .sound]) #available(iOS 14.0, *) { } func userNotificationCenter(_ center: UNUserNotificationCenter completionHandler([.banner, .sound, .badge, .list]) } else { completionHandler([.alert, .badge, .sound]) didReceive response: UNNotificationResponse, } } func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { RelatedDigital.handlePush(pushDictionary: response.notification.request.content.userInfo) completionHandler() } |
...
Code Block | ||
---|---|---|
| ||
RelatedDigital.setEmail(email: "test@relateddigital.com", permission: true) RelatedDigital.setEuroUserId(userKey: "1234567890") RelatedDigital.sync() |
Mobil kanaldan gelen datalarınızın RMC'ye yüklenebilmesi için, aktif RMC hesabınızda kullanmış olduğunuz referans değeriniz ne ise (KEY_ID* veya E-Mail) mobil kanaldan gelen dataların da bu referans ile gelmesine dikkat ediniz."
*KEY_ID: Uygulama sahibi tarafından müşterisinin tekilleştirilmesi için kullanılan id değerleridir. Bunlar CRM id, userid, customerid, accountid gibi farklı isimlerle ifade ediliyor olabilir.
...
getPushMessage fonksiyonunda payloadda pushId bulunmaktadır buraya o değeri ekleyeceksiniz.
Push Mesajlarını Silme
deleteAllPayloads ve deleteAllPayloadWithId fonksiyonlarını kullanarak getPushMessages fonksiyonumuz ile uygulamanız içerisinde gösterdiğiniz pushları silinde olarak işaretleyebilirsiniz.
Tüm bildirimleri silme
Code Block |
---|
RelatedDigital.deleteAllPayloads { completed in
print(completed)
} |
Bildirim bazlı silme
Code Block |
---|
RelatedDigital.deletePayloadWithId(pushId: "1234567890") { completed in
print(completed)
} |
Related Digital ile Firebase’i Ortak Kullanma
Uygulamanızda Related Digital SDK’mızı ve Firebase’i ortak kullanmak isterseniz uygulamanız içerisinde Notification Service Extension classına aşağıdaki kodu eklemeniz yeterli.
Code Block |
---|
import UserNotifications
import Euromsg
import FirebaseMessaging
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
if (self.bestAttemptContent != nil) {
var userInfo = self.bestAttemptContent?.userInfo;
let emPushSp = userInfo?["emPushSp"];
if (emPushSp != nil) {
print("--RelatedDigital Push")
userInfo?.removeValue(forKey: "fcm_options")
self.bestAttemptContent?.userInfo = userInfo!
Euromsg.configure(appAlias: "EuromsgIOSTestDev", launchOptions: nil, enableLog: true, appGroupsKey: "group.com.relateddigital.EuromsgExample.relateddigital", deliveredBadge: false)
Euromsg.didReceive(bestAttemptContent, withContentHandler: contentHandler)
} else {
print("--Firebase Push")
Messaging.serviceExtension().populateNotificationContent(self.bestAttemptContent!, withContentHandler: contentHandler)
}
}
}
override func serviceExtensionTimeWillExpire() {
guard let contentHandler = self.contentHandler else {
return;
}
guard let bestAttemptContent = self.bestAttemptContent else {
return;
}
contentHandler(bestAttemptContent)
}
}
|