Skip to content

Commit

Permalink
Xcode 12 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
4taras4 authored Oct 13, 2020
2 parents c0251db + f529e03 commit 97d4ebe
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 105 deletions.
113 changes: 71 additions & 42 deletions ButterflyMX Demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +36,8 @@
ReferencedContainer = "container:ButterflyMX Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -61,8 +59,6 @@
ReferencedContainer = "container:ButterflyMX Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +36,8 @@
ReferencedContainer = "container:ButterflyMX Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
Expand All @@ -61,8 +59,6 @@
ReferencedContainer = "container:ButterflyMX Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
8 changes: 4 additions & 4 deletions ButterflyMX Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let stb = UIStoryboard(name: "Main", bundle: nil)
if BMXCore.shared.isUserLoggedIn {
if BMXCoreKit.shared.isUserLoggedIn {
var env = BMXEnvironment(backendEnvironment: .development)
switch UserDefaults.standard.string(forKey: "environment") {
case "sandbox":
Expand All @@ -29,15 +29,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
default:
break
}
BMXCore.shared.configure(withEnvironment: env)
BMXCoreKit.shared.configure(withEnvironment: env)
let mainViewController = stb.instantiateViewController(withIdentifier: "MainTabController")
window!.rootViewController = mainViewController
} else {
let loginViewController = stb.instantiateViewController(withIdentifier: "LoginViewController")
window!.rootViewController = loginViewController
}

BMXCore.shared.delegate = self
BMXCoreKit.shared.delegate = self

CallsService.shared.setupVoipPush()
requestAccessMicCamera(callback: { status in
Expand All @@ -48,7 +48,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
if (url.host == "test") {
BMXCore.shared.handle(url: url)
BMXCoreKit.shared.handle(url: url)
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AccountTableViewController: UITableViewController {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 1 && indexPath.row == 0 {
SVProgressHUD.show()
BMXCore.shared.logoutUser(completion: { result in
BMXCoreKit.shared.logoutUser(completion: { result in
switch result {
case .success:
let stb = UIStoryboard(name: "Main", bundle: nil)
Expand Down
16 changes: 8 additions & 8 deletions ButterflyMX Demo/Controllers/IncomingCallViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ class IncomingCallViewController: UIViewController {
if microphoneIsEnabled {
microphoneIsEnabled = false
sender.setImage(UIImage(named: "button_mute_active"), for: .normal)
BMXCall.shared.muteMic()
BMXCallKit.shared.muteMic()
print("mute mic")
} else {
microphoneIsEnabled = true
sender.setImage(UIImage(named: "button_mute"), for: .normal)
BMXCall.shared.unmuteMic()
BMXCallKit.shared.unmuteMic()
print("unmute mic")
}
}

@IBAction func hangUpAction(_ sender: Any) {
BMXCall.shared.endCall()
BMXCallKit.shared.endCall()
}

@IBAction func openDoorAction(_ sender: Any) {
BMXCall.shared.openDoor()
BMXCallKit.shared.openDoor()
self.alert(message: "Door is open!")
}

Expand All @@ -74,11 +74,11 @@ class IncomingCallViewController: UIViewController {
sender.setImage(UIImage(named: "button_camera"), for: .normal)
self.selfVideoView.isHidden = true
self.cameraIsEnabled = false
BMXCall.shared.hideOutgoingVideo()
BMXCallKit.shared.hideOutgoingVideo()
} else {
self.selfVideoView.isHidden = false
self.cameraIsEnabled = true
BMXCall.shared.showOutgoingVideo()
BMXCallKit.shared.showOutgoingVideo()
sender.setImage(UIImage(named: "button_camera_active"), for: .normal)
}
}
Expand All @@ -104,7 +104,7 @@ class IncomingCallViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
BMXCall.shared.delegate = self
BMXCallKit.shared.delegate = self
setupUIData()
}

Expand All @@ -121,7 +121,7 @@ class IncomingCallViewController: UIViewController {
speakerButton.setImage(UIImage(named: "button_speaker_active"), for: .normal)
}

guard let call = BMXCall.shared.activeCall?.callDetails else { return }
guard let call = BMXCallKit.shared.activeCall?.callDetails else { return }

if let image = call.mediumUrl {
let imageData = NSData(contentsOf: URL(string: image)!)
Expand Down
8 changes: 4 additions & 4 deletions ButterflyMX Demo/Controllers/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class LoginViewController: UITableViewController {
@IBAction func singInAction(_ sender: Any) {
SVProgressHUD.show()
let env = BMXEnvironment(backendEnvironment: environmentType)
BMXCore.shared.configure(withEnvironment: env)
BMXCore.shared.authorize(withAuthProvider: authProvider, callbackURL: URL(string: "demoapp:https://test")!, viewController: self) { result in
BMXCoreKit.shared.configure(withEnvironment: env)
BMXCoreKit.shared.authorize(withAuthProvider: authProvider, callbackURL: URL(string: "demoapp:https://test")!, viewController: self) { result in
switch result {
case .success:
let stb = UIStoryboard(name: "Main", bundle: nil)
Expand All @@ -47,7 +47,7 @@ class LoginViewController: UITableViewController {
self.present(mainViewController, animated: true, completion: {
guard let pushToken = CallsService.shared.pushkitToken else { return }
let token = pushToken.map { String(format: "%02.2hhx", $0) }.joined()
BMXCore.shared.registerDevice(with: .voip(token: token), apnsSandbox: false) { result in
BMXCoreKit.shared.registerDevice(with: .voip(token: token), apnsSandbox: false) { result in
switch result {
case .success:
print("Success")
Expand All @@ -66,7 +66,7 @@ class LoginViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
UserDefaults.standard.set("development", forKey: "environment")
BMXCore.shared.delegate = self
BMXCoreKit.shared.delegate = self
authProvider = getBMXAuthProvider(for: environmentType)
SVProgressHUD.setDefaultStyle(.light)
}
Expand Down
20 changes: 10 additions & 10 deletions ButterflyMX Demo/Logic/CallsService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ class CallsService: NSObject {

extension CallsService: PKPushRegistryDelegate, CXProviderDelegate {
func providerDidReset(_ provider: CXProvider) {
BMXCall.shared.endCall()
BMXCallKit.shared.endCall()
}

func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
pushkitToken = pushCredentials.token
if BMXCore.shared.isUserLoggedIn {
if BMXCoreKit.shared.isUserLoggedIn {
let token = pushCredentials.token.map { String(format: "%02.2hhx", $0) }.joined()
BMXCore.shared.registerDevice(with: .voip(token: token), apnsSandbox: false) { result in
BMXCoreKit.shared.registerDevice(with: .voip(token: token), apnsSandbox: false) { result in
switch result {
case .success(let data):
print(data)
Expand Down Expand Up @@ -128,7 +128,7 @@ extension CallsService: PKPushRegistryDelegate, CXProviderDelegate {
}

// Start processing the call by ButterflyMX SDK
BMXCall.shared.processCall(guid: guid) { result in
BMXCallKit.shared.processCall(guid: guid) { result in
switch result {
case .success(let call):

Expand Down Expand Up @@ -156,33 +156,33 @@ extension CallsService: PKPushRegistryDelegate, CXProviderDelegate {
}

func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
BMXCall.shared.previewCall(autoAccept: true)
BMXCallKit.shared.previewCall(autoAccept: true)
action.fulfill()
}

func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
BMXCall.shared.endCall()
BMXCallKit.shared.endCall()

incomingViewController?.dismiss(animated: true, completion: nil)
action.fulfill()
}

func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
if action.isMuted {
BMXCall.shared.muteMic()
BMXCallKit.shared.muteMic()
} else {
BMXCall.shared.unmuteMic()
BMXCallKit.shared.unmuteMic()
}

action.fulfill()
}

func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
BMXCall.shared.connectSoundDevice()
BMXCallKit.shared.connectSoundDevice()
}

func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
BMXCall.shared.disconnectSoundDevice()
BMXCallKit.shared.disconnectSoundDevice()
}
}

16 changes: 14 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@ target 'ButterflyMX Demo' do
use_frameworks!

# Pods for ButterflyMX Demo
pod 'BMXCore', '~> 1.0.9'
pod 'BMXCall', '~> 1.0.7'
pod 'BMXCore', '~> 1.0.13'
pod 'BMXCall', '~> 1.0.12'
pod 'Japx/CodableAlamofire', :git => 'https://github.com/runslikebutter/Japx'
pod 'SVProgressHUD'

end

post_install do |installer|
installer.pods_project.targets.each do |target|
if ['BMXCall', 'BMXCore', 'Alamofire', 'Japx', 'OAuthSwift'].include? target.name
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
end
end
49 changes: 29 additions & 20 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,45 +1,54 @@
PODS:
- Alamofire (4.9.1)
- BMXCall (1.0.7):
- BMXCore (~> 1.0.7)
- BMXCore (1.0.9):
- Alamofire (~> 4.9.1)
- Japx/CodableAlamofire (~> 2.0.2)
- Alamofire (5.2.2)
- BMXCall (1.0.12):
- BMXCore (~> 1.0.12)
- BMXCore (1.0.13):
- Alamofire (~> 5.2.1)
- Japx/CodableAlamofire (~> 3.0.0)
- OAuthSwift (~> 2.1.0)
- Japx/Alamofire (2.0.2):
- Alamofire (~> 4.5)
- Japx/Alamofire (3.0.0):
- Alamofire (~> 5.0)
- Japx/Core
- Japx/Codable (2.0.2):
- Japx/Codable (3.0.0):
- Japx/Core
- Japx/CodableAlamofire (2.0.2):
- Japx/CodableAlamofire (3.0.0):
- Japx/Alamofire
- Japx/Codable
- Japx/Core (2.0.2)
- Japx/Core (3.0.0)
- OAuthSwift (2.1.0)
- SVProgressHUD (2.2.5)

DEPENDENCIES:
- BMXCall (~> 1.0.7)
- BMXCore (~> 1.0.9)
- BMXCall (~> 1.0.12)
- BMXCore (~> 1.0.13)
- Japx/CodableAlamofire (from `https://github.com/runslikebutter/Japx`)
- SVProgressHUD

SPEC REPOS:
trunk:
- Alamofire
- BMXCall
- BMXCore
- Japx
- OAuthSwift
- SVProgressHUD

EXTERNAL SOURCES:
Japx:
:git: https://github.com/runslikebutter/Japx

CHECKOUT OPTIONS:
Japx:
:commit: 10fd9e241d0565f4bfc75f581d4e900f2820a771
:git: https://github.com/runslikebutter/Japx

SPEC CHECKSUMS:
Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
BMXCall: 01ebb6e628dc99c67b9fc180c73d3e625bbb0f59
BMXCore: f9100155f51f2f2bf78e395b95008159feb2e093
Japx: fad17fcb8fe56d69a493ea7d3fce6e1d796879f8
Alamofire: 814429acc853c6c54ff123fc3d2ef66803823ce0
BMXCall: bdeb78af2baa43ba520e46fb0fff5f1c8cf5d534
BMXCore: 8670710bb7e67401a5999931e1e0ccfa294ea366
Japx: d1f7f3e4b94f2013538102e96cf96fd417005f76
OAuthSwift: ab1675598273e04355e0282459c328e65c9ddacd
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6

PODFILE CHECKSUM: 791817e64a968f3e0ef4ff87d5243ae38cfec347
PODFILE CHECKSUM: d1cc8379f2669e00371eefb3eda8a5b2fb844462

COCOAPODS: 1.9.1
COCOAPODS: 1.9.3

0 comments on commit 97d4ebe

Please sign in to comment.