Eğer Euromsg SDK 2.0.0 versiyonundan düşük bir versiyon kullanıyorsanız buraya gidin.
...
Code Block | ||
---|---|---|
| ||
import UserNotifications import Euromsg 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) Euromsg.configure(appAlias: "YOUR_APP_ALIAS"EuromsgIOSTest", launchOptions: nil, enableLog: true) Euromsg.didReceive(bestAttemptContent, withContentHandler: contentHandler) } override func serviceExtensionTimeWillExpire() { guard let contentHandler = self.contentHandler else { return; } guard let bestAttemptContent = self.bestAttemptContent else { return; } contentHandler(bestAttemptContent) } } |
...
Code Block | ||
---|---|---|
| ||
import UIKit import UserNotifications import UserNotificationsUI import Euromsg @available(iOS 10.0, *) @objc(EMNotificationViewController) class EMNotificationViewController: UIViewController, UNNotificationContentExtension { let appUrl = URL(string: "euromsgExample://") let carouselView = EMNotificationCarousel.initView() var completion: ((_ url: URL?, _ userInfobestAttemptContent: [AnyHashable: Any]?) UNMutableNotificationContent?) -> Void)? func didReceive(_ notification: UNNotification) { var notificationRequestIdentifier = "" carouselView.didReceive(notification) } func didReceive(_ responsenotification: UNNotificationResponse,UNNotification) { notificationRequestIdentifier = notification.request.identifier completionHandler completionEuromsg.configure(appAlias: @escaping ("EuromsgIOSTest", launchOptions: nil, enableLog: true) carouselView.didReceive(notification) } func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) { carouselView.didReceive(response, completionHandler: completion) } override func loadView() { completion = { [weak self] url, userInfo in bestAttemptContent in if let identifier = self?.notificationRequestIdentifier { UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [identifier]) UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: { notifications in bestAttemptContent?.badge = NSNumber(value: notifications.count) }) } if let url = url { self?.extensionContext?.open(url) if #available(iOSApplicationExtension 12.0, *) { if url.scheme != self?.appUrlextensionContext?.scheme,dismissNotificationContentExtension() let userInfo = userInfo { Euromsg.handlePush(pushDictionary: userInfo) } }self?.extensionContext?.open(url) } else { else if let urlif = self?.appUrl#available(iOSApplicationExtension 12.0, *) { self?.extensionContext?.openperformNotificationDefaultAction(url) } } } carouselView.completion = completion } //Hangi öğenin seçildiğini izlemekcarouselView.completion istiyorsanız= ekleyincompletion carouselView.delegate = self self.view = carouselView } } /** Add if you want to Hangitrack which carousel öğesininelement seçildiğinihas izlemekbeen istiyorsanız ekleyinselected */ extension EMNotificationViewController: CarouselDelegate { func selectedItem(_ element: EMMessage.Element) { // Add your work... print("Selected element is => \(element)") } } |
NotificationContent ve NotificationService için Euromsg SDK’sını eklemeliyiz. Podfile dosyanızı aşağıdaki şekilde düzenleyin ve tekrar terminalden proje dizininize giderek pod install yazarak enter tuşuna basın.
...
Code Block | ||
---|---|---|
| ||
Euromsg.setEmail(email: "test@relateddigital.com", permission: true) Euromsg.setEuroUserId(userKey: "1234567890") Euromsg.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.
...