Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func recombineOutgoing(){
- outgoingUnreadedTotal = 0
- if sessionListModel.lastLoaded != nil && outgoingQuestionModel.lastLoaded != nil{
- var _tmpInactArray:[Any] = []
- var _tmpArray:[Any] = []
- for item in outgoingQuestionModel.content!.list!{
- // if item.active ?? false == true{
- _tmpArray.append(item)
- // }else{
- // _tmpInactArray.append(item)
- // }
- if item.unreadCount ?? 0 > 0{
- outgoingUnreadedTotal = outgoingUnreadedTotal + ( item.unreadCount ?? 0)
- }
- }
- for item in sessionListModel.content!.items!{
- if item.question == nil && item.direction! == .outgoing{
- if item.active ?? false == true{
- _tmpArray.append(item)
- }else{
- _tmpInactArray.append(item)
- }
- if item.unreadCount ?? 0 > 0{
- outgoingUnreadedTotal = outgoingUnreadedTotal + ( item.unreadCount ?? 0)
- }
- }
- }
- _tmpArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
- _tmpInactArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
- combinedOutgoingArray = _tmpArray
- combinedIncomingInactiveArray = _tmpInactArray
- }
- updateView()
- }
- func recombineIncoming(){
- //......fuck fuck fuck fuck
- incomingUnreadedTotal = 0
- if sessionListModel.lastLoaded != nil && incomingQuestionModel.lastLoaded != nil{
- var _tmpInactArray:[Any] = []
- var _tmpArray:[Any] = []
- for item in sessionListModel.content!.items!{
- if item.direction! == .incoming{
- if item.active ?? false == true{
- _tmpArray.append(item)
- }else{
- _tmpInactArray.append(item)
- }
- if item.unreadCount ?? 0 > 0{
- incomingUnreadedTotal = incomingUnreadedTotal + ( item.unreadCount ?? 0)
- }
- }
- }
- for item in incomingQuestionModel.content!.list!{
- var shouldSkipQuestion = false
- for sitem in sessionListModel.content!.items!{
- if sitem.direction! == .incoming && sitem.question?.id ?? 0 == item.id ?? 0{
- shouldSkipQuestion = true
- }
- }
- if shouldSkipQuestion == false{
- // if item.active ?? false == true{
- _tmpArray.append(item)
- // }else{
- // _tmpInactArray.append(item)
- // }
- if item.unreadCount ?? 0 > 0{
- incomingUnreadedTotal = incomingUnreadedTotal + ( item.unreadCount ?? 0)
- }
- if item.read == false && item.sender!.userID! != AppData.sharedInstance.authModel.user!.userID! {
- incomingUnreadedTotal = incomingUnreadedTotal + 1
- }
- }
- }
- _tmpArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
- _tmpInactArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
- combinedIncomingArray = _tmpArray
- combinedIncomingInactiveArray = _tmpInactArray
- }
- updateView()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement