Skip to content

Commit

Permalink
release: 0.6.9
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunak-jagtap committed May 16, 2024
1 parent d2d72f1 commit 8e9dd1d
Show file tree
Hide file tree
Showing 19 changed files with 686 additions and 134 deletions.
2 changes: 1 addition & 1 deletion DyteUiKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.ios.frameworks = ['UIKit', 'AVFAudio']
s.resource_bundle = { 'DyteUiKit' => 'DyteUiKit/Resources/*' }
s.module_name = 'DyteUiKit'
s.dependency 'DyteiOSCore', '~> 1.34.6'
s.dependency 'DyteiOSCore', '~> 1.36.0'
s.dependency 'DyteWebRTC', '~> 0.0.4'
s.dependency 'AmazonIVSPlayer', '~> 1.19.0'
end
1 change: 1 addition & 0 deletions DyteUiKit/DyteUiKit/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Shared {
private var viewedPollCount: Int = 0
var delegate: DyteUiKitLifeCycle?
var notification: DyteNotificationConfig!
var privateChatReadLookup = [String:Bool]()

func getUnreadChatCount(totalMessage: Int) -> Int {
let unreadCount = totalMessage - chatReadCount
Expand Down
5 changes: 5 additions & 0 deletions DyteUiKit/DyteUiKit/DyteUiKit/Atoms/DytePluginsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public class DytePluginsView: UIView {
public let syncButton: SyncScreenShareTabButton?

private var clickAction:((DytePluginScreenShareTabButton, Bool)-> Void)?
private var syncButtonClickAction:((SyncScreenShareTabButton)-> Void)?
private let stackView = DyteUIUTility.createStackView(axis: .vertical, spacing: 0)
private let activeSpeakerView: ActiveSpeakerPinView
private let backgroundColorValue = DesignLibrary.shared.color.background.video
Expand Down Expand Up @@ -232,8 +233,12 @@ public class DytePluginsView: UIView {
self.syncButton?.addTarget(self, action: #selector(syncButtonClick(button:)), for: .touchUpInside)
}

public func observeSyncButtonClick(clickAction:((SyncScreenShareTabButton)-> Void)?) {
self.syncButtonClickAction = clickAction
}
@objc func syncButtonClick(button: SyncScreenShareTabButton) {
button.isSelected = !button.isSelected
self.syncButtonClickAction?(button)
}

public func setButtons(buttons: [DytePluginScreenShareTabButton], selectedIndex: Int?, clickAction:@escaping(DytePluginScreenShareTabButton, Bool)->Void) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
import UIKit
import DyteiOSCore

protocol ChatParticipantSelectionDelegate: AnyObject {
func didSelectChat(withParticipant participant: DyteJoinedMeetingParticipant?)
}

class ChatParticipantSelectionViewController: UIViewController, SetTopbar {
public var shouldShowTopBar: Bool = true
public var topBar: DyteNavigationBar = DyteNavigationBar(title: "Chat with...")
weak var delegate: ChatParticipantSelectionDelegate?
private var participants = [DyteJoinedMeetingParticipant]()
private var filteredParticipants = [DyteJoinedMeetingParticipant]()
var selectedParticipant: DyteJoinedMeetingParticipant?

private lazy var searchBar: UISearchBar = {
let searchBar = UISearchBar()
searchBar.placeholder = "Search participants"
searchBar.delegate = self
return searchBar
}()

private lazy var tableView: UITableView = {
let tableView = UITableView()
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = DesignLibrary.shared.color.background.shade1000
return tableView
}()

func setParticipants(participants: [DyteJoinedMeetingParticipant]) {
self.participants = participants
self.filteredParticipants = participants
}

func newChatReceived(message: DyteChatMessage) {
self.tableView.reloadData()
}

func onRemove(userId: String) {
Shared.data.privateChatReadLookup.removeValue(forKey: userId)
self.tableView.reloadData()
}

func onParticipantJoin(userId: String) {
Shared.data.privateChatReadLookup[userId] = false
self.tableView.reloadData()
}


override func viewDidLoad() {
super.viewDidLoad()
setupViews()
filteredParticipants = participants
}

public override func viewSafeAreaInsetsDidChange() {
super.viewSafeAreaInsetsDidChange()
topBar.get(.top)?.constant = self.view.safeAreaInsets.top
}

private func setupViews() {
self.addTopBar(dismissAnimation: true)
topBar.backgroundColor = tableView.backgroundColor
topBar.leftButton.backgroundColor = tableView.backgroundColor
tableView.register(ParticipantInCallTableViewCell.self, forCellReuseIdentifier: "ParticipantInCallTableViewCell")
searchBar.translatesAutoresizingMaskIntoConstraints = false
tableView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(searchBar)
view.addSubview(tableView)

NSLayoutConstraint.activate([
searchBar.topAnchor.constraint(equalTo: topBar.bottomAnchor),
searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
searchBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),

tableView.topAnchor.constraint(equalTo: searchBar.bottomAnchor),
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
}

extension ChatParticipantSelectionViewController: UITableViewDelegate, UITableViewDataSource {

func numberOfSections(in tableView: UITableView) -> Int {
return 2
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 1
} else {
return filteredParticipants.count
}
}

private func setNotificationBadge(show: Bool, cell: ParticipantInCallTableViewCell) {

if cell.notificationBadge == nil {
var notificationBadge = DyteNotificationBadgeView()
cell.addSubview(notificationBadge)
let notificationBadgeHeight = dyteSharedTokenSpace.space4
notificationBadge.set(.centerY(cell.moreButton),
.before(cell.moreButton, notificationBadgeHeight),
.height(notificationBadgeHeight),
.width(notificationBadgeHeight*2.5, .lessThanOrEqual))

notificationBadge.layer.cornerRadius = notificationBadgeHeight/2.0
notificationBadge.layer.masksToBounds = true
notificationBadge.backgroundColor = dyteSharedTokenColor.brand.shade500
cell.notificationBadge = notificationBadge

}
cell.notificationBadge!.isHidden = !show
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ParticipantInCallTableViewCell", for: indexPath) as! ParticipantInCallTableViewCell
cell.selectionStyle = .none

if indexPath.section == 0 {
cell.audioButton.isHidden = true
cell.videoButton.isHidden = true

cell.backgroundColor = selectedParticipant == nil ? DesignLibrary.shared.color.background.shade900 : tableView.backgroundColor
cell.moreButton.setImage(ImageProvider.image(named: "icon_right_arrow"), for: .normal)
cell.moreButton.backgroundColor = cell.backgroundColor
cell.setPinView(isHidden: true)
cell.contentView.backgroundColor = cell.backgroundColor
cell.nameLabel.text = "Everyone in meeting"
cell.profileAvatarView.backgroundColor = .clear
cell.profileAvatarView.profileImageView.setImage(image: DyteImage(image: ImageProvider.image(named: "icon_participants")))
setNotificationBadge(show: Shared.data.privateChatReadLookup["everyone"] ?? false, cell: cell)
} else {
cell.backgroundColor = filteredParticipants[indexPath.row].userId == selectedParticipant?.userId ? DesignLibrary.shared.color.background.shade900 : tableView.backgroundColor

let participant = filteredParticipants[indexPath.row]
cell.profileAvatarView.set(participant: participant)
cell.moreButton.backgroundColor = cell.backgroundColor
cell.audioButton.isHidden = true
cell.videoButton.isHidden = true
cell.contentView.backgroundColor = cell.backgroundColor
cell.moreButton.setImage(ImageProvider.image(named: "icon_right_arrow"), for: .normal)
cell.nameLabel.text = participant.name
cell.cellSeparatorBottom.isHidden = true
cell.cellSeparatorTop.isHidden = true
cell.profileAvatarView.backgroundColor = dyteSharedTokenColor.brand.shade500
cell.setPinView(isHidden: true)
if let show = Shared.data.privateChatReadLookup[participant.userId] {
setNotificationBadge(show: show, cell: cell)
}
}

return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 0 {
delegate?.didSelectChat(withParticipant: nil)
} else {
delegate?.didSelectChat(withParticipant: filteredParticipants[indexPath.row])
}
dismiss(animated: true, completion: nil)
}
}

extension ChatParticipantSelectionViewController: UISearchBarDelegate {
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
let searchText = searchText.trimmingCharacters(in: .whitespacesAndNewlines)
if searchText.isEmpty {
filteredParticipants = participants
} else {
filteredParticipants = participants.filter { participant in
participant.name.lowercased().contains(searchText.lowercased())
}
}
tableView.reloadData()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ class FileMessageCell: UITableViewCell {
setupViews()
}

override func prepareForReuse() {
super.prepareForReuse()
fileTitleLabel.text = nil
fileTypeLabel.text = nil
fileSizeLabel.text = nil
nameLabel.text = nil
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ class MessageCell: UITableViewCell {
fatalError("init(coder:) has not been implemented")
}

override func prepareForReuse() {
super.prepareForReuse()

nameLabel.text = nil
messageLabel.text = nil
messageImageView.image = nil
}


@objc private func downloadButtonTapped() {
// Call the download button action closure
downloadButtonAction?()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,30 @@ open class DyteBaseViewController: UIViewController, AdaptableUI {

public func addWaitingRoom(completion:@escaping()->Void) {
self.dyteSelfListner.waitListStatusUpdate = { [weak self] status in
guard self != nil else {return}
guard let self = self else {return}
let callBack : ()-> Void = {
completion()
}
showWaitingRoom(status: status, completion: callBack)
self.waitingRoomView?.removeFromSuperview()
if let waitingView = showWaitingRoom(status: status, completion: callBack) {
waitingView.backgroundColor = self.view.backgroundColor
waitingView.set(.fillSuperView(self.view))
self.view.endEditing(true)
self.view.addSubview(waitingView)
self.waitingRoomView = waitingView
}
}

func showWaitingRoom(status: WaitListStatus, completion: @escaping()->Void) {
waitingRoomView?.removeFromSuperview()
func showWaitingRoom(status: WaitListStatus, completion: @escaping()->Void) -> WaitingRoomView? {
if status != .none {
let waitingView = WaitingRoomView(automaticClose: false, onCompletion: { [weak self] in
guard self != nil else {return}
completion()
let waitingView = WaitingRoomView(automaticClose: false, onCompletion: {
completion()
})
waitingView.accessibilityIdentifier = "WaitingRoom_View"
waitingView.backgroundColor = self.view.backgroundColor
self.view.addSubview(waitingView)
waitingView.set(.fillSuperView(self.view))
self.view.endEditing(true)
waitingRoomView = waitingView
waitingView.show(status: ParticipantMeetingStatus.getStatus(status: status))
return waitingView
}
return nil
}
}

Expand Down
Loading

0 comments on commit 8e9dd1d

Please sign in to comment.