Skip to content

Instantly share code, notes, and snippets.

@kwylez
Created April 1, 2016 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwylez/054de538b925beea7864ec170529357d to your computer and use it in GitHub Desktop.
Save kwylez/054de538b925beea7864ec170529357d to your computer and use it in GitHub Desktop.
private func execute(launchKey: String, hookType: NotificationHookType, info: Dictionary<String, AnyObject>) -> Void {
guard let notificationConfiguration = self.configuration,
let notificationHooks = notificationConfiguration.notificationHooks,
let ignoreTypes = notificationConfiguration.notificationTypesToIgnore else { return }
let hook = notificationHooks.filter({ k, v in k == launchKey && !ignoreTypes.contains(k)})
if !hook.isEmpty {
guard let hookBlock = hook.first else { return }
let key: String = hookBlock.0
let executionBlock: NotificationHookBlock = notificationHooks[key]! as NotificationHookBlock
executionBlock(userInfo: info, hookType: hookType)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment