IOS-1446 Fix: crash at receiving new message.
authorMiguel Berrocal Go?mez <miguel@helm.cat>
Fri, 18 Jan 2019 16:45:51 +0100
changeset 75415d3d374bd3e0
parent 7540 8f510d2d414a
child 7542 07cdcf39cbc8
IOS-1446 Fix: crash at receiving new message.
pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift
     1.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Thu Jan 17 08:33:29 2019 +0100
     1.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Fri Jan 18 16:45:51 2019 +0100
     1.3 @@ -147,12 +147,12 @@
     1.4              let previewMessages = messagesToDisplay.map {
     1.5                  MessageViewModel(with: $0)
     1.6              }
     1.7 -            me.messages = SortedSet(array: previewMessages,
     1.8 -                                    sortBlock: me.sortByDateSentAscending)
     1.9 +            let sortedMessages = SortedSet(array: previewMessages, sortBlock: me.sortByDateSentAscending)
    1.10              if op.isCancelled {
    1.11                  return
    1.12              }
    1.13              DispatchQueue.main.sync {
    1.14 +                me.messages = sortedMessages
    1.15                  me.emailListViewModelDelegate?.updateView()
    1.16                  me.startListeningToChanges()
    1.17              }