Skip to content

Commit 85cbb51

Browse files
author
Jaesung
authored
Merge pull request #81 from sendbird/release/1.4.0
Release 1.4.0
2 parents 9ed7f06 + 39cf099 commit 85cbb51

File tree

9 files changed

+62
-26
lines changed

9 files changed

+62
-26
lines changed

QuickStart.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@
879879
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
880880
CODE_SIGN_ENTITLEMENTS = QuickStart/QuickStart.entitlements;
881881
CODE_SIGN_STYLE = Automatic;
882-
CURRENT_PROJECT_VERSION = 2;
882+
CURRENT_PROJECT_VERSION = 1;
883883
DEVELOPMENT_TEAM = RM4A5PXTUX;
884884
EXCLUDED_ARCHS = "";
885885
FRAMEWORK_SEARCH_PATHS = (
@@ -892,7 +892,7 @@
892892
"$(inherited)",
893893
"@executable_path/Frameworks",
894894
);
895-
MARKETING_VERSION = 1.3.0;
895+
MARKETING_VERSION = 1.4.0;
896896
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart;
897897
PRODUCT_NAME = "Sendbird Calls";
898898
SWIFT_VERSION = 5.0;
@@ -909,7 +909,7 @@
909909
CODE_SIGN_ENTITLEMENTS = QuickStart/QuickStart.entitlements;
910910
CODE_SIGN_IDENTITY = "Apple Development";
911911
CODE_SIGN_STYLE = Automatic;
912-
CURRENT_PROJECT_VERSION = 2;
912+
CURRENT_PROJECT_VERSION = 1;
913913
DEVELOPMENT_TEAM = RM4A5PXTUX;
914914
EXCLUDED_ARCHS = "";
915915
FRAMEWORK_SEARCH_PATHS = (
@@ -922,7 +922,7 @@
922922
"$(inherited)",
923923
"@executable_path/Frameworks",
924924
);
925-
MARKETING_VERSION = 1.3.0;
925+
MARKETING_VERSION = 1.4.0;
926926
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart;
927927
PRODUCT_NAME = "Sendbird Calls";
928928
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -944,7 +944,7 @@
944944
"@executable_path/Frameworks",
945945
"@executable_path/../../Frameworks",
946946
);
947-
MARKETING_VERSION = 1.3.0;
947+
MARKETING_VERSION = 1.4.0;
948948
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart.QuickStartIntent;
949949
PRODUCT_NAME = "$(TARGET_NAME)";
950950
SKIP_INSTALL = YES;
@@ -967,7 +967,7 @@
967967
"@executable_path/Frameworks",
968968
"@executable_path/../../Frameworks",
969969
);
970-
MARKETING_VERSION = 1.3.0;
970+
MARKETING_VERSION = 1.4.0;
971971
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart.QuickStartIntent;
972972
PRODUCT_NAME = "$(TARGET_NAME)";
973973
SKIP_INSTALL = YES;

QuickStart/AppDelegate+SendBirdCallsDelegates.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ extension AppDelegate: SendBirdCallDelegate, DirectCallDelegate {
2727
update.hasVideo = call.isVideoCall
2828
update.localizedCallerName = call.caller?.userId ?? "Unknown"
2929

30-
// Report the incoming call to the system
31-
CXCallManager.shared.reportIncomingCall(with: uuid, update: update)
30+
if SendBirdCall.getOngoingCallCount() > 1 {
31+
// Allow only one ongoing call.
32+
CXCallManager.shared.reportIncomingCall(with: uuid, update: update) { _ in
33+
CXCallManager.shared.endCall(for: uuid, endedAt: Date(), reason: .declined)
34+
}
35+
call.end()
36+
} else {
37+
// Report the incoming call to the system
38+
CXCallManager.shared.reportIncomingCall(with: uuid, update: update)
39+
}
3240
}
3341

3442
// MARK: DirectCallDelegate

QuickStart/AppDelegate.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2525
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2626
// MARK: SendBirdCall.configure(appId:)
2727
// See [here](https://github.com/sendbird/quickstart-calls-ios#creating-a-sendbird-application) for the application ID.
28+
// If you want to sign in with QR code, don't configure your app ID in code.
2829
// SendBirdCall.configure(appId: YOUR_APP_ID)
2930

3031
self.autoSignIn { error in
@@ -80,8 +81,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
8081
}
8182

8283
func authenticate(with credential: Credential, completionHandler: @escaping (Error?) -> Void) {
83-
// Configure app ID before authenticate
84-
SendBirdCall.configure(appId: credential.appId)
84+
// Configure app ID before authenticate when there is no configured app ID
85+
if SendBirdCall.appId == nil { SendBirdCall.configure(appId: credential.appId) }
8586

8687
// Authenticate
8788
let authParams = AuthenticateParams(userId: credential.userId, accessToken: credential.accessToken)

QuickStart/CXExtensions/CXCallManager.swift

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,33 @@ extension CXCallManager: CXProviderDelegate {
134134
return
135135
}
136136

137-
// For decline
138-
if call.endResult == DirectCallEndResult.none || call.endResult == .unknown {
139-
SendBirdCall.authenticateIfNeed { [weak call] (error) in
140-
guard let call = call, error == nil else {
141-
action.fail()
142-
return
137+
var backgroundTaskID: UIBackgroundTaskIdentifier = .invalid
138+
139+
// For decline in background
140+
DispatchQueue.global().async {
141+
backgroundTaskID = UIApplication.shared.beginBackgroundTask {
142+
UIApplication.shared.endBackgroundTask(backgroundTaskID)
143+
backgroundTaskID = .invalid
144+
}
145+
146+
if call.endResult == DirectCallEndResult.none || call.endResult == .unknown {
147+
SendBirdCall.authenticateIfNeed { [weak call] (error) in
148+
guard let call = call, error == nil else {
149+
action.fail()
150+
return
151+
}
152+
153+
call.end {
154+
action.fulfill()
155+
156+
// End background task
157+
UIApplication.shared.endBackgroundTask(backgroundTaskID)
158+
backgroundTaskID = .invalid
159+
}
143160
}
144-
145-
call.end { action.fulfill() }
161+
} else {
162+
action.fulfill()
146163
}
147-
} else {
148-
action.fulfill()
149164
}
150165
}
151166

QuickStart/CXExtensions/CXProvider+QuickStart.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extension CXProviderConfiguration {
2020
// and update correct type of call log in Recents
2121
providerConfiguration.supportsVideo = true
2222
providerConfiguration.maximumCallsPerCallGroup = 1
23+
providerConfiguration.maximumCallGroups = 1
2324
providerConfiguration.supportedHandleTypes = [.generic]
2425

2526
// Set up ringing sound

QuickStart/CallHistory/CallHistory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct CallHistory: Codable {
3939

4040
self.startedAt = CallHistory.dateFormatter.string(from: Date(timeIntervalSince1970: Double(callLog.startedAt) / 1000))
4141
self.duration = callLog.duration.durationText()
42-
self.endResult = callLog.endResult.rawValue
42+
self.endResult = CallStatus.ended(result: callLog.endResult.rawValue).message
4343
}
4444
}
4545

QuickStart/Dial/CallStatus.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ enum CallStatus {
1313

1414
var message: String {
1515
switch self {
16-
case .connecting: return "call connecting..."
17-
case .muted(let user): return "\(user) is muted"
18-
case .ended(let result): return result.replacingOccurrences(of: "_", with: " ")
16+
case .connecting:
17+
return "call connecting..."
18+
case .muted(let user):
19+
return "\(user) is muted"
20+
case .ended(let result):
21+
return result
22+
.replacingOccurrences(of: "_", with: " ")
23+
.capitalizingFirstLetter()
1924
}
2025
}
2126
}

QuickStart/Extensions/String+QuickStart.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ extension String {
2323
return self.trimmed
2424
}
2525
}
26+
27+
public func capitalizingFirstLetter() -> String {
28+
return prefix(1).capitalized + dropFirst()
29+
}
2630
}
2731

2832
extension Optional where Wrapped == String {

QuickStart/Extensions/UserDefaults+QuickStart.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ extension UserDefaults {
3939

4040
extension UserDefaults {
4141
func clear() {
42-
let keys = Key.allCases.filter { $0 != .voipPushToken }
43-
keys.map { $0.value }.forEach(UserDefaults.standard.removeObject)
42+
Key.allCases
43+
.filter { $0 != .voipPushToken }
44+
.map { $0.value }
45+
.forEach(UserDefaults.standard.removeObject)
4446
}
4547
}
4648

0 commit comments

Comments
 (0)