From 872fa3260be60f6f349082472d7d805bda23a0ee Mon Sep 17 00:00:00 2001 From: Thilo Molitor Date: Sun, 8 Sep 2024 07:38:57 +0200 Subject: [PATCH] Implement isTyping property of MLContact --- Monal/Classes/MLContact.h | 1 + Monal/Classes/MLContact.m | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Monal/Classes/MLContact.h b/Monal/Classes/MLContact.h index 3a62a84e3..3078f16e1 100644 --- a/Monal/Classes/MLContact.h +++ b/Monal/Classes/MLContact.h @@ -72,6 +72,7 @@ FOUNDATION_EXPORT NSString* const kAskSubscribe; */ @property (nonatomic, copy) NSString* statusMessage; @property (nonatomic, readonly) NSDate* _Nullable lastInteractionTime; +@property (nonatomic, readonly) BOOL isTyping; /** used to display the badge on a row diff --git a/Monal/Classes/MLContact.m b/Monal/Classes/MLContact.m index db51e477f..9c7d2beca 100644 --- a/Monal/Classes/MLContact.m +++ b/Monal/Classes/MLContact.m @@ -51,6 +51,7 @@ @interface MLContact () @property (nonatomic, strong) NSSet* rosterGroups; @property (nonatomic, strong) NSDate* _Nullable lastInteractionTime; +@property (nonatomic, assign) BOOL isTyping; @property (nonatomic, assign) NSInteger unreadCount; @@ -286,9 +287,11 @@ -(void) handleLastInteractionTimeUpdate:(NSNotification*) notification if(![self.contactJid isEqualToString:data[@"jid"]] || self.accountID.intValue != notificationAccountID.intValue) return; // ignore other accounts or contacts - if(data[@"lastInteraction"] == nil) - return; // ignore typing notifications + self.isTyping = [data[@"isTyping"] boolValue]; + + if(data[@"lastInteraction"] == nil) + return; //this will be nil if "urn:xmpp:idle:1" is not supported by any of the contact's devices DDLogVerbose(@"Updating lastInteractionTime=%@ of %@", data[@"lastInteraction"], self); self.lastInteractionTime = nilExtractor(data[@"lastInteraction"]);