Skip to content

Commit

Permalink
3.10.0 release (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsarika authored Oct 16, 2023
1 parent 7d15120 commit d87fba8
Show file tree
Hide file tree
Showing 61 changed files with 2,178 additions and 141 deletions.
62 changes: 53 additions & 9 deletions KitchenSink.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

152 changes: 87 additions & 65 deletions KitchenSink/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,24 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
}

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
guard let authType = UserDefaults.standard.string(forKey: "loginType") else { return }
if authType == "jwt" {
initWebexUsingJWT()
} else if authType == "token" {
initWebexUsingToken()
} else {
initWebexUsingOauth()
}
DispatchQueue.main.async {
webex.initialize { success in
if success {
do {
let data = try JSONSerialization.data(withJSONObject: userInfo, options: .prettyPrinted)
let string = String(data: data, encoding: .utf8) ?? ""
print("Received push: string")
print(string)
webex.phone.processPushNotification(message: string) { error in
if let error = error {
print("processPushNotification error" + error.localizedDescription)
}
}
}
catch (let error){
print(error.localizedDescription)
print("enter didReceiveRemoteNotification")
if let webex = webex, webex.authenticator?.authorized == true {
do {
let data = try JSONSerialization.data(withJSONObject: userInfo, options: .prettyPrinted)
let string = String(data: data, encoding: .utf8) ?? ""
print("Received push: string")
print(string)
webex.phone.processPushNotification(message: string) { error in
print("didReceiveRemoteNotification processPushNotification")
if let error = error {
print("didReceiveRemoteNotification processPushNotification error" + error.localizedDescription)
}

}
}
}
catch (let error){
print("didReceiveRemoteNotification processPushNotification exception" + error.localizedDescription)
}
}
}

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
Expand Down Expand Up @@ -177,63 +166,96 @@ extension AppDelegate: PKPushRegistryDelegate {
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
debugPrint("Received push: voIP")
debugPrint(payload.dictionaryPayload)
print("enter voip didReceiveIncomingPushWith")

if type == .voIP {
// Report the call to CallKit, and let it display the call UI.
guard let bsft = payload.dictionaryPayload["bsft"] as? [String: Any], let sender = bsft["sender"] as? String else {
print("payload not valid")
guard let callerInfo = webex.parseVoIPPayload(payload: payload) else {
print("error parsing VoIP payload")
return
}
print("callerInfo: \(String(describing: callerInfo))")
if CallObjectStorage.shared.getAllActiveCalls().count > 0 // ignore if there is already active call, it will be handled in webex.phone.onIncoming
{
return
}
voipUUID = UUID()
print("payload voip: \(bsft)")
print("voipUUID: \(voipUUID)")
print("didReceiveIncomingPushWith uuid \(String(describing: voipUUID!))")
self.callKitManager?.reportIncomingCallFor(uuid: voipUUID!, sender: sender) {
self.callKitManager?.reportIncomingCallFor(uuid: voipUUID!, sender: callerInfo.name) {
self.establishConnection(payload: payload)
completion()
return
}
}
}

func establishConnection(payload: PKPushPayload) {
guard let authType = UserDefaults.standard.string(forKey: "loginType") else { return }
if authType == "jwt" {
initWebexUsingJWT()
} else if authType == "token" {
initWebexUsingToken()
} else {
initWebexUsingOauth()
}
DispatchQueue.main.async {
webex.initialize { [weak self] success in
if success {
webex.phone.onIncoming = { [weak self] call in
if call.isWebexCallingOrWebexForBroadworks {
print("webex.phone.onIncoming calll \(String(describing: call.callId))")
self?.callKitManager?.updateCall(call: call)
}
}
do {
let data = try JSONSerialization.data(withJSONObject: payload.dictionaryPayload, options: .prettyPrinted)
let string = String(data: data, encoding: .utf8) ?? ""
print("Received push: string")
print(string)
webex.phone.processPushNotification(message: string) { error in
if let error = error {
print("processPushNotification error" + error.localizedDescription)
}
}
}
catch (let error){
print(error.localizedDescription)
}

} else {
print("Failed to initialise WebexSDK on receiving incoming call push notification")
fileprivate func processVoipPush(payload: PKPushPayload) {
print("enter processVoipPush")

webex.phone.onIncoming = { [weak self] call in
print("processVoipPush onIncoming")

if call.isWebexCallingOrWebexForBroadworks {
if CallObjectStorage.shared.getAllActiveCalls().count > 0
{
voipUUID = UUID()
print("voipUUID: \(voipUUID)")
self?.callKitManager?.reportIncomingCallFor(uuid: voipUUID!, sender: call.title ?? "") {
self?.callKitManager?.updateCall(call: call, voipUUID: voipUUID)
return
}
}
print("webex.phone.onIncoming: incoming call arrived callID: \(String(describing: call.callId))")
self?.callKitManager?.updateCall(call: call, voipUUID: voipUUID)
}
}
do {
let data = try JSONSerialization.data(withJSONObject: payload.dictionaryPayload, options: .prettyPrinted)
let string = String(data: data, encoding: .utf8) ?? ""
print("Received push: string")
print(string)
webex.phone.processPushNotification(message: string) { error in
print("processVoipPush processPushNotification")

if let error = error {
print("processVoipPush processPushNotification error" + error.localizedDescription)
}
}
}
catch (let error){
print("processVoipPush processPushNotification exception" + error.localizedDescription)
}
}

func establishConnection(payload: PKPushPayload) {
if let webex = webex, webex.authenticator?.authorized == true {
processVoipPush(payload: payload)
return
}

guard let authType = UserDefaults.standard.string(forKey: "loginType") else { return }
if authType == "jwt" {
initWebexUsingJWT()
} else if authType == "token" {
initWebexUsingToken()
} else {
initWebexUsingOauth()
}
print("processVoipPush before webex.initialize")

DispatchQueue.main.async {
webex.initialize { [weak self] success in
print("processVoipPush after webex.initialize" + "\(success)")

if success {
self?.processVoipPush(payload: payload)
} else {
print("Failed to initialise WebexSDK on receiving incoming call push notification")
}
}
}
}

func initWebexUsingOauth() {
guard let path = Bundle.main.path(forResource: "Secrets", ofType: "plist") else { return }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Kitchensink-dark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Kitchensink-light.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions KitchenSink/Assets.xcassets/busy.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "delete.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "meetings-presence-stroke_30.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions KitchenSink/Assets.xcassets/dnd.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "do-not-disturb.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions KitchenSink/Assets.xcassets/inactive.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "recents-presence-stroke_30.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions KitchenSink/Assets.xcassets/meeting.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "camera-presence-stroke_30.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions KitchenSink/Assets.xcassets/on-call.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "handset-presence-stroke_30.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions KitchenSink/Assets.xcassets/outofoffice.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "luggage.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d87fba8

Please sign in to comment.