Commit 14b2b154 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

fix: update message status

This patch fix message sending indicator appearance

Change-Id: Ie58915b17a42ac95014e149fb08eff877f3ef1d8
parent 489bb893
......@@ -59,6 +59,9 @@ class MessageCell: UITableViewCell, NibReusable {
var disposeBag = DisposeBag()
override func prepareForReuse() {
if self.sendingIndicator != nil {
self.sendingIndicator.stopAnimating()
}
super.prepareForReuse()
self.stopProgressMonitor()
self.disposeBag = DisposeBag()
......
......@@ -69,26 +69,26 @@
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="h8N-aw-5lV" userLabel="Right Divider">
<rect key="frame" x="348" y="19.333333333333332" width="126" height="1"/>
<rect key="frame" x="348" y="63.333333333333329" width="126" height="1.0000000000000071"/>
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="3h1-r8-Nis"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2U4-l3-KET" userLabel="Left Divider">
<rect key="frame" x="36" y="19.333333333333332" width="126" height="1"/>
<rect key="frame" x="36" y="63.333333333333329" width="126" height="1.0000000000000071"/>
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="gla-pJ-IsN"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="11/14/2016 12:34PM" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ogn-wv-fZy" userLabel="Message Time">
<rect key="frame" x="178" y="9.3333333333333321" width="154" height="21"/>
<rect key="frame" x="178" y="53.333333333333329" width="154" height="21.000000000000007"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="78h-fZ-7yf" userLabel="Sending Indicator">
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="78h-fZ-7yf" userLabel="Sending Indicator">
<rect key="frame" x="258.66666666666669" y="15.333333333333336" width="20" height="20"/>
</activityIndicatorView>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Failed" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P5a-HI-uhr" userLabel="Failed Status Label">
......
......@@ -448,6 +448,7 @@ class ConversationViewController: UIViewController,
self.scrollToBottom(animated: false)
self.textFieldShouldEndEditing = false
self.messagesLoadingFinished()
self.viewModel.setMessagesAsRead()
}
override func viewWillDisappear(_ animated: Bool) {
......
......@@ -306,7 +306,8 @@ class ConversationViewModel: Stateable, ViewModel {
fileprivate var unreadMessagesCount: Int {
let unreadMessages = self.conversation.value.messages
.filter({ message in
return message.status != .read && !message.isTransfer && message.authorURI != ""
return message.status != .read &&
!message.isTransfer && message.incoming
})
return unreadMessages.count
}
......
......@@ -119,12 +119,9 @@ class MessageViewModel {
self.conversationsService
.sharedResponseStream
.filter({ messageUpdateEvent in
guard let accountId: String = messageUpdateEvent.getEventInput(.id) else { return false }
let account = self.accountService.getAccount(fromAccountId: accountId)
let accountHelper = AccountModelHelper(withAccount: account!)
return messageUpdateEvent.eventType == ServiceEventType.messageStateChanged &&
messageUpdateEvent.getEventInput(.messageId) == self.message.daemonId &&
accountHelper.uri == self.message.authorURI
!self.message.incoming
})
.subscribe(onNext: { [unowned self] messageUpdateEvent in
if let status: MessageStatus = messageUpdateEvent.getEventInput(.messageStatus) {
......
......@@ -33,7 +33,7 @@ class ChatTabBarItemViewModel: ViewModel, TabBarItemViewModel {
return conversations.map({ conversation in
let unreadMsg = conversation.messages.filter({ message in
//filtre out read messages, outgoing messages and messages that are displayed in contactrequest conversation
return message.status != .read && !message.isTransfer && message.authorURI != ""
return message.status != .read && !message.isTransfer && message.incoming
&& (contactsService.contactRequest(withRingId: JamiURI.init(schema: URIType.ring, infoHach: message.authorURI).hash ?? "") == nil)
})
return unreadMsg.count
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment