Skip to content

Commit 6f3d4bb

Browse files
pushpsenairekar2911pushpsenairekar2911
authored andcommitted
v2.3.5-1
1 parent 58b6e6a commit 6f3d4bb

File tree

140 files changed

+8014
-5702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+8014
-5702
lines changed

.DS_Store

0 Bytes
Binary file not shown.

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ email, or any other method with the owners of this repository before making a ch
66
Please note we have a code of conduct, please follow it in all your interactions with the project.
77

88

9+
910
## Pull Request Process
1011

1112
1. Ensure any install or build dependencies are removed before the end of the layer when doing a

CometChatObjc/CometChatObjc.xcodeproj/project.pbxproj

Lines changed: 2743 additions & 2679 deletions
Large diffs are not rendered by default.

CometChatObjc/CometChatObjc/Library/UI Components/Calls/Call Logs/CometChatCallDetail.swift

Lines changed: 24 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,11 @@ class CometChatCallDetails: UIViewController {
134134
progressIndicator.LoadingLabel.text = "Unable to fetch History."
135135
self.tableView.reloadRows(at: [indexPath], with: .automatic)
136136
}
137-
if let errorCode = error?.errorCode, let errorDescription = error?.errorDescription {
138-
if errorCode.isLocalized {
139-
CometChatSnackBoard.display(message: errorCode.localized() , mode: .error, duration: .short)
140-
}else{
141-
CometChatSnackBoard.display(message: errorDescription , mode: .error, duration: .short)
142-
}
137+
if let error = error {
138+
CometChatSnackBoard.showErrorMessage(for: error)
143139
}
144140
}
145-
141+
146142
})
147143
}
148144

@@ -292,8 +288,8 @@ extension CometChatCallDetails: UITableViewDelegate , UITableViewDataSource {
292288
/// - tableView: The table-view object requesting this information.
293289
/// - section: An index number identifying a section of tableView .
294290
public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
295-
let returnedView = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 25))
296-
let sectionTitle = UILabel(frame: CGRect(x: 10, y: 2, width: view.frame.size.width, height: 20))
291+
let returnedView = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width - 20, height: 25))
292+
let sectionTitle = UILabel(frame: CGRect(x: 10, y: 2, width: returnedView.frame.size.width, height: 20))
297293
if section == 0 {
298294
sectionTitle.text = ""
299295
}else if section == 1{
@@ -351,14 +347,12 @@ extension CometChatCallDetails: UITableViewDelegate , UITableViewDataSource {
351347
let userDetail = tableView.dequeueReusableCell(withIdentifier: "detailView", for: indexPath) as! CometChatDetailItem
352348
userDetail.detailViewDelegate = self
353349
userDetail.user = currentUser
354-
userDetail.call.isHidden = false
355350
userDetail.separatorInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
356351
return userDetail
357352
}else if currentGroup != nil {
358353
let groupDetail = tableView.dequeueReusableCell(withIdentifier: "detailView", for: indexPath) as! CometChatDetailItem
359354
groupDetail.group = currentGroup
360355
groupDetail.detailViewDelegate = self
361-
groupDetail.call.isHidden = false
362356
groupDetail.separatorInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
363357
groupDetail.separatorInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
364358
return groupDetail
@@ -456,18 +450,11 @@ extension CometChatCallDetails: UITableViewDelegate , UITableViewDataSource {
456450
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "didUserUnblocked"), object: nil, userInfo: nil)
457451
if let user = self.currentUser, let name = user.name {
458452
self.set(user: user)
459-
DispatchQueue.main.async {
460-
CometChatSnackBoard.display(message: name + " " + "UNBLOCKED_SUCCESSFULLY".localized(), mode: .success, duration: .short)
461-
}
462453
}
463454
}) { (error) in
464455
DispatchQueue.main.async {
465-
if let errorCode = error?.errorCode, let errorDescription = error?.errorDescription {
466-
if errorCode.isLocalized {
467-
CometChatSnackBoard.display(message: errorCode.localized() , mode: .error, duration: .short)
468-
}else{
469-
CometChatSnackBoard.display(message: errorDescription , mode: .error, duration: .short)
470-
}
456+
if let error = error {
457+
CometChatSnackBoard.showErrorMessage(for: error)
471458
}
472459
}
473460
}
@@ -478,17 +465,12 @@ extension CometChatCallDetails: UITableViewDelegate , UITableViewDataSource {
478465
self.set(user: user)
479466
let data:[String: String] = ["name": name]
480467
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "didUserBlocked"), object: nil, userInfo: data)
481-
CometChatSnackBoard.display(message: name + " " + "BLOCKED_SUCCESSFULLY".localized(), mode: .success, duration: .short)
482468
}
483469
}
484470
}) { (error) in
485471
DispatchQueue.main.async {
486-
if let errorCode = error?.errorCode, let errorDescription = error?.errorDescription {
487-
if errorCode.isLocalized {
488-
CometChatSnackBoard.display(message: errorCode.localized() , mode: .error, duration: .short)
489-
}else{
490-
CometChatSnackBoard.display(message: errorDescription , mode: .error, duration: .short)
491-
}
472+
if let error = error {
473+
CometChatSnackBoard.showErrorMessage(for: error)
492474
}
493475
}
494476

@@ -501,19 +483,12 @@ extension CometChatCallDetails: UITableViewDelegate , UITableViewDataSource {
501483
DispatchQueue.main.async {
502484
self.dismiss(animated: true) {
503485
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "didGroupDeleted"), object: nil, userInfo: nil)
504-
let message = "YOU_LEFT_FROM".localized() + " " + (self.currentGroup?.name ?? "") + "."
505-
CometChatSnackBoard.display(message: message, mode: .success, duration: .short)
506486
}
507-
508487
}
509488
}) { (error) in
510489
DispatchQueue.main.async {
511-
if let errorCode = error?.errorCode, let errorDescription = error?.errorDescription {
512-
if errorCode.isLocalized {
513-
CometChatSnackBoard.display(message: errorCode.localized() , mode: .error, duration: .short)
514-
}else{
515-
CometChatSnackBoard.display(message: errorDescription , mode: .error, duration: .short)
516-
}
490+
if let error = error {
491+
CometChatSnackBoard.showErrorMessage(for: error)
517492
}
518493
}
519494

@@ -566,45 +541,22 @@ extension CometChatCallDetails: UITableViewDelegate , UITableViewDataSource {
566541
extension CometChatCallDetails : DetailViewDelegate {
567542

568543

569-
/// This method triggers when user pressed on Call Button in CometChatDetailItem
570-
/// - Parameter for: This specifies `AppEntity` Object
571-
func didCallButtonPressed(for: AppEntity) {
572-
let actionSheetController: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
573-
let audioCall: UIAlertAction = UIAlertAction(title: "AUDIO_CALL".localized(), style: .default) { action -> Void in
574-
if let user = self.currentUser {
575-
CometChatCallManager().makeCall(call: .audio, to: user)
576-
}
577-
if let group = self.currentGroup {
578-
CometChatCallManager().makeCall(call: .audio, to: group)
579-
}
544+
func didAudioCallButtonPressed(for: AppEntity) {
545+
if let user = self.currentUser {
546+
CometChatCallManager().makeCall(call: .audio, to: user)
580547
}
581-
582-
let videoCall: UIAlertAction = UIAlertAction(title: "VIDEO_CALL".localized(), style: .default) { action -> Void in
583-
if let user = self.currentUser {
584-
CometChatCallManager().makeCall(call: .video, to: user)
585-
}
586-
587-
if let group = self.currentGroup {
588-
CometChatCallManager().makeCall(call: .video, to: group)
589-
}
548+
if let group = self.currentGroup {
549+
CometChatCallManager().makeCall(call: .audio, to: group)
590550
}
591-
592-
let cancelAction: UIAlertAction = UIAlertAction(title: "CANCEL".localized(), style: .cancel) { action -> Void in
551+
}
552+
553+
func didVideoCallButtonPressed(for: AppEntity) {
554+
if let user = self.currentUser {
555+
CometChatCallManager().makeCall(call: .video, to: user)
593556
}
594-
cancelAction.setValue(UIColor.red, forKey: "titleTextColor")
595-
actionSheetController.addAction(audioCall)
596-
actionSheetController.addAction(videoCall)
597-
actionSheetController.addAction(cancelAction)
598-
actionSheetController.view.tintColor = UIKitSettings.primaryColor
599-
// Added ActionSheet support for iPad
600-
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad ){
601-
if let currentPopoverpresentioncontroller =
602-
actionSheetController.popoverPresentationController{
603-
currentPopoverpresentioncontroller.sourceView = self.view
604-
self.present(actionSheetController, animated: true, completion: nil)
605-
}
606-
}else{
607-
self.present(actionSheetController, animated: true, completion: nil)
557+
558+
if let group = self.currentGroup {
559+
CometChatCallManager().makeCall(call: .video, to: group)
608560
}
609561
}
610562
}

CometChatObjc/CometChatObjc/Library/UI Components/Calls/Call Logs/CometChatCallsList.swift

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,11 @@ public class CometChatCallsList: UIViewController {
133133

134134
}, onError: { (error) in
135135
DispatchQueue.main.async {
136-
if let errorCode = error?.errorCode, let errorDescription = error?.errorDescription {
137-
if errorCode.isLocalized {
138-
CometChatSnackBoard.display(message: errorCode.localized() , mode: .error, duration: .short)
139-
}else{
140-
CometChatSnackBoard.display(message: errorDescription , mode: .error, duration: .short)
141-
}
136+
if let error = error {
137+
CometChatSnackBoard.showErrorMessage(for: error)
142138
}
143139
}
144-
140+
145141
})
146142
}
147143

@@ -184,17 +180,12 @@ public class CometChatCallsList: UIViewController {
184180
}
185181
}, onError: { (error) in
186182
DispatchQueue.main.async {
187-
if let errorCode = error?.errorCode, let errorDescription = error?.errorDescription {
188-
self.activityIndicator?.stopAnimating()
189-
self.tableView.tableFooterView?.isHidden = true
190-
if errorCode.isLocalized {
191-
CometChatSnackBoard.display(message: errorCode.localized() , mode: .error, duration: .short)
192-
}else{
193-
CometChatSnackBoard.display(message: errorDescription , mode: .error, duration: .short)
194-
}
183+
self.activityIndicator?.stopAnimating()
184+
self.tableView.tableFooterView?.isHidden = true
185+
if let error = error {
186+
CometChatSnackBoard.showErrorMessage(for: error)
195187
}
196188
}
197-
198189
})
199190
}
200191

@@ -392,7 +383,7 @@ extension CometChatCallsList: UITableViewDelegate , UITableViewDataSource {
392383
/// - tableView: The table-view object requesting this information.
393384
/// - section: An index number identifying a section of tableView .
394385
public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
395-
let returnedView = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 0.5))
386+
let returnedView = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width - 20, height: 0.5))
396387
return returnedView
397388
}
398389

@@ -537,12 +528,8 @@ extension CometChatCallsList: UITableViewDelegate , UITableViewDataSource {
537528
}
538529
}) { (error) in
539530
DispatchQueue.main.async {
540-
if let errorCode = error.errorCode as? String, let errorDescription = error.errorDescription as? String{
541-
if errorCode.isLocalized {
542-
CometChatSnackBoard.display(message: errorCode.localized() , mode: .error, duration: .short)
543-
}else{
544-
CometChatSnackBoard.display(message: errorDescription , mode: .error, duration: .short)
545-
}
531+
if let error = error as? CometChatException{
532+
CometChatSnackBoard.showErrorMessage(for: error)
546533
}
547534
}
548535
}

0 commit comments

Comments
 (0)