mirror of
				https://github.com/nerzhul/ocsms.git
				synced 2025-10-31 02:17:38 +00:00 
			
		
		
		
	Merge pull request #123 from DJaeger/master
Reset message count and only add new messages on refresh.
This commit is contained in:
		
						commit
						fda6f1a68c
					
				| @ -150,6 +150,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' | |||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			$scope.messages = []; | 			$scope.messages = []; | ||||||
|  | 			g_lastMsgDate = 0; | ||||||
| 
 | 
 | ||||||
| 			$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), {'phoneNumber': $scope.selectedContact.nav}, | 			$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), {'phoneNumber': $scope.selectedContact.nav}, | ||||||
| 				function(jsondata, status) { | 				function(jsondata, status) { | ||||||
| @ -437,12 +438,12 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' | |||||||
| 				// Note: we divide by 100 because number compare too large integers
 | 				// Note: we divide by 100 because number compare too large integers
 | ||||||
| 				if ((id/100) > (g_lastMsgDate/100)) { | 				if ((id/100) > (g_lastMsgDate/100)) { | ||||||
| 					g_lastMsgDate = id; | 					g_lastMsgDate = id; | ||||||
| 				} |  | ||||||
| 
 | 
 | ||||||
| 					// Multiplicate ID to permit date to use it properly
 | 					// Multiplicate ID to permit date to use it properly
 | ||||||
| 					$scope.addConversationMessage({'id': id, 'type': msgClass, 'date': new Date(id * 1), 'content': vals['msg']}); | 					$scope.addConversationMessage({'id': id, 'type': msgClass, 'date': new Date(id * 1), 'content': vals['msg']}); | ||||||
| 					buf = true; | 					buf = true; | ||||||
| 					msgCount++; | 					msgCount++; | ||||||
|  | 				} | ||||||
| 
 | 
 | ||||||
| 			}); | 			}); | ||||||
| 			return [msgCount,buf]; | 			return [msgCount,buf]; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user