Skip to content

Commit

Permalink
chore(release): update DyteUiKit to 0.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dyte-devel committed Sep 5, 2024
1 parent 118c09d commit 16d6623
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 28 deletions.
2 changes: 1 addition & 1 deletion DyteUiKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'DyteUiKit'
s.version = '0.7.5'
s.version = '0.7.6'
s.summary = 'Customise UI of your Dyte meetings'

s.description = "Customise UI of your Dyte meetings. You can use this prebuilt meeting flow or you can customise it on individual component level"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class VideoPeerViewModel {
private func update() {
self.refreshNameTag()
self.refreshInitialName()
participantUpdateListner?.clean()
participantUpdateListner = DyteParticipantUpdateEventListner(participant: participant)
addUpdatesListner()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@

import UIKit

protocol BaseModel {
func clean()
}
protocol ConfigureView {
associatedtype Model
associatedtype Model: BaseModel
var model: Model {get}
func configure(model: Model)
}
Expand Down Expand Up @@ -65,13 +68,20 @@ class TableItemConfigurator<Cell : TableViewCell, Model>: CollectionTableConfigu
}
view_.configure(model: model)
}
deinit {
self.model.clean()
}
}

class TableItemSearchableConfigurator<Cell : TableViewCell, Model>: CollectionTableSearchConfigurator where Cell.Model == Model, Model: Searchable {
override var reuseIdentifier: String {
return Cell.reuseIdentifier
}

deinit {
self.model.clean()
}

var model: Model

init(model: Model) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ class TitleTableViewCell: BaseTableViewCell {
fatalError("init(coder:) has not been implemented")
}
}
struct TitleTableViewCellModel {
struct TitleTableViewCellModel: BaseModel {
var title: String
func clean() {

}
}

extension TitleTableViewCell: ConfigureView {
Expand Down Expand Up @@ -120,9 +123,12 @@ class ButtonTableViewCell: BaseTableViewCell {
}
}

struct ButtonTableViewCellModel {
struct ButtonTableViewCellModel: BaseModel {
var buttonTitle: String
var titleColor: UIColor = dyteSharedTokenColor.status.success
func clean() {

}
}

extension ButtonTableViewCell: ConfigureView {
Expand All @@ -141,8 +147,11 @@ extension ButtonTableViewCell: ConfigureView {
}


struct SearchTableViewCellModel {
struct SearchTableViewCellModel: BaseModel {
var placeHolder: String
func clean() {

}
}

class SearchTableViewCell: BaseTableViewCell {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ extension ParticipantInCallTableViewCell: ConfigureView {
guard let self = self else {return}
self.audioButton.isSelected = !isEnabled
}
let participant = model.participantUpdateEventListner.participant.userId
model.participantUpdateEventListner.observePinState { [weak self] isPinned, observer in
guard let self = self else {return}
self.setPinView(isHidden: !isPinned)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,45 +160,48 @@ extension ParticipantViewController: UITableViewDataSource {
cell.backgroundColor = tableView.backgroundColor

if let cell = cell as? ParticipantInCallTableViewCell {
let model = cell.model
cell.buttonMoreClick = { [weak self] button in
guard let self = self else {return}

if self.createMoreMenu(participantListner: cell.model.participantUpdateEventListner, indexPath: indexPath) {
if self.createMoreMenu(participantListner: model.participantUpdateEventListner, indexPath: indexPath) {
if self.isDebugModeOn {
print("Debug DyteUIKit | Critical UIBug Please check why we are showing this button")
}
}

}
cell.setPinView(isHidden: !cell.model.participantUpdateEventListner.participant.isPinned)

cell.moreButton.accessibilityIdentifier = "InCall_ThreeDots_Button"
} else if let cell = cell as? ParticipantWaitingTableViewCell {
let model = cell.model

cell.buttonCrossClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.waitlistEventListner.rejectWaitingRequest(participant: cell.model.participant)
self.viewModel.waitlistEventListner.rejectWaitingRequest(participant: model.participant)
}
cell.buttonTickClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.waitlistEventListner.acceptWaitingRequest(participant: cell.model.participant)
self.viewModel.waitlistEventListner.acceptWaitingRequest(participant: model.participant)

}
cell.setPinView(isHidden: true)

} else if let cell = cell as? OnStageWaitingRequestTableViewCell {
let model = cell.model

cell.buttonCrossClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.meeting.stage.denyAccess(id: cell.model.participant.id)
self.viewModel.meeting.stage.denyAccess(id: model.participant.id)
button.hideActivityIndicator()
self.reloadScreen()
}
cell.buttonTickClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.meeting.stage.grantAccess(id: cell.model.participant.id)
self.viewModel.meeting.stage.grantAccess(id: model.participant.id)
button.hideActivityIndicator()
self.reloadScreen()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,28 @@
import DyteiOSCore


struct ParticipantWaitingTableViewCellModel {
struct ParticipantWaitingTableViewCellModel: BaseModel {
func clean() {
}

var title: String
var image: DyteImage?
var showBottomSeparator = false
var showTopSeparator = false
var participant: DyteWaitlistedParticipant
}

struct OnStageParticipantWaitingRequestTableViewCellModel {
struct OnStageParticipantWaitingRequestTableViewCellModel: BaseModel {
var title: String
var image: DyteImage?
var showBottomSeparator = false
var showTopSeparator = false
var participant: DyteJoinedMeetingParticipant
func clean() {
}
}

struct ParticipantInCallTableViewCellModel: Searchable {
struct ParticipantInCallTableViewCellModel: Searchable, BaseModel {
func search(text: String) -> Bool {
let parentText = title.lowercased()
if parentText.hasPrefix(text) {
Expand All @@ -38,9 +43,13 @@ struct ParticipantInCallTableViewCellModel: Searchable {
var showTopSeparator = false
var participantUpdateEventListner: DyteParticipantUpdateEventListner
var showMoreButton: Bool
func clean() {
self.participantUpdateEventListner.clean()
}
}

struct WebinarViewersTableViewCellModel: Searchable {
struct WebinarViewersTableViewCellModel: Searchable, BaseModel {

func search(text: String) -> Bool {
let parentText = title.lowercased()
if parentText.hasPrefix(text) {
Expand All @@ -54,6 +63,9 @@ struct WebinarViewersTableViewCellModel: Searchable {
var showTopSeparator = false
var participantUpdateEventListner: DyteParticipantUpdateEventListner
var showMoreButton: Bool
func clean() {
self.participantUpdateEventListner.clean()
}
}


Expand All @@ -68,6 +80,29 @@ struct WebinarViewersTableViewCellModel: Searchable {
func acceptAll()
func rejectAll()
}
extension ParticipantViewControllerModelProtocol {
func moveLocalUserAtTop(section: BaseConfiguratorSection<CollectionTableConfigurator>) {
if let indexYouParticipant = section.items.firstIndex(where: { configurator in
if let configurator = configurator as? TableItemSearchableConfigurator<ParticipantInCallTableViewCell,ParticipantInCallTableViewCellModel> {
if configurator.model.participantUpdateEventListner.participant.userId == meeting.localUser.userId {
return true
}
}
return false
}) {
if let indexFirstParticipantCell = section.items.firstIndex(where: { configurator in
if let configurator = configurator as? TableItemSearchableConfigurator<ParticipantInCallTableViewCell,ParticipantInCallTableViewCellModel> {
return true
}
return false
}) {
section.items.swapAt(indexYouParticipant, indexFirstParticipantCell)
}
}

}

}


public class ParticipantViewControllerModel: ParticipantViewControllerModelProtocol{
Expand Down Expand Up @@ -256,16 +291,18 @@ extension ParticipantViewControllerModel {
if let imageUrl = participant.picture, let url = URL(string: imageUrl) {
image = DyteImage(url: url)
}

sectionTwo.insert(TableItemSearchableConfigurator<ParticipantInCallTableViewCell,ParticipantInCallTableViewCellModel>(model:ParticipantInCallTableViewCellModel(image: image, title: name, showBottomSeparator: showBottomSeparator, showTopSeparator: false, participantUpdateEventListner: DyteParticipantUpdateEventListner(participant: participant), showMoreButton: showMoreButton())))
}
}
self.moveLocalUserAtTop(section: sectionTwo)

return sectionTwo
}


}



public class LiveParticipantViewControllerModel: ParticipantViewControllerModelProtocol, DyteLiveStreamEventsListener {
var dyteSelfListner: DyteEventSelfListner

Expand Down Expand Up @@ -491,6 +528,7 @@ extension LiveParticipantViewControllerModel {
sectionTwo.insert(TableItemSearchableConfigurator<ParticipantInCallTableViewCell,ParticipantInCallTableViewCellModel>(model:ParticipantInCallTableViewCellModel(image: image, title: name, showBottomSeparator: showBottomSeparator, showTopSeparator: false, participantUpdateEventListner: DyteParticipantUpdateEventListner(participant: participant), showMoreButton: showMoreButton())))
}
}
self.moveLocalUserAtTop(section: sectionTwo)
return sectionTwo
}

Expand Down Expand Up @@ -664,8 +702,30 @@ extension ParticipantWebinarViewControllerModel {
sectionTwo.insert(TableItemConfigurator<ParticipantInCallTableViewCell,ParticipantInCallTableViewCellModel>(model:ParticipantInCallTableViewCellModel(image: image, title: name, showBottomSeparator: showBottomSeparator, showTopSeparator: false, participantUpdateEventListner: DyteParticipantUpdateEventListner(participant: participant), showMoreButton: showMoreButton())))
}
}
self.moveLocalUserAtTop(section: sectionTwo)

return sectionTwo
}

private func moveLocalUserAtTop(section: BaseConfiguratorSection<CollectionTableConfigurator>) {
if let indexYouParticipant = section.items.firstIndex(where: { configurator in
if let configurator = configurator as? TableItemSearchableConfigurator<ParticipantInCallTableViewCell,ParticipantInCallTableViewCellModel> {
if configurator.model.participantUpdateEventListner.participant.userId == mobileClient.localUser.userId {
return true
}
}
return false
}) {
if let indexFirstParticipantCell = section.items.firstIndex(where: { configurator in
if let configurator = configurator as? TableItemSearchableConfigurator<ParticipantInCallTableViewCell,ParticipantInCallTableViewCellModel> {
return true
}
return false
}) {
section.items.swapAt(indexYouParticipant, indexFirstParticipantCell)
}
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -175,35 +175,39 @@ extension WebinarParticipantViewController: UITableViewDataSource {
cell.backgroundColor = tableView.backgroundColor

if let cell = cell as? ParticipantInCallTableViewCell {
let model = cell.model
cell.buttonMoreClick = { [weak self] button in
guard let self = self else {return}
if self.createMoreMenu(participantListner: cell.model.participantUpdateEventListner, indexPath: indexPath) {
if self.createMoreMenu(participantListner: model.participantUpdateEventListner, indexPath: indexPath) {
if self.isDebugModeOn {
print("Debug DyteUIKit | Critical UIBug Please check why we are showing this button")
}
}
}
cell.setPinView(isHidden: !cell.model.participantUpdateEventListner.participant.isPinned)
cell.setPinView(isHidden: !model.participantUpdateEventListner.participant.isPinned)

}
else if let cell = cell as? ParticipantWaitingTableViewCell {
let model = cell.model

cell.buttonCrossClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.waitlistEventListner.rejectWaitingRequest(participant: cell.model.participant)
self.viewModel.waitlistEventListner.rejectWaitingRequest(participant: model.participant)
}
cell.buttonTickClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.waitlistEventListner.acceptWaitingRequest(participant: cell.model.participant)
self.viewModel.waitlistEventListner.acceptWaitingRequest(participant: model.participant)
}
cell.setPinView(isHidden: true)

}
else if let cell = cell as? WebinarViewersTableViewCell {
let model = cell.model
cell.buttonMoreClick = { [weak self] button in
guard let self = self else {return}
if self.createMoreMenuForViewers(participantListner: cell.model.participantUpdateEventListner, indexPath: indexPath) {
if self.createMoreMenuForViewers(participantListner: model.participantUpdateEventListner, indexPath: indexPath) {
if self.isDebugModeOn {
print("Debug DyteUIKit | Critical UIBug Please check why we are showing this button")
}
Expand All @@ -212,23 +216,25 @@ extension WebinarParticipantViewController: UITableViewDataSource {
cell.setPinView(isHidden: !cell.model.participantUpdateEventListner.participant.isPinned)
}
else if let cell = cell as? OnStageWaitingRequestTableViewCell {
let model = cell.model
cell.buttonCrossClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.mobileClient.stage.denyAccess(id: cell.model.participant.id)
self.viewModel.mobileClient.stage.denyAccess(id: model.participant.id)
button.hideActivityIndicator()
self.reloadScreen()
}
cell.buttonTickClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
self.viewModel.mobileClient.stage.grantAccess(id: cell.model.participant.id)
self.viewModel.mobileClient.stage.grantAccess(id: model.participant.id)
button.hideActivityIndicator()
self.reloadScreen()
}
cell.setPinView(isHidden: !cell.model.participant.isPinned)
cell.setPinView(isHidden: !model.participant.isPinned)

} else if let cell = cell as? AcceptButtonJoinStageRequestTableViewCell {

cell.buttonClick = { [weak self] button in
guard let self = self else {return}
button.showActivityIndicator()
Expand Down Expand Up @@ -303,7 +309,10 @@ extension WebinarParticipantViewController: UITableViewDataSource {
let participant = participantListner.participant
let hostPermission = self.viewModel.mobileClient.localUser.permissions.host

menus.append(.removeFromStage)
if participant.userId != self.viewModel.mobileClient.localUser.userId {
menus.append(.removeFromStage)
}

if hostPermission.canPinParticipant {
if participant.isPinned == false {
menus.append(.pin)
Expand Down
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ let package = Package(
)
]
)

0 comments on commit 16d6623

Please sign in to comment.