codepath17-g7 / chatspot

1 stars 2 forks source link

Optimize message loading #9

Closed hakeemsyd closed 6 years ago

hakeemsyd commented 7 years ago
  1. maybe pagination when user opens a chat?
EdenShapiro commented 7 years ago

@hakeemsyd additionally: need a ChatSpotClient method to load older messages. a method where frontend can say “load messages older than this messageID” like we could do with twitter. twitter example for reference:

TwitterClient.sharedInstance.homeTimeline(maxID: tweets[tweets.count - 1].id!, success: { (tweets: [Tweet]) in 
  self.isMoreDataLoading = false self.tweets.append(contentsOf: tweets.dropFirst())
  self.tableView.reloadData() 
  self.loadingMoreView.stopAnimating() 
}, failure: { (error: Error) in 
    print("Could not find tweets: \(error.localizedDescription)") 
    KRProgressHUD.set(font: .systemFont(ofSize: 15)) 
    KRProgressHUD.showError(withMessage: "Unable to load tweets.") 
    self.isMoreDataLoading = false self.loadingMoreView.stopAnimating()
 }) 
hakeemsyd commented 7 years ago

Try out FUIDataSource from sample app given by google firebase