Skip to content

Commit 8ea77cb

Browse files
author
Jaesung
authored
Merge pull request #52 from sendbird/release/1.1.1
Version 1.1.1 (Merge to master)
2 parents 999ca08 + 00a769c commit 8ea77cb

13 files changed

+151
-74
lines changed

QuickStart.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@
787787
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
788788
CODE_SIGN_ENTITLEMENTS = QuickStart/QuickStart.entitlements;
789789
CODE_SIGN_STYLE = Automatic;
790-
CURRENT_PROJECT_VERSION = 18;
790+
CURRENT_PROJECT_VERSION = 1;
791791
DEVELOPMENT_TEAM = RM4A5PXTUX;
792792
FRAMEWORK_SEARCH_PATHS = (
793793
"$(inherited)",
@@ -799,7 +799,7 @@
799799
"$(inherited)",
800800
"@executable_path/Frameworks",
801801
);
802-
MARKETING_VERSION = 1.0.1;
802+
MARKETING_VERSION = 1.1.1;
803803
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart;
804804
PRODUCT_NAME = "SendBird Calls";
805805
SWIFT_VERSION = 5.0;
@@ -816,7 +816,7 @@
816816
CODE_SIGN_ENTITLEMENTS = QuickStart/QuickStart.entitlements;
817817
CODE_SIGN_IDENTITY = "Apple Development";
818818
CODE_SIGN_STYLE = Automatic;
819-
CURRENT_PROJECT_VERSION = 18;
819+
CURRENT_PROJECT_VERSION = 1;
820820
DEVELOPMENT_TEAM = RM4A5PXTUX;
821821
FRAMEWORK_SEARCH_PATHS = (
822822
"$(inherited)",
@@ -828,7 +828,7 @@
828828
"$(inherited)",
829829
"@executable_path/Frameworks",
830830
);
831-
MARKETING_VERSION = 1.0.1;
831+
MARKETING_VERSION = 1.1.1;
832832
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart;
833833
PRODUCT_NAME = "SendBird Calls";
834834
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -849,6 +849,7 @@
849849
"@executable_path/Frameworks",
850850
"@executable_path/../../Frameworks",
851851
);
852+
MARKETING_VERSION = 1.1.1;
852853
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart.QuickStartIntent;
853854
PRODUCT_NAME = "$(TARGET_NAME)";
854855
SKIP_INSTALL = YES;
@@ -870,6 +871,7 @@
870871
"@executable_path/Frameworks",
871872
"@executable_path/../../Frameworks",
872873
);
874+
MARKETING_VERSION = 1.1.1;
873875
PRODUCT_BUNDLE_IDENTIFIER = com.sendbird.calls.quickstart.QuickStartIntent;
874876
PRODUCT_NAME = "$(TARGET_NAME)";
875877
SKIP_INSTALL = YES;

QuickStart/CallHistory/CallHistory.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ struct CallHistory: Codable {
1414
let hasVideo: Bool
1515
let remoteUserProfileURL: String?
1616
let remoteUserID: String
17+
let remoteNickname: String
1718
let duration: String
1819
let endResult: String
1920
let startedAt: String
2021

2122
static var dateFormatter: DateFormatter {
2223
let dateFormatter = DateFormatter()
23-
dateFormatter.dateFormat = "YYYY/MM/d HH:mm"
24+
dateFormatter.dateFormat = "YYYY/MM/dd HH:mm"
2425
return dateFormatter
2526
}
2627

@@ -34,6 +35,7 @@ struct CallHistory: Codable {
3435
let remoteUser = callLog.myRole == .caller ? callLog.callee : callLog.caller
3536
self.remoteUserProfileURL = remoteUser?.profileURL
3637
self.remoteUserID = remoteUser?.userId ?? "Unknown"
38+
self.remoteNickname = remoteUser?.nickname ?? ""
3739

3840
self.startedAt = CallHistory.dateFormatter.string(from: Date(timeIntervalSince1970: Double(callLog.startedAt) / 1000))
3941
self.duration = callLog.duration.timerText()

QuickStart/CallHistory/CallHistoryTableViewCell.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class CallHistoryTableViewCell: UITableViewCell {
1414

1515
@IBOutlet weak var remoteUserProfileImageView: UIImageView!
1616

17+
@IBOutlet weak var remoteNicknameLabel: UILabel!
1718
@IBOutlet weak var remoteUserIDLabel: UILabel!
1819
@IBOutlet weak var startedAtLabel: UILabel!
19-
@IBOutlet weak var callDurationLabel: UILabel!
2020
@IBOutlet weak var endResultLabel: UILabel!
2121

2222
@IBOutlet weak var voiceCallButton: UIButton!
@@ -37,11 +37,11 @@ class CallHistoryTableViewCell: UITableViewCell {
3737
self.callTypeImageView.image = UIImage.callTypeImage(outgoing: self.callHistory.outgoing, hasVideo: self.callHistory.hasVideo)
3838
self.remoteUserProfileImageView.updateImage(urlString: self.callHistory.remoteUserProfileURL)
3939

40-
self.remoteUserIDLabel.text = self.callHistory.remoteUserID
40+
self.remoteNicknameLabel.text = self.callHistory.remoteNickname
41+
self.remoteUserIDLabel.text = "User ID: " + self.callHistory.remoteUserID
4142

4243
self.startedAtLabel.text = self.callHistory.startedAt
43-
self.callDurationLabel.text = self.callHistory.duration
44-
self.endResultLabel.text = self.callHistory.endResult
44+
self.endResultLabel.text = self.callHistory.endResult + " · " + self.callHistory.duration
4545
}
4646

4747
@IBAction func didTapVoiceCall() {

QuickStart/CallHistory/CallHistoryViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class CallHistoryViewController: UIViewController, UITableViewDataSource, UITabl
132132
extension CallHistoryViewController {
133133
// When select table view cell, make a call based on its `CallHistory` information.
134134
func didTapCallHistoryCell(_ cell: CallHistoryTableViewCell) {
135-
guard let remoteUserID = cell.remoteUserIDLabel.text else { return }
135+
guard let remoteUserID = cell.remoteNicknameLabel.text else { return }
136136
let isVideoCall = cell.callHistory.hasVideo
137137
let dialParams = DialParams(calleeId: remoteUserID,
138138
isVideoCall: isVideoCall,

QuickStart/Dial/DialViewController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ class DialViewController: UIViewController, UITextFieldDelegate {
1717
self.profileImageView.updateImage(urlString: profileURL)
1818
}
1919
}
20-
@IBOutlet weak var userIdLabel: UILabel! {
20+
@IBOutlet weak var nicknameLabel: UILabel! {
2121
didSet {
22-
self.userIdLabel.text = UserDefaults.standard.user.id
22+
self.nicknameLabel.text = UserDefaults.standard.user.name.unwrap(with: "-")
23+
}
24+
}
25+
@IBOutlet weak var userIDLabel: UILabel! {
26+
didSet {
27+
self.userIDLabel.text = "User ID: " + UserDefaults.standard.user.id
2328
}
2429
}
2530

QuickStart/Dial/VideoCallViewController.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ class VideoCallViewController: UIViewController, DirectCallDataSource {
2121
@IBOutlet weak var callStatusLabel: UILabel!
2222
@IBOutlet weak var mutedStateLabel: UILabel! {
2323
didSet {
24-
self.mutedStateLabel.text = "\(self.call.remoteUser?.userId ?? "Remote user") is on mute"
24+
guard let remoteUser = self.call.remoteUser else { return }
25+
let name = remoteUser.nickname?.isEmptyOrWhitespace == true ? remoteUser.userId : remoteUser.nickname!
26+
self.mutedStateLabel.text = "\(name) is on mute"
2527
}
2628
}
27-
@IBOutlet weak var remoteUserIdLabel: UILabel! {
29+
@IBOutlet weak var remoteNicknameLabel: UILabel! {
2830
didSet {
29-
self.remoteUserIdLabel.text = self.call.remoteUser?.userId
31+
let nickname = self.call.remoteUser?.nickname
32+
self.remoteNicknameLabel.text = nickname?.isEmptyOrWhitespace == true ? self.call.remoteUser?.userId : nickname
3033
}
3134
}
3235

@@ -77,7 +80,7 @@ class VideoCallViewController: UIViewController, DirectCallDataSource {
7780
}
7881

7982
// Constraints of remote user ID
80-
@IBOutlet weak var topSpaceRemoteUserId: NSLayoutConstraint!
83+
@IBOutlet weak var topSpaceRemoteNickname: NSLayoutConstraint!
8184

8285
var call: DirectCall!
8386
var isDialing: Bool?
@@ -112,9 +115,9 @@ class VideoCallViewController: UIViewController, DirectCallDataSource {
112115
func setupEndedCallUI() {
113116
// Tell user that the call has been ended.
114117
self.callStatusLabel.text = "Call Ended"
115-
self.topSpaceRemoteUserId.constant = 244
118+
self.topSpaceRemoteNickname.constant = 244
116119
self.callStatusLabel.isHidden = false
117-
self.remoteUserIdLabel.isHidden = false
120+
self.remoteNicknameLabel.isHidden = false
118121
self.remoteProfileImageView.isHidden = false
119122

120123
// Release resource
@@ -286,7 +289,7 @@ extension VideoCallViewController {
286289
extension VideoCallViewController: DirectCallDelegate {
287290
// MARK: Required Methods
288291
func didConnect(_ call: DirectCall) {
289-
self.remoteUserIdLabel.isHidden = true
292+
self.remoteNicknameLabel.isHidden = true
290293
self.callStatusLabel.isHidden = true
291294
self.updateRemoteAudio(isEnabled: call.isRemoteAudioEnabled)
292295

@@ -329,5 +332,8 @@ extension VideoCallViewController: DirectCallDelegate {
329332
self.audioRouteButton.setBackgroundImage(.audio(output: output.portType),
330333
for: .normal)
331334
print("[QuickStart] Audio Route has been changed to \(output.portName)")
335+
336+
// Disable to display `AVAudioPickerView` (also `MPVolumeView`) when it is speaker mode.
337+
self.audioRouteButton.isEnabled = output.portType != .builtInSpeaker
332338
}
333339
}

QuickStart/Dial/VoiceCallViewController.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class VoiceCallViewController: UIViewController, DirectCallDataSource {
2121
}
2222
@IBOutlet weak var nameLabel: UILabel! {
2323
didSet {
24-
self.nameLabel.text = self.call.remoteUser?.userId
24+
let nickname = self.call.remoteUser?.nickname
25+
self.nameLabel.text = nickname?.isEmptyOrWhitespace == true ? self.call.remoteUser?.userId : nickname
2526
}
2627
}
2728

@@ -38,7 +39,10 @@ class VoiceCallViewController: UIViewController, DirectCallDataSource {
3839
@IBOutlet weak var mutedStateImageView: UIImageView!
3940
@IBOutlet weak var mutedStateLabel: UILabel! {
4041
didSet {
41-
self.mutedStateLabel.text = "\(self.call.remoteUser?.userId ?? "Remote user") is on mute"
42+
guard let remoteUser = self.call.remoteUser else { return }
43+
let name = remoteUser.nickname?.isEmptyOrWhitespace == true ? remoteUser.userId : remoteUser.nickname!
44+
45+
self.mutedStateLabel.text = "\(name) is on mute"
4246
}
4347
}
4448

QuickStart/Extensions/Int64+QuickStart.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ extension Int64 {
2020
// update UI
2121
var timeText = [String]()
2222

23-
if hour > 0 { timeText.append(String(hour)) }
24-
timeText.append(String(format: "%02d", minute))
25-
timeText.append(String(format: "%02d", second))
23+
if hour > 0 { timeText.append(String(hour) + "h") }
24+
if minute > 0 { timeText.append(String(format: "%02d", minute) + "m") }
25+
timeText.append(String(format: "%02d", second) + "s")
2626

27-
return timeText.joined(separator: ":")
27+
return timeText.joined(separator: " ")
2828
}
2929
}

QuickStart/Extensions/String+QuickStart.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,20 @@ extension String {
2424
}
2525
}
2626
}
27+
28+
29+
extension Optional where Wrapped == String {
30+
/// Unwraps optional value with replacement.
31+
///
32+
/// - Parameters:
33+
/// - replacement: When the unwrapped value is invalid(`nil` or empty `String`), this method will return replacement.
34+
/// - checkWhiteSpace: The value for checking white space.
35+
///
36+
/// - Note: Set `checkWhiteSpace` to `false` when you don't want to check white space of nickname.
37+
func unwrap(with replacement: String, checkWhiteSpace: Bool = true) -> String {
38+
guard let unwrappedValue = self else { return replacement }
39+
// Check empty string or whitespace if needed
40+
if checkWhiteSpace, unwrappedValue.isEmptyOrWhitespace { return replacement }
41+
return unwrappedValue
42+
}
43+
}

QuickStart/Settings/SettingsTableViewController.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,19 @@ class SettingsTableViewController: UITableViewController {
1717
}
1818
@IBOutlet weak var usernameLabel: UILabel! {
1919
didSet {
20-
self.usernameLabel.text = UserDefaults.standard.user.name
20+
self.usernameLabel.text = UserDefaults.standard.user.name.unwrap(with: "-")
2121
}
2222
}
2323
@IBOutlet weak var userIdLabel: UILabel! {
2424
didSet {
25-
self.userIdLabel.text = UserDefaults.standard.user.id
25+
self.userIdLabel.text = "User ID " + UserDefaults.standard.user.id
26+
}
27+
}
28+
29+
@IBOutlet weak var versionLabel: UILabel! {
30+
didSet {
31+
let sampleVersion = Bundle.main.version
32+
self.versionLabel.text = "QuickStart \(sampleVersion) Calls SDK \(SendBirdCall.sdkVersion)"
2633
}
2734
}
2835

@@ -72,10 +79,13 @@ extension SettingsTableViewController {
7279
guard let token = UserDefaults.standard.voipPushToken else { return }
7380

7481
// MARK: SendBirdCall Deauthenticate
75-
SendBirdCall.deauthenticate(voipPushToken: token) { error in
82+
SendBirdCall.unregisterVoIPPush(token: token) { error in
83+
// Handle error
84+
if let error = error { print("[QuickStart]" + error.localizedDescription) }
85+
7686
UserDefaults.standard.clear()
77-
guard error == nil else { return }
87+
88+
SendBirdCall.deauthenticate { _ in }
7889
}
7990
}
8091
}
81-

0 commit comments

Comments
 (0)