diff --git a/ios/swift/4-CallKitTutorial/CallKitTutorial.xcodeproj/project.pbxproj b/ios/swift/4-CallKitTutorial/CallKitTutorial.xcodeproj/project.pbxproj index 2c2e466..cc25697 100644 --- a/ios/swift/4-CallKitTutorial/CallKitTutorial.xcodeproj/project.pbxproj +++ b/ios/swift/4-CallKitTutorial/CallKitTutorial.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 577005D03F6821591475FBF9 /* Pods_CallKitTutorial.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 454830E9C41DBBF20AF2BD05 /* Pods_CallKitTutorial.framework */; }; + 62F26DACEAE3A1D31676DFC8 /* Pods_CallKitTutorial.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6E14A45B7F8F19111223509 /* Pods_CallKitTutorial.framework */; }; 6608A96624E197D5006E6C68 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6608A96524E197D5006E6C68 /* AppDelegate.swift */; }; 6608A96824E197D5006E6C68 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6608A96724E197D5006E6C68 /* SceneDelegate.swift */; }; 6608A96A24E197D5006E6C68 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6608A96924E197D5006E6C68 /* ContentView.swift */; }; @@ -19,8 +19,6 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 018936DA8FE1500B9E181610 /* Pods-CallKitTutorial.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CallKitTutorial.debug.xcconfig"; path = "Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial.debug.xcconfig"; sourceTree = ""; }; - 454830E9C41DBBF20AF2BD05 /* Pods_CallKitTutorial.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CallKitTutorial.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 6608A96224E197D5006E6C68 /* CallKitTutorial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CallKitTutorial.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6608A96524E197D5006E6C68 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 6608A96724E197D5006E6C68 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -32,7 +30,9 @@ 6608A97924E19817006E6C68 /* CallKitTutorial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallKitTutorial.swift; sourceTree = ""; }; 6608A97B24E1981E006E6C68 /* CallKitProviderDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallKitProviderDelegate.swift; sourceTree = ""; }; 6608A97D24E19852006E6C68 /* CallKitTutorial.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = CallKitTutorial.entitlements; sourceTree = ""; }; - C87B170DFD4D3072825B25EF /* Pods-CallKitTutorial.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CallKitTutorial.release.xcconfig"; path = "Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial.release.xcconfig"; sourceTree = ""; }; + 9D767CD0AA573757AD042365 /* Pods-CallKitTutorial.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CallKitTutorial.release.xcconfig"; path = "Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial.release.xcconfig"; sourceTree = ""; }; + C6E14A45B7F8F19111223509 /* Pods_CallKitTutorial.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CallKitTutorial.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D7FA91A3C73CAEE3300CB14C /* Pods-CallKitTutorial.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CallKitTutorial.debug.xcconfig"; path = "Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -40,26 +40,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 577005D03F6821591475FBF9 /* Pods_CallKitTutorial.framework in Frameworks */, + 62F26DACEAE3A1D31676DFC8 /* Pods_CallKitTutorial.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 319770E3ECD19EBD7557F82B /* Frameworks */ = { - isa = PBXGroup; - children = ( - 454830E9C41DBBF20AF2BD05 /* Pods_CallKitTutorial.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 38284A71627D413A7ACC2F07 /* Pods */ = { isa = PBXGroup; children = ( - 018936DA8FE1500B9E181610 /* Pods-CallKitTutorial.debug.xcconfig */, - C87B170DFD4D3072825B25EF /* Pods-CallKitTutorial.release.xcconfig */, + D7FA91A3C73CAEE3300CB14C /* Pods-CallKitTutorial.debug.xcconfig */, + 9D767CD0AA573757AD042365 /* Pods-CallKitTutorial.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -70,7 +62,7 @@ 6608A96424E197D5006E6C68 /* CallKitTutorial */, 6608A96324E197D5006E6C68 /* Products */, 38284A71627D413A7ACC2F07 /* Pods */, - 319770E3ECD19EBD7557F82B /* Frameworks */, + D50E07CDAF0ACCEEEE7C2683 /* Frameworks */, ); sourceTree = ""; }; @@ -107,6 +99,14 @@ path = "Preview Content"; sourceTree = ""; }; + D50E07CDAF0ACCEEEE7C2683 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C6E14A45B7F8F19111223509 /* Pods_CallKitTutorial.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -114,11 +114,11 @@ isa = PBXNativeTarget; buildConfigurationList = 6608A97624E197D5006E6C68 /* Build configuration list for PBXNativeTarget "CallKitTutorial" */; buildPhases = ( - D642DC4C3C74BB17FF5A3E9F /* [CP] Check Pods Manifest.lock */, + 6A2B822BFAB3B00C62638AFD /* [CP] Check Pods Manifest.lock */, 6608A95E24E197D5006E6C68 /* Sources */, 6608A95F24E197D5006E6C68 /* Frameworks */, 6608A96024E197D5006E6C68 /* Resources */, - 640A5744B5ABBA6A3EDBFDB1 /* [CP] Embed Pods Frameworks */, + D7986480B43805FC6FF0C9E5 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -176,43 +176,43 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 640A5744B5ABBA6A3EDBFDB1 /* [CP] Embed Pods Frameworks */ = { + 6A2B822BFAB3B00C62638AFD /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Embed Pods Frameworks"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-CallKitTutorial-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - D642DC4C3C74BB17FF5A3E9F /* [CP] Check Pods Manifest.lock */ = { + D7986480B43805FC6FF0C9E5 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-CallKitTutorial-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CallKitTutorial/Pods-CallKitTutorial-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -360,7 +360,7 @@ }; 6608A97724E197D5006E6C68 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 018936DA8FE1500B9E181610 /* Pods-CallKitTutorial.debug.xcconfig */; + baseConfigurationReference = D7FA91A3C73CAEE3300CB14C /* Pods-CallKitTutorial.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = CallKitTutorial/CallKitTutorial.entitlements; @@ -383,7 +383,7 @@ }; 6608A97824E197D5006E6C68 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C87B170DFD4D3072825B25EF /* Pods-CallKitTutorial.release.xcconfig */; + baseConfigurationReference = 9D767CD0AA573757AD042365 /* Pods-CallKitTutorial.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = CallKitTutorial/CallKitTutorial.entitlements; diff --git a/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitProviderDelegate.swift b/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitProviderDelegate.swift index 39ef98c..fb9101b 100644 --- a/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitProviderDelegate.swift +++ b/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitProviderDelegate.swift @@ -23,7 +23,7 @@ class CallKitProviderDelegate : NSObject init(context: CallKitExampleContext) { tutorialContext = context - let providerConfiguration = CXProviderConfiguration(localizedName: Bundle.main.infoDictionary!["CFBundleName"] as! String) + let providerConfiguration = CXProviderConfiguration() providerConfiguration.supportsVideo = true providerConfiguration.supportedHandleTypes = [.generic] @@ -38,6 +38,7 @@ class CallKitProviderDelegate : NSObject func incomingCall() { + NSLog("Callkit incomingCall -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") incomingCallUUID = UUID() let update = CXCallUpdate() update.remoteHandle = CXHandle(type:.generic, value: tutorialContext.incomingCallName) @@ -47,6 +48,7 @@ class CallKitProviderDelegate : NSObject func stopCall() { + NSLog("Callkit stopCall -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") let endCallAction = CXEndCallAction(call: incomingCallUUID) let transaction = CXTransaction(action: endCallAction) @@ -61,6 +63,7 @@ class CallKitProviderDelegate : NSObject extension CallKitProviderDelegate: CXProviderDelegate { func provider(_ provider: CXProvider, perform action: CXEndCallAction) { + NSLog("Callkit CXEndCallAction -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") do { if (tutorialContext.mCall?.state != .End && tutorialContext.mCall?.state != .Released) { try tutorialContext.mCall?.terminate() @@ -73,6 +76,7 @@ extension CallKitProviderDelegate: CXProviderDelegate { } func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { + NSLog("Callkit CXAnswerCallAction -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") do { // The audio stream is going to start shortly: the AVAudioSession must be configured now. // It is worth to note that an application does not have permission to configure the @@ -102,13 +106,18 @@ extension CallKitProviderDelegate: CXProviderDelegate { func providerDidReset(_ provider: CXProvider) {} func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) { + NSLog("Callkit didActivateaudiosession -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") // The linphone Core must be notified that CallKit has activated the AVAudioSession // in order to start streaming audio. - tutorialContext.mCore.activateAudioSession(actived: true) + tutorialContext.postOnCoreQueue { + self.tutorialContext.mCore.activateAudioSession(actived: true) + } } func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) { // The linphone Core must be notified that CallKit has deactivated the AVAudioSession. - tutorialContext.mCore.activateAudioSession(actived: false) + tutorialContext.postOnCoreQueue { + self.tutorialContext.mCore.activateAudioSession(actived: false) + } } } diff --git a/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitTutorial.swift b/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitTutorial.swift index b02b028..84f2be8 100644 --- a/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitTutorial.swift +++ b/ios/swift/4-CallKitTutorial/CallKitTutorial/CallKitTutorial.swift @@ -9,19 +9,22 @@ import linphonesw import AVFoundation + + class CallKitExampleContext : ObservableObject { + private let queue = DispatchQueue(label:"core.queue") var mCore: Core! - @Published var coreVersion: String = Core.getVersion - var mAccount: Account? var mCoreDelegate : CoreDelegate! - @Published var username : String = "user" - @Published var passwd : String = "pwd" - @Published var domain : String = "sip.example.org" + var mIterateTimer : Timer! + + @Published var coreVersion: String = Core.getVersion + @Published var username : String = "quentindev" + @Published var passwd : String = "dev" + @Published var domain : String = "sip.linphone.org" @Published var loggedIn: Bool = false @Published var transportType : String = "TLS" - @Published var callMsg : String = "" @Published var isCallIncoming : Bool = false @Published var isCallRunning : Bool = false @@ -35,6 +38,18 @@ class CallKitExampleContext : ObservableObject var mProviderDelegate : CallKitProviderDelegate! var mCallAlreadyStopped : Bool = false; + func postOnCoreQueue(lambda : @escaping ()->()) { + queue.async { + lambda() + } + } + + func postOnMainQueue(lambda : @escaping()->()) { + DispatchQueue.main.async { + lambda() + } + } + init() { LoggingService.Instance.logLevel = LogLevel.Debug @@ -46,96 +61,121 @@ class CallKitExampleContext : ObservableObject // We also need to enable "Push Notitifications" and "Background Mode - Voice Over IP" let configDir = factory.getConfigDir(context: nil) try? mCore = factory.createCore(configPath: "\(configDir)/MyConfig", factoryConfigPath: "", systemContext: nil) - mProviderDelegate = CallKitProviderDelegate(context: self) // enabling push notifications management in the core mCore.callkitEnabled = true mCore.pushNotificationEnabled = true - try? mCore.start() + mCore.autoIterateEnabled = false mCoreDelegate = CoreDelegateStub( onCallStateChanged: { (core: Core, call: Call, state: Call.State, message: String) in - self.callMsg = message - + NSLog("onCallStateChanged -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") + self.postOnMainQueue { self.callMsg = message } if (state == .PushIncomingReceived){ // We're being called by someone (and app is in background) self.mCall = call - self.isCallIncoming = true self.mProviderDelegate.incomingCall() + self.postOnMainQueue { self.isCallIncoming = true } } else if (state == .IncomingReceived) { // If app is in foreground, it's likely that we will receive the SIP invite before the Push notification if (!self.isCallIncoming) { self.mCall = call - self.isCallIncoming = true self.mProviderDelegate.incomingCall() + + self.postOnMainQueue { self.isCallIncoming = true } } - self.remoteAddress = call.remoteAddress!.asStringUriOnly() + self.postOnMainQueue { self.remoteAddress = call.remoteAddress!.asStringUriOnly() } } else if (state == .Connected) { - self.isCallIncoming = false - self.isCallRunning = true + self.postOnMainQueue { + self.isCallIncoming = false + self.isCallRunning = true + } } else if (state == .Released || state == .End || state == .Error) { // Call has been terminated by any side - // Report to CallKit that the call is over, if the terminate action was initiated by other end of the call + // Report to CallKit that the call is over, if the terminate action was i nitiated by other end of the call if (self.isCallRunning) { self.mProviderDelegate.stopCall() } - self.remoteAddress = "Nobody yet" + self.postOnMainQueue { self.remoteAddress = "Nobody yet"} } }, onAccountRegistrationStateChanged: { (core: Core, account: Account, state: RegistrationState, message: String) in NSLog("New registration state is \(state) for user id \( String(describing: account.params?.identityAddress?.asString()))\n") if (state == .Ok) { - self.loggedIn = true + self.postOnMainQueue { + self.loggedIn = true + } // Since core has "Push Enabled", the reception and setting of the push notification token is done automatically // It should have been set and used when we log in, you can check here or in the liblinphone logs NSLog("Account registered Push voip token: \(account.params?.pushNotificationConfig?.voipToken)") } else if (state == .Cleared) { - self.loggedIn = false + self.postOnMainQueue { + self.loggedIn = false + } } }) + + mIterateTimer = Timer.scheduledTimer(withTimeInterval: 0.02, repeats: true) { [weak self] timer in + self?.postOnCoreQueue { + self?.mCore.iterate() + } + } + + mProviderDelegate = CallKitProviderDelegate(context: self) mCore.addDelegate(delegate: mCoreDelegate) + + postOnCoreQueue { + try? self.mCore.start() + } + } func login() { - - do { - var transport : TransportType - if (transportType == "TLS") { transport = TransportType.Tls } - else if (transportType == "TCP") { transport = TransportType.Tcp } - else { transport = TransportType.Udp } - - let authInfo = try Factory.Instance.createAuthInfo(username: username, userid: "", passwd: passwd, ha1: "", realm: "", domain: domain) - let accountParams = try mCore.createAccountParams() - let identity = try Factory.Instance.createAddress(addr: String("sip:" + username + "@" + domain)) - try! accountParams.setIdentityaddress(newValue: identity) - let address = try Factory.Instance.createAddress(addr: String("sip:" + domain)) - try address.setTransport(newValue: transport) - try accountParams.setServeraddress(newValue: address) - accountParams.registerEnabled = true - // Enable push notifications on this account - accountParams.pushNotificationAllowed = true - // We're in a sandbox application, so we must set the provider to "apns.dev" since it will be "apns" by default, which is used only for production apps - accountParams.pushNotificationConfig?.provider = "apns.dev" - mAccount = try mCore.createAccount(params: accountParams) - mCore.addAuthInfo(info: authInfo) - try mCore.addAccount(account: mAccount!) - mCore.defaultAccount = mAccount - - } catch { NSLog(error.localizedDescription) } + + postOnCoreQueue { + do { + var transport : TransportType + if (self.transportType == "TLS") { transport = TransportType.Tls } + else if (self.transportType == "TCP") { transport = TransportType.Tcp } + else { transport = TransportType.Udp } + + let authInfo = try Factory.Instance.createAuthInfo(username: self.username, userid: "", passwd: self.passwd, ha1: "", realm: "", domain: self.domain) + let accountParams = try self.mCore.createAccountParams() + let identity = try Factory.Instance.createAddress(addr: String("sip:" + self.username + "@" + self.domain)) + try! accountParams.setIdentityaddress(newValue: identity) + let address = try Factory.Instance.createAddress(addr: String("sip:" + self.domain)) + try address.setTransport(newValue: transport) + try accountParams.setServeraddress(newValue: address) + accountParams.registerEnabled = true + // Enable push notifications on this account + accountParams.pushNotificationAllowed = true + // We're in a sandbox application, so we must set the provider to "apns.dev" since it will be "apns" by default, which is used only for production apps + accountParams.pushNotificationConfig?.provider = "apns.dev" + self.mAccount = try self.mCore.createAccount(params: accountParams) + self.mCore.addAuthInfo(info: authInfo) + try self.mCore.addAccount(account: self.mAccount!) + self.mCore.defaultAccount = self.mAccount + + } catch { NSLog(error.localizedDescription) } + } } func unregister() { - if let account = mCore.defaultAccount { - let params = account.params - let clonedParams = params?.clone() - clonedParams?.registerEnabled = false - account.params = clonedParams + postOnCoreQueue { + if let account = self.mCore.defaultAccount { + let params = account.params + let clonedParams = params?.clone() + clonedParams?.registerEnabled = false + account.params = clonedParams + } } } func delete() { - if let account = mCore.defaultAccount { - mCore.removeAccount(account: account) - mCore.clearAccounts() - mCore.clearAllAuthInfo() + postOnCoreQueue { + if let account = self.mCore.defaultAccount { + self.mCore.removeAccount(account: account) + self.mCore.clearAccounts() + self.mCore.clearAllAuthInfo() + } } } } diff --git a/ios/swift/4-CallKitTutorial/Podfile b/ios/swift/4-CallKitTutorial/Podfile index d7f59eb..7572965 100644 --- a/ios/swift/4-CallKitTutorial/Podfile +++ b/ios/swift/4-CallKitTutorial/Podfile @@ -1,11 +1,11 @@ # Uncomment the next line to define a global platform for your project -platform :ios, '11.0' +platform :ios, '13.0' source "https://gitlab.linphone.org/BC/public/podspec.git" source "https://github.com/CocoaPods/Specs.git" def basic_pods if ENV['PODFILE_PATH'].nil? - pod 'linphone-sdk', '~> 5.0.48' + pod 'linphone-sdk', '~> 5.3.0-alpha' else pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk end diff --git a/ios/swift/proto_actors/Podfile b/ios/swift/proto_actors/Podfile new file mode 100644 index 0000000..d4be386 --- /dev/null +++ b/ios/swift/proto_actors/Podfile @@ -0,0 +1,24 @@ +# Uncomment the next line to define a global platform for your project +platform :ios, '13.0' +source "https://gitlab.linphone.org/BC/public/podspec.git" +source "https://github.com/CocoaPods/Specs.git" + +def basic_pods + if ENV['PODFILE_PATH'].nil? + pod 'linphone-sdk', '~> 5.3.0-alpha' + else + pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk + end + +end + + + +target 'proto_actors' do + # Comment the next line if you don't want to use dynamic frameworks + use_frameworks! + + # Pods for proto_actors + basic_pods + +end diff --git a/ios/swift/proto_actors/proto_actors.xcodeproj/project.pbxproj b/ios/swift/proto_actors/proto_actors.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d5ae4bc --- /dev/null +++ b/ios/swift/proto_actors/proto_actors.xcodeproj/project.pbxproj @@ -0,0 +1,419 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 66173C0F2A9CE70800997759 /* proto_actorsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66173C0E2A9CE70800997759 /* proto_actorsApp.swift */; }; + 66173C112A9CE70800997759 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66173C102A9CE70800997759 /* ContentView.swift */; }; + 66173C132A9CE70A00997759 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66173C122A9CE70A00997759 /* Assets.xcassets */; }; + 66173C162A9CE70A00997759 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66173C152A9CE70A00997759 /* Preview Assets.xcassets */; }; + 66173C1D2A9CECD100997759 /* CoreContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66173C1C2A9CECD100997759 /* CoreContext.swift */; }; + B9FC405F1C8E7E9153780CCC /* Pods_proto_actors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72CFCB1C69BA24A6B503BFC7 /* Pods_proto_actors.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 62AF0E708A4061838470A349 /* Pods-proto_actors.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-proto_actors.release.xcconfig"; path = "Target Support Files/Pods-proto_actors/Pods-proto_actors.release.xcconfig"; sourceTree = ""; }; + 66173C0B2A9CE70800997759 /* proto_actors.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = proto_actors.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 66173C0E2A9CE70800997759 /* proto_actorsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = proto_actorsApp.swift; sourceTree = ""; }; + 66173C102A9CE70800997759 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 66173C122A9CE70A00997759 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 66173C152A9CE70A00997759 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 66173C1C2A9CECD100997759 /* CoreContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreContext.swift; sourceTree = ""; }; + 72CFCB1C69BA24A6B503BFC7 /* Pods_proto_actors.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_proto_actors.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FF03D267493D9EE9E7568618 /* Pods-proto_actors.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-proto_actors.debug.xcconfig"; path = "Target Support Files/Pods-proto_actors/Pods-proto_actors.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 66173C082A9CE70800997759 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B9FC405F1C8E7E9153780CCC /* Pods_proto_actors.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 66173C022A9CE70800997759 = { + isa = PBXGroup; + children = ( + 66173C0D2A9CE70800997759 /* proto_actors */, + 66173C0C2A9CE70800997759 /* Products */, + BB9828A78B0F7AA63F6EE540 /* Pods */, + E49080D639CDE715F648C548 /* Frameworks */, + ); + sourceTree = ""; + }; + 66173C0C2A9CE70800997759 /* Products */ = { + isa = PBXGroup; + children = ( + 66173C0B2A9CE70800997759 /* proto_actors.app */, + ); + name = Products; + sourceTree = ""; + }; + 66173C0D2A9CE70800997759 /* proto_actors */ = { + isa = PBXGroup; + children = ( + 66173C0E2A9CE70800997759 /* proto_actorsApp.swift */, + 66173C102A9CE70800997759 /* ContentView.swift */, + 66173C1C2A9CECD100997759 /* CoreContext.swift */, + 66173C122A9CE70A00997759 /* Assets.xcassets */, + 66173C142A9CE70A00997759 /* Preview Content */, + ); + path = proto_actors; + sourceTree = ""; + }; + 66173C142A9CE70A00997759 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 66173C152A9CE70A00997759 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + BB9828A78B0F7AA63F6EE540 /* Pods */ = { + isa = PBXGroup; + children = ( + FF03D267493D9EE9E7568618 /* Pods-proto_actors.debug.xcconfig */, + 62AF0E708A4061838470A349 /* Pods-proto_actors.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + E49080D639CDE715F648C548 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 72CFCB1C69BA24A6B503BFC7 /* Pods_proto_actors.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 66173C0A2A9CE70800997759 /* proto_actors */ = { + isa = PBXNativeTarget; + buildConfigurationList = 66173C192A9CE70A00997759 /* Build configuration list for PBXNativeTarget "proto_actors" */; + buildPhases = ( + 077AE688121EBD9DDEABE647 /* [CP] Check Pods Manifest.lock */, + 66173C072A9CE70800997759 /* Sources */, + 66173C082A9CE70800997759 /* Frameworks */, + 66173C092A9CE70800997759 /* Resources */, + C2363C75F7BAE1B53FB78A3B /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = proto_actors; + productName = proto_actors; + productReference = 66173C0B2A9CE70800997759 /* proto_actors.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 66173C032A9CE70800997759 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1430; + LastUpgradeCheck = 1430; + TargetAttributes = { + 66173C0A2A9CE70800997759 = { + CreatedOnToolsVersion = 14.3.1; + }; + }; + }; + buildConfigurationList = 66173C062A9CE70800997759 /* Build configuration list for PBXProject "proto_actors" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 66173C022A9CE70800997759; + productRefGroup = 66173C0C2A9CE70800997759 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 66173C0A2A9CE70800997759 /* proto_actors */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 66173C092A9CE70800997759 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 66173C162A9CE70A00997759 /* Preview Assets.xcassets in Resources */, + 66173C132A9CE70A00997759 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 077AE688121EBD9DDEABE647 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-proto_actors-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + C2363C75F7BAE1B53FB78A3B /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-proto_actors/Pods-proto_actors-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-proto_actors/Pods-proto_actors-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-proto_actors/Pods-proto_actors-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 66173C072A9CE70800997759 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 66173C112A9CE70800997759 /* ContentView.swift in Sources */, + 66173C1D2A9CECD100997759 /* CoreContext.swift in Sources */, + 66173C0F2A9CE70800997759 /* proto_actorsApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 66173C172A9CE70A00997759 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 66173C182A9CE70A00997759 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 66173C1A2A9CE70A00997759 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF03D267493D9EE9E7568618 /* Pods-proto_actors.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"proto_actors/Preview Content\""; + DEVELOPMENT_TEAM = ST43QXMN22; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "BC.proto-actors"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 66173C1B2A9CE70A00997759 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 62AF0E708A4061838470A349 /* Pods-proto_actors.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"proto_actors/Preview Content\""; + DEVELOPMENT_TEAM = ST43QXMN22; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "BC.proto-actors"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 66173C062A9CE70800997759 /* Build configuration list for PBXProject "proto_actors" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 66173C172A9CE70A00997759 /* Debug */, + 66173C182A9CE70A00997759 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 66173C192A9CE70A00997759 /* Build configuration list for PBXNativeTarget "proto_actors" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 66173C1A2A9CE70A00997759 /* Debug */, + 66173C1B2A9CE70A00997759 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 66173C032A9CE70800997759 /* Project object */; +} diff --git a/ios/swift/proto_actors/proto_actors/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/swift/proto_actors/proto_actors/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/ios/swift/proto_actors/proto_actors/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/proto_actors/proto_actors/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/swift/proto_actors/proto_actors/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/ios/swift/proto_actors/proto_actors/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/proto_actors/proto_actors/Assets.xcassets/Contents.json b/ios/swift/proto_actors/proto_actors/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/ios/swift/proto_actors/proto_actors/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/proto_actors/proto_actors/ContentView.swift b/ios/swift/proto_actors/proto_actors/ContentView.swift new file mode 100644 index 0000000..685e6ba --- /dev/null +++ b/ios/swift/proto_actors/proto_actors/ContentView.swift @@ -0,0 +1,26 @@ +// +// ContentView.swift +// proto_actors +// +// Created by QuentinArguillere on 28/08/2023. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + VStack { + Image(systemName: "globe") + .imageScale(.large) + .foregroundColor(.accentColor) + Text("Hello, world!") + } + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/ios/swift/proto_actors/proto_actors/CoreContext.swift b/ios/swift/proto_actors/proto_actors/CoreContext.swift new file mode 100644 index 0000000..b3923d1 --- /dev/null +++ b/ios/swift/proto_actors/proto_actors/CoreContext.swift @@ -0,0 +1,80 @@ +// +// CoreContext.swift +// proto_actors +// +// Created by QuentinArguillere on 28/08/2023. +// + +import Foundation +import linphonesw + + +class CoreContext : NSObject{ + static var theCoreContext: CoreContext? + + let queue = DispatchQueue(label:"core.queue") + + let core : Core + var call : Call? + let coreDelegate : CoreDelegate! + var timer : Timer! + + + static func instance() -> CoreContext { + if (theCoreContext == nil) { + theCoreContext = CoreContext() + } + return theCoreContext! + } + + override init() { + try! core = Factory.Instance.createCore(configPath: "\(Factory.Instance.getConfigDir(context: nil))/MyConfig", factoryConfigPath: "", systemContext: nil) + core.autoIterateEnabled = false + + coreDelegate = CoreDelegateStub( + onGlobalStateChanged: { (core: Core, state: GlobalState, message: String) in + + NSLog("onGlobalStateChanged -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") + }, onCallStateChanged: { (core: Core, call: Call, state: Call.State, message: String) in + + if (state == .PushIncomingReceived){ + //self.call = call + } else if (state == .IncomingReceived) { + //self.call = call + } else if (state == .Connected) { + } else if (state == .Released || state == .End || state == .Error) { + } + }, onAccountRegistrationStateChanged: { (core: Core, account: Account, state: RegistrationState, message: String) in + NSLog("onAccountRegistrationStateChanged -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") + NSLog("New registration state is \(state) for user id \( String(describing: account.params?.identityAddress?.asString()))\n") + if (state == .Ok) { + //self.loggedIn = true + // Since core has "Push Enabled", the reception and setting of the push notification token is done automatically + // It should have been set and used when we log in, you can check here or in the liblinphone logs + NSLog("Account registered Push voip token: \(account.params?.pushNotificationConfig?.voipToken)") + } else if (state == .Cleared) { + //self.loggedIn = false + } + }) + + core.addDelegate(delegate: coreDelegate) + super.init() + + timer = Timer.scheduledTimer(withTimeInterval: 3, repeats: true) { [weak self] timer in + self?.postOnCoreQueue { + self?.core.iterate() + NSLog("Iterate -- Is main thread ? \(Thread.isMainThread ? "yes" : "no") ") + } + } + + postOnCoreQueue { + try? self.core.start() + } + } + + func postOnCoreQueue(lambda : @escaping ()->()) { + queue.async { + lambda() + } + } +} diff --git a/ios/swift/proto_actors/proto_actors/Preview Content/Preview Assets.xcassets/Contents.json b/ios/swift/proto_actors/proto_actors/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/ios/swift/proto_actors/proto_actors/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/proto_actors/proto_actors/proto_actorsApp.swift b/ios/swift/proto_actors/proto_actors/proto_actorsApp.swift new file mode 100644 index 0000000..14b1b75 --- /dev/null +++ b/ios/swift/proto_actors/proto_actors/proto_actorsApp.swift @@ -0,0 +1,25 @@ +// +// proto_actorsApp.swift +// proto_actors +// +// Created by QuentinArguillere on 28/08/2023. +// + +import SwiftUI + +@main +struct proto_actorsApp: App { + let coreContext = CoreContext() + var body: some Scene { + WindowGroup { + ContentView() + } + } + + init() { + coreContext.postOnCoreQueue { + sleep(3) + NSLog("Hello world") + } + } +} diff --git a/uwp/cs/00_HelloWorld/00_HelloWorld.sln b/uwp/cs/00_HelloWorld/00_HelloWorld.sln new file mode 100644 index 0000000..fc324b7 --- /dev/null +++ b/uwp/cs/00_HelloWorld/00_HelloWorld.sln @@ -0,0 +1,11 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "00_HelloWorld", "00_HelloWorld.csproj", "{4EDDB112-127A-42C3-81BE-5BA16151E67F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + EndGlobalSection +EndGlobal