Bot releases are hidden (Show)
Published by ariefnurputranto over 5 years ago
Published by ariefnurputranto over 5 years ago
Published by ariefnurputranto over 5 years ago
[Please use 0.3.4 for the bug fix crash]
Published by ariefnurputranto over 5 years ago
QiscusCore.shared.subcribeRooms(self.rooms)
QiscusCore.shared.unSubcribeRooms(self.rooms)
Published by ariefnurputranto over 5 years ago
QiscusCore.shared.subcribeRooms(self.rooms)
QiscusCore.shared.unSubcribeRooms(self.rooms)
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
Changelog :
example :
QiscusCore.shared.getUsers(limit: 20, page: page, querySearch: nil, onSuccess: { (contacts, metaData) in
if (metaData.currentPage != self.page){
self.page += 1
}
}) { (error) in
}
Changelog:
For Example :
var chatRoomDelegate : QiscusCoreRoomDelegate? = nil
// set delegate in viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
chatRoomDelegate = self
//getComment in room
// you can implementation this in viewDidLoad or viewWillAppear
QiscusCore.shared.getRoom(withID: _room.id, onSuccess: { [weak self] (room,comments) in
QiscusCore.shared.subscribeRooms(rooms: [room])
}) { [weak self] (error) in
//error
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//if you want to remove subscribe, you can call this method
QiscusCore.shared.unsubscribeRooms(rooms: [room])
}
// 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) {
//
}
}
*if you don't call method subscribeRoom(), realtime in chat room is not working, like updateRoom, message status (read & deliver), user online and user typing.
ChangeLog :
for example :
QiscusCore.shared.getRooms(withId: [String], showParticipant: Bool, showRemoved: Bool, onSuccess: { (rooms) in
print("success")
}) { (error) in
print("error")
}
QiscusCore.shared.getRooms(withUniqueId: [String], showParticipant: Bool, showRemoved: Bool, onSuccess: { (rooms) in
print("success")
}) { (error) in
print("error")
}
Published by asharijuang almost 6 years ago
Changelogs:
Published by asharijuang almost 6 years ago
Changelogs :