-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New PushKit delegate method for iOS 11 #128
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,6 +180,10 @@ class ViewController: UIViewController, PKPushRegistryDelegate, TVONotificationD | |
self.deviceTokenString = nil | ||
} | ||
|
||
/** | ||
* Try using the `pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:` method if | ||
* your application is targeting iOS 11. This delegate method wil soon be deprecated by Apple. | ||
*/ | ||
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, forType type: PKPushType) { | ||
NSLog("pushRegistry:didReceiveIncomingPushWithPayload:forType:") | ||
|
||
|
@@ -188,6 +192,19 @@ class ViewController: UIViewController, PKPushRegistryDelegate, TVONotificationD | |
} | ||
} | ||
|
||
/** | ||
* This is delegate method is available in iOS 11 and above. Call the completion handler once the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* notification payload is passed to the `TwilioVoice.handleNotification()` method. | ||
*/ | ||
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { | ||
NSLog("pushRegistry:didReceiveIncomingPushWithPayload:forType:completion:") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. General Swift style comment, should't we use |
||
|
||
if (type == PKPushType.voIP) { | ||
TwilioVoice.handleNotification(payload.dictionaryPayload, delegate: self) | ||
} | ||
|
||
completion() | ||
} | ||
|
||
// MARK: TVONotificaitonDelegate | ||
func callInviteReceived(_ callInvite: TVOCallInvite) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,14 +167,31 @@ class ViewController: UIViewController, PKPushRegistryDelegate, TVONotificationD | |
self.deviceTokenString = nil | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this might be a copy/paste error of the comment. |
||
* This is delegate method is available in iOS 11 and above. Call the completion handler once the | ||
* notification payload is passed to the `TwilioVoice.handleNotification()` method. | ||
*/ | ||
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, forType type: PKPushType) { | ||
NSLog("pushRegistry:didReceiveIncomingPushWithPayload:forType:") | ||
|
||
if (type == PKPushType.voIP) { | ||
TwilioVoice.handleNotification(payload.dictionaryPayload, delegate: self) | ||
} | ||
} | ||
|
||
|
||
/** | ||
* This is delegate method is available in iOS 11 and above. Call the completion handler once the | ||
* notification payload is passed to the `TwilioVoice.handleNotification()` method. | ||
*/ | ||
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { | ||
NSLog("pushRegistry:didReceiveIncomingPushWithPayload:forType:completion:") | ||
|
||
if (type == PKPushType.voIP) { | ||
TwilioVoice.handleNotification(payload.dictionaryPayload, delegate: self) | ||
} | ||
|
||
completion() | ||
} | ||
|
||
// MARK: TVONotificaitonDelegate | ||
func callInviteReceived(_ callInvite: TVOCallInvite) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This delegate method is deprecated by Apple.
According to the docs.