@@ -36,6 +36,7 @@ class MockedData {
3636 var currentDate : NSDate ? = NSDate ( ) ;
3737 var msg01 = Message . createMessage ( " Hi Mary! " , sentDateTime: currentDate!, conversation: bffConversation, fromContact: nil , entity: " Message " , context: dataContext)
3838
39+ currentDate = MockedData . dateByAddingMinutes ( 1 , date: currentDate)
3940 var msg02 = Message . createMessage ( " How are you? " , sentDateTime: currentDate!, conversation: bffConversation, fromContact: nil , entity: " Message " , context: dataContext)
4041
4142 currentDate = MockedData . dateByAddingMinutes ( 1 , date: currentDate)
@@ -101,6 +102,7 @@ class MockedData {
101102 if let fetchResults = dataContext. executeFetchRequest ( fetchRequest, error: nil ) as? [ TelegramAccount ] {
102103
103104 let contacts = fetchResults [ 0 ] . contacts
105+ println ( " Contact list " )
104106 for contact in contacts! {
105107 if let eachContact = contact as? Contact {
106108 println ( " Contact Name: \( eachContact. name) . Phone Number: \( eachContact. phoneNumber) " )
@@ -117,12 +119,16 @@ class MockedData {
117119 var sortedMsgs : [ Message ] = msgsArray
118120 sortedMsgs. sort ( { $0. sentDateTime. timeIntervalSinceNow < $1. sentDateTime. timeIntervalSinceNow} )
119121
122+ let dateStringFormatter = NSDateFormatter ( )
123+ dateStringFormatter. dateFormat = " yyyy-MM-dd hh:mm "
124+
120125 for msg in sortedMsgs{
126+ let sentFormattedDate = dateStringFormatter. stringFromDate ( msg. sentDateTime)
121127 var messageDetails : String
122128 if let from = msg. fromContact{
123- messageDetails = " Message: \( msg. text) . From: \( msg. fromContact!. name) . Sent: \( msg . sentDateTime ) . "
129+ messageDetails = " Message: \( msg. text) . From: \( msg. fromContact!. name) . Sent: \( sentFormattedDate ) . "
124130 } else {
125- messageDetails = " Message: \( msg. text) . From: me. Sent: \( msg . sentDateTime ) . "
131+ messageDetails = " Message: \( msg. text) . From: me. Sent: \( sentFormattedDate ) . "
126132 }
127133 println ( messageDetails)
128134 }
0 commit comments