Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Maor360 committed Apr 19, 2017
1 parent 8618c44 commit b2282bc
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
4 changes: 0 additions & 4 deletions Chat/Chat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
E1CD50121E99043D006FB0CE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E1CD50101E99043D006FB0CE /* Main.storyboard */; };
E1CD50141E99043D006FB0CE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E1CD50131E99043D006FB0CE /* Assets.xcassets */; };
E1CD50171E99043D006FB0CE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E1CD50151E99043D006FB0CE /* LaunchScreen.storyboard */; };
E1CD50211E9907DF006FB0CE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E1CD50201E9907DF006FB0CE /* GoogleService-Info.plist */; };
E1E06EAA1E9B75A100D4C2B6 /* ChatVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1E06EA91E9B75A100D4C2B6 /* ChatVC.swift */; };
E1E06EAC1E9B860300D4C2B6 /* MSActionSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1E06EAB1E9B860300D4C2B6 /* MSActionSheet.swift */; };
E1EEE4301E9A268100BCCD6B /* SignInVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1EEE42F1E9A268100BCCD6B /* SignInVC.swift */; };
Expand All @@ -47,7 +46,6 @@
E1CD50131E99043D006FB0CE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
E1CD50161E99043D006FB0CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
E1CD50181E99043D006FB0CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E1CD50201E9907DF006FB0CE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
E1E06EA91E9B75A100D4C2B6 /* ChatVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatVC.swift; sourceTree = "<group>"; };
E1E06EAB1E9B860300D4C2B6 /* MSActionSheet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MSActionSheet.swift; sourceTree = "<group>"; };
E1EEE42F1E9A268100BCCD6B /* SignInVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignInVC.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -123,7 +121,6 @@
E1CD50131E99043D006FB0CE /* Assets.xcassets */,
E1CD50151E99043D006FB0CE /* LaunchScreen.storyboard */,
E1CD50181E99043D006FB0CE /* Info.plist */,
E1CD50201E9907DF006FB0CE /* GoogleService-Info.plist */,
);
name = Supporting;
sourceTree = "<group>";
Expand Down Expand Up @@ -222,7 +219,6 @@
buildActionMask = 2147483647;
files = (
E1CD50171E99043D006FB0CE /* LaunchScreen.storyboard in Resources */,
E1CD50211E9907DF006FB0CE /* GoogleService-Info.plist in Resources */,
E1CD50141E99043D006FB0CE /* Assets.xcassets in Resources */,
E1CD50121E99043D006FB0CE /* Main.storyboard in Resources */,
);
Expand Down
Binary file not shown.
8 changes: 1 addition & 7 deletions Chat/Chat/ChatVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ class ChatVC: JSQMessagesViewController, MessageReceivedDelegate {
return kJSQMessagesCollectionViewCellLabelHeightDefault;
}

fileprivate var fetchMoreCounter : Int = -1

// MARK : - Fetch / Load more messages
func loadMore(){
Expand All @@ -395,7 +394,7 @@ class ChatVC: JSQMessagesViewController, MessageReceivedDelegate {
return
}

MessagesManager.manager.fetchMore(of: receiver!, currentMessages : messages, fetchMoreCounter: fetchMoreCounter){ (history) in
MessagesManager.manager.fetchMore(of: receiver!, currentMessages : messages){ (history) in

//Check if nil
if history != nil && !(history?.isEmpty)! {
Expand Down Expand Up @@ -442,7 +441,6 @@ class ChatVC: JSQMessagesViewController, MessageReceivedDelegate {
self.collectionView.layoutIfNeeded()
self.collectionView.contentOffset = CGPoint(x: 0, y: self.collectionView.contentSize.height - oldBottomOffset)


// Stop spinner
self.refreshControl?.endRefreshing()
self.finishReceivingMessage()
Expand All @@ -454,9 +452,5 @@ class ChatVC: JSQMessagesViewController, MessageReceivedDelegate {
self.refreshControl?.endRefreshing()
}
}

self.fetchMoreCounter -= 1
}


}
3 changes: 1 addition & 2 deletions Chat/Chat/MessagesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,11 @@ class MessagesManager {
}

// MARK: - Fetch more messages (old messages)
func fetchMore(of friend : Contact,currentMessages : [MSMessage],fetchMoreCounter : Int, history completion : @escaping ((_ : [MSMessage]?) -> Void )){
func fetchMore(of friend : Contact,currentMessages : [MSMessage], history completion : @escaping ((_ : [MSMessage]?) -> Void )){

let currentUser = AuthManager.User.self
let firstMessage = currentMessages.first?.date ?? Date()


// listen for a single event, get the messages from yesterday until the first
// message in current device

Expand Down

0 comments on commit b2282bc

Please sign in to comment.