Skip to content

0.2.11

Compare
Choose a tag to compare
@ariefnurputranto ariefnurputranto released this 26 Feb 04:46
· 178 commits to master since this release

We change the mechanism again for subscribe, we hope it's can help user to easy use.
Just set QiscusCoreRoomDelegate for subscribe room, and set nil for unsubscribe

for example :

var chatRoomDelegate : QiscusCoreRoomDelegate? = nil

// set delegate in viewDidLoad or viewWillappear
override func viewDidLoad() {
        super.viewDidLoad()
        chatRoomDelegate = self
    }

override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        chatRoomDelegate = nil
    }

// MARK: Core Delegate
extension YourViewController : QiscusCoreRoomDelegate {
    func didDelete(Comment comment: CommentModel) {
       //
    }

    func onRoom(update room: RoomModel) {
        // 
    }

    func gotNewComment(comment: CommentModel) {
        // 2check comment already in ui?
    }

    func didComment(comment: CommentModel, changeStatus status: CommentStatus) {
        // check comment already exist in view
    }

    func onRoom(thisParticipant user: MemberModel, isTyping typing: Bool) {
       //
    }

    func onChangeUser(_ user: MemberModel, onlineStatus status: Bool, whenTime time: Date) {
        //
    }
}

and we add method for subscribe Typing in outside room,
for example subscribe typing :

for room in rooms {
  DispatchQueue.main.asyncAfter(deadline: .now()+1, execute: {
    QiscusCore.shared.subscribeTyping(roomID: room.id) { (roomTyping) in
       if let room = QiscusCore.database.room.find(id: roomTyping.roomID){
         //update you tableView cell
       }
    }
  })
}

for example unsubscribe typing :

 QiscusCore.shared.unsubscribeTyping(roomID: roomID)

note :
*We remove public method subscribeRoom, and unSubscribeRoom, please change it like example