Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If you are using a version lower than 2.0.0 go here.

...

Code Block
languageswift
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
languageswift
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 = ""
    
    func carouselView.didReceive(_ notification: UNNotification) {
   }     funcnotificationRequestIdentifier didReceive(_ response: UNNotificationResponse,= notification.request.identifier
        Euromsg.configure(appAlias: "EuromsgIOSTest", launchOptions: nil, enableLog: true)
       completionHandler completion:  carouselView.didReceive(notification)
    }
    func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) {
        carouselView.didReceive(response, completionHandler: completion): completion)

    }
    override func loadView() {
        completion = { [weak self] url, bestAttemptContent in
            if let identifier = self?.notificationRequestIdentifier {
                UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [identifier])
                UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: { notifications in
                    bestAttemptContent?.badge = NSNumber(value: notifications.count)
     }     override func loadView() {   })
     completion = { [weak self] url, userInfo in}
            if let url = url {
                if #available(iOSApplicationExtension self?.extensionContext?.open(url)12.0, *) {
                if  url.scheme != self?.appUrlextensionContext?.scheme, let userInfo = userInfo {dismissNotificationContentExtension()
                }
      Euromsg.handlePush(pushDictionary: userInfo)         self?.extensionContext?.open(url)
       }     } else {
     }           if  else if let url = 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 track Hangiwhich 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)")
    }
    
}

The podfile file should be as follows. Then go to the project path through the terminal, type pod install and press enter.

...

Run the code below when the user successfully logs in, registers and the first time the application is opened.

In order for your data from the mobile channel to be uploaded to RMC, please pay attention that whatever reference value you have used in your active RMC account (KEY_ID * or E-Mail) comes from the mobile channel with this reference.

*KEY_ID: These are the id values ​​used by the application owner to deduplicate the customer. These can be expressed with different names such as CRMid, userid, customerid, accountid.

...