Skip to content

Commit

Permalink
Merge pull request #534 from matrix-org/riot_1911
Browse files Browse the repository at this point in the history
Replies: Implement sending
  • Loading branch information
manuroe committed Aug 7, 2018
2 parents cedbcc3 + 3d66c38 commit 7e5ff40
Show file tree
Hide file tree
Showing 18 changed files with 485 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Improvements:
* MXStore: Add Obj-C annotations.
* MXFileStore: Add a setting to set which data to preload ([MXFileStore setPreloadOptions:]).
* Manage the new summary API from the homeserver( MSC: https://docs.google.com/document/d/11i14UI1cUz-OJ0knD5BFu7fmT6Fo327zvMYqfSAR7xs/edit#).
* MXRoom: Add send reply with text message (vector-im/riot-ios#1911).
* Support room versioning (vector-im/riot-ios#1938).

Bug fix:
* MXRestClient: Fix filter parameter in messagesForRoom. It must be sent as an inline JSON string.
Expand Down
40 changes: 32 additions & 8 deletions MatrixSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
3233606F1A403A0D0071A488 /* MXFileStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 3233606D1A403A0D0071A488 /* MXFileStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
323360701A403A0D0071A488 /* MXFileStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 3233606E1A403A0D0071A488 /* MXFileStore.m */; };
323C5A081A70E53500FB0549 /* MXToolsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 323C5A071A70E53500FB0549 /* MXToolsTests.m */; };
323E0C571A2F6E7D00A31D73 /* MXRoomPowerLevels.h in Headers */ = {isa = PBXBuildFile; fileRef = 323E0C551A2F6E7D00A31D73 /* MXRoomPowerLevels.h */; settings = {ATTRIBUTES = (Public, ); }; };
323E0C581A2F6E7D00A31D73 /* MXRoomPowerLevels.m in Sources */ = {isa = PBXBuildFile; fileRef = 323E0C561A2F6E7D00A31D73 /* MXRoomPowerLevels.m */; };
323E0C5B1A306D7A00A31D73 /* MXEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 323E0C591A306D7A00A31D73 /* MXEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };
323E0C5C1A306D7A00A31D73 /* MXEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 323E0C5A1A306D7A00A31D73 /* MXEvent.m */; };
323EF7471C7CB4C7000DC98C /* MXEventTimelineTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 323EF7461C7CB4C7000DC98C /* MXEventTimelineTests.m */; };
Expand Down Expand Up @@ -225,6 +223,14 @@
B17285792100C8EA0052C51E /* MXSendReplyEventStringsLocalizable.h in Headers */ = {isa = PBXBuildFile; fileRef = B17285782100C88A0052C51E /* MXSendReplyEventStringsLocalizable.h */; settings = {ATTRIBUTES = (Public, ); }; };
B172857C2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.h in Headers */ = {isa = PBXBuildFile; fileRef = B172857A2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.h */; };
B172857D2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.m in Sources */ = {isa = PBXBuildFile; fileRef = B172857B2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.m */; };
B17982F52119E4A2001FD722 /* MXRoomCreateContent.h in Headers */ = {isa = PBXBuildFile; fileRef = B17982ED2119E49E001FD722 /* MXRoomCreateContent.h */; };
B17982F62119E4A2001FD722 /* MXRoomTombStoneContent.m in Sources */ = {isa = PBXBuildFile; fileRef = B17982EE2119E49F001FD722 /* MXRoomTombStoneContent.m */; };
B17982F72119E4A2001FD722 /* MXRoomPredecessorInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = B17982EF2119E49F001FD722 /* MXRoomPredecessorInfo.h */; };
B17982F82119E4A2001FD722 /* MXRoomPowerLevels.h in Headers */ = {isa = PBXBuildFile; fileRef = B17982F02119E4A0001FD722 /* MXRoomPowerLevels.h */; };
B17982F92119E4A2001FD722 /* MXRoomTombStoneContent.h in Headers */ = {isa = PBXBuildFile; fileRef = B17982F12119E4A0001FD722 /* MXRoomTombStoneContent.h */; };
B17982FA2119E4A2001FD722 /* MXRoomCreateContent.m in Sources */ = {isa = PBXBuildFile; fileRef = B17982F22119E4A1001FD722 /* MXRoomCreateContent.m */; };
B17982FB2119E4A2001FD722 /* MXRoomPredecessorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = B17982F32119E4A1001FD722 /* MXRoomPredecessorInfo.m */; };
B17982FC2119E4A2001FD722 /* MXRoomPowerLevels.m in Sources */ = {isa = PBXBuildFile; fileRef = B17982F42119E4A2001FD722 /* MXRoomPowerLevels.m */; };
C60165381E3AA57900B92CFA /* MXSDKOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = F0C34CB91C18C80000C36F09 /* MXSDKOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
C602B58C1F2268F700B67D87 /* MXRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = C602B58B1F2268F700B67D87 /* MXRoom.swift */; };
C602B58E1F22A8D700B67D87 /* MXImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C602B58D1F22A8D700B67D87 /* MXImage.swift */; };
Expand Down Expand Up @@ -331,8 +337,6 @@
3233606D1A403A0D0071A488 /* MXFileStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXFileStore.h; sourceTree = "<group>"; };
3233606E1A403A0D0071A488 /* MXFileStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXFileStore.m; sourceTree = "<group>"; };
323C5A071A70E53500FB0549 /* MXToolsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXToolsTests.m; sourceTree = "<group>"; };
323E0C551A2F6E7D00A31D73 /* MXRoomPowerLevels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXRoomPowerLevels.h; sourceTree = "<group>"; };
323E0C561A2F6E7D00A31D73 /* MXRoomPowerLevels.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXRoomPowerLevels.m; sourceTree = "<group>"; };
323E0C591A306D7A00A31D73 /* MXEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXEvent.h; sourceTree = "<group>"; };
323E0C5A1A306D7A00A31D73 /* MXEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXEvent.m; sourceTree = "<group>"; };
323EF7461C7CB4C7000DC98C /* MXEventTimelineTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXEventTimelineTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -512,6 +516,14 @@
B17285782100C88A0052C51E /* MXSendReplyEventStringsLocalizable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXSendReplyEventStringsLocalizable.h; sourceTree = "<group>"; };
B172857A2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXSendReplyEventDefaultStringLocalizations.h; sourceTree = "<group>"; };
B172857B2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXSendReplyEventDefaultStringLocalizations.m; sourceTree = "<group>"; };
B17982ED2119E49E001FD722 /* MXRoomCreateContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXRoomCreateContent.h; sourceTree = "<group>"; };
B17982EE2119E49F001FD722 /* MXRoomTombStoneContent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXRoomTombStoneContent.m; sourceTree = "<group>"; };
B17982EF2119E49F001FD722 /* MXRoomPredecessorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXRoomPredecessorInfo.h; sourceTree = "<group>"; };
B17982F02119E4A0001FD722 /* MXRoomPowerLevels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXRoomPowerLevels.h; sourceTree = "<group>"; };
B17982F12119E4A0001FD722 /* MXRoomTombStoneContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXRoomTombStoneContent.h; sourceTree = "<group>"; };
B17982F22119E4A1001FD722 /* MXRoomCreateContent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXRoomCreateContent.m; sourceTree = "<group>"; };
B17982F32119E4A1001FD722 /* MXRoomPredecessorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXRoomPredecessorInfo.m; sourceTree = "<group>"; };
B17982F42119E4A2001FD722 /* MXRoomPowerLevels.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXRoomPowerLevels.m; sourceTree = "<group>"; };
B1F1AE550CF4C15B653DDE6E /* Pods-MatrixSDKTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MatrixSDKTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MatrixSDKTests/Pods-MatrixSDKTests.debug.xcconfig"; sourceTree = "<group>"; };
C602B58B1F2268F700B67D87 /* MXRoom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXRoom.swift; sourceTree = "<group>"; };
C602B58D1F22A8D700B67D87 /* MXImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXImage.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -815,8 +827,14 @@
3281E8B619E42DFE00976E1A /* MXJSONModels.m */,
323E0C591A306D7A00A31D73 /* MXEvent.h */,
323E0C5A1A306D7A00A31D73 /* MXEvent.m */,
323E0C551A2F6E7D00A31D73 /* MXRoomPowerLevels.h */,
323E0C561A2F6E7D00A31D73 /* MXRoomPowerLevels.m */,
B17982F02119E4A0001FD722 /* MXRoomPowerLevels.h */,
B17982F42119E4A2001FD722 /* MXRoomPowerLevels.m */,
B17982F12119E4A0001FD722 /* MXRoomTombStoneContent.h */,
B17982EE2119E49F001FD722 /* MXRoomTombStoneContent.m */,
B17982ED2119E49E001FD722 /* MXRoomCreateContent.h */,
B17982F22119E4A1001FD722 /* MXRoomCreateContent.m */,
B17982EF2119E49F001FD722 /* MXRoomPredecessorInfo.h */,
B17982F32119E4A1001FD722 /* MXRoomPredecessorInfo.m */,
);
path = JSONModels;
sourceTree = "<group>";
Expand Down Expand Up @@ -1167,6 +1185,7 @@
32A1515B1DB525DA00400192 /* NSObject+sortedKeys.h in Headers */,
329D3E621E251027002E2F1E /* MXRoomSummaryUpdater.h in Headers */,
321B413F1E09937E009EEEC7 /* MXRoomSummary.h in Headers */,
B17982F52119E4A2001FD722 /* MXRoomCreateContent.h in Headers */,
32DC15CF1A8CF7AE006F9AD3 /* MXPushRuleConditionChecker.h in Headers */,
327187851DA7D0220071C818 /* MXOlmDecryption.h in Headers */,
32D7767D1A27860600FC4AA2 /* MXMemoryStore.h in Headers */,
Expand Down Expand Up @@ -1196,7 +1215,6 @@
320BBF3C1D6C7D9D0079890E /* MXEventsEnumerator.h in Headers */,
32637ED41E5B00400011E20D /* MXDeviceList.h in Headers */,
32F9FA7D1DBA0CF0009D98A6 /* MXDecryptionResult.h in Headers */,
323E0C571A2F6E7D00A31D73 /* MXRoomPowerLevels.h in Headers */,
3245A7501AF7B2930001D8A7 /* MXCall.h in Headers */,
3271877D1DA7CB2F0071C818 /* MXDecrypting.h in Headers */,
32114A851A262CE000FF2EC4 /* MXStore.h in Headers */,
Expand Down Expand Up @@ -1233,10 +1251,12 @@
320DFDE419DD99B60068622A /* MXRestClient.h in Headers */,
3265CB381A14C43E00E24B2F /* MXRoomState.h in Headers */,
3283F7781EAF30F700C1688C /* MXBugReportRestClient.h in Headers */,
B17982F82119E4A2001FD722 /* MXRoomPowerLevels.h in Headers */,
32DC15D41A8CF874006F9AD3 /* MXPushRuleEventMatchConditionChecker.h in Headers */,
32A151261DABB0CB00400192 /* MXMegolmDecryption.h in Headers */,
3220094519EFBF30008DE41D /* MXSessionEventListener.h in Headers */,
32A9E8241EF4026E0081358A /* MXBackgroundModeHandler.h in Headers */,
B17982F72119E4A2001FD722 /* MXRoomPredecessorInfo.h in Headers */,
32BED28F1B00A23F00E668FE /* MXCallStack.h in Headers */,
F03EF4FE1DF014D9009DF592 /* MXMediaLoader.h in Headers */,
3264DB911CEC528D00B99881 /* MXAccountData.h in Headers */,
Expand All @@ -1245,6 +1265,7 @@
329FB1751A0A3A1600A5E88E /* MXRoomMember.h in Headers */,
320DFDE019DD99B60068622A /* MXSession.h in Headers */,
324095221AFA432F00D81C97 /* MXCallStackCall.h in Headers */,
B17982F92119E4A2001FD722 /* MXRoomTombStoneContent.h in Headers */,
32A31BBE20D3F2EC005916C7 /* MXFilterObject.h in Headers */,
F082946D1DB66C3D00CEAB63 /* MXInvite3PID.h in Headers */,
3233606F1A403A0D0071A488 /* MXFileStore.h in Headers */,
Expand Down Expand Up @@ -1415,7 +1436,6 @@
322360531A8E610500A3CA81 /* MXPushRuleDisplayNameCondtionChecker.m in Sources */,
32A31BC520D3FFB0005916C7 /* MXFilter.m in Sources */,
32B76EA520FDE85100B095F6 /* MXRoomMembersCount.m in Sources */,
323E0C581A2F6E7D00A31D73 /* MXRoomPowerLevels.m in Sources */,
F03EF4FF1DF014D9009DF592 /* MXMediaLoader.m in Sources */,
32DC15D51A8CF874006F9AD3 /* MXPushRuleEventMatchConditionChecker.m in Sources */,
320BBF411D6C81550079890E /* MXEventsByTypesEnumeratorOnArray.m in Sources */,
Expand All @@ -1424,6 +1444,7 @@
32CAB1081A91EA34008C5BB9 /* MXPushRuleRoomMemberCountConditionChecker.m in Sources */,
3245A7511AF7B2930001D8A7 /* MXCall.m in Sources */,
327F8DB31C6112BA00581CA3 /* MXRoomThirdPartyInvite.m in Sources */,
B17982FC2119E4A2001FD722 /* MXRoomPowerLevels.m in Sources */,
32C235731F827F3800E38FC5 /* MXRoomOperation.m in Sources */,
322A51C41D9AC8FE00C8536D /* MXCryptoAlgorithms.m in Sources */,
329FB1761A0A3A1600A5E88E /* MXRoomMember.m in Sources */,
Expand Down Expand Up @@ -1486,6 +1507,7 @@
320DFDE719DD99B60068622A /* MXHTTPClient.m in Sources */,
32FE41371D0AB7070060835E /* MXEnumConstants.m in Sources */,
320DFDE119DD99B60068622A /* MXSession.m in Sources */,
B17982F62119E4A2001FD722 /* MXRoomTombStoneContent.m in Sources */,
C602B58E1F22A8D700B67D87 /* MXImage.swift in Sources */,
32A151491DAF7C0C00400192 /* MXKey.m in Sources */,
F0C34CBB1C18C93700C36F09 /* MXSDKOptions.m in Sources */,
Expand All @@ -1503,8 +1525,10 @@
32A1514F1DAF897600400192 /* MXOlmSessionResult.m in Sources */,
C6F9357C1E5B39CA00FC34BF /* MXRestClient.swift in Sources */,
322A51B71D9AB15900C8536D /* MXCrypto.m in Sources */,
B17982FB2119E4A2001FD722 /* MXRoomPredecessorInfo.m in Sources */,
32DC15D11A8CF7AE006F9AD3 /* MXNotificationCenter.m in Sources */,
32637ED51E5B00400011E20D /* MXDeviceList.m in Sources */,
B17982FA2119E4A2001FD722 /* MXRoomCreateContent.m in Sources */,
32A9E8261EF4026E0081358A /* MXUIKitBackgroundModeHandler.m in Sources */,
322A51C81D9BBD3C00C8536D /* MXOlmDevice.m in Sources */,
329FB17A1A0A74B100A5E88E /* MXTools.m in Sources */,
Expand Down
4 changes: 3 additions & 1 deletion MatrixSDK/Contrib/Swift/JSONModels/MXEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public enum MXEventType {
case callAnswer
case callHangup
case receipt
case roomTombStone

case custom(String)

Expand Down Expand Up @@ -88,6 +89,7 @@ public enum MXEventType {
case .callAnswer: return kMXEventTypeStringCallAnswer
case .callHangup: return kMXEventTypeStringCallHangup
case .receipt: return kMXEventTypeStringReceipt
case .roomTombStone: return kMXEventTypeStringRoomTombStone

// Swift converts any constant with the suffix "Notification" as the type `Notification.Name`
// The original value can be reached using the `rawValue` property.
Expand All @@ -98,7 +100,7 @@ public enum MXEventType {
}

public init(identifier: String) {
let events: [MXEventType] = [.roomName, .roomTopic, .roomAvatar, .roomMember, .roomCreate, .roomJoinRules, .roomPowerLevels, .roomAliases, .roomCanonicalAlias, .roomEncrypted, .roomEncryption, .roomGuestAccess, .roomHistoryVisibility, .roomKey, .roomForwardedKey, .roomKeyRequest, .roomMessage, .roomMessageFeedback, .roomRedaction, .roomThirdPartyInvite, .roomTag, .presence, .typing, .callInvite, .callCandidates, .callAnswer, .callHangup, .receipt]
let events: [MXEventType] = [.roomName, .roomTopic, .roomAvatar, .roomMember, .roomCreate, .roomJoinRules, .roomPowerLevels, .roomAliases, .roomCanonicalAlias, .roomEncrypted, .roomEncryption, .roomGuestAccess, .roomHistoryVisibility, .roomKey, .roomForwardedKey, .roomKeyRequest, .roomMessage, .roomMessageFeedback, .roomRedaction, .roomThirdPartyInvite, .roomTag, .presence, .typing, .callInvite, .callCandidates, .callAnswer, .callHangup, .receipt, .roomTombStone]
self = events.first(where: { $0.identifier == identifier }) ?? .custom(identifier)
}
}
Expand Down
34 changes: 34 additions & 0 deletions MatrixSDK/Data/MXRoom.h
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,40 @@ FOUNDATION_EXPORT NSString *const kMXRoomDidFlushDataNotification;
*/
- (void)removeAllListeners;

/**
Indicate if replying to the provided event is supported.
Only event of type 'MXEventTypeRoomMessage' are supported for the moment, and for certain msgtype.
@param eventToReply the event to reply to
@return YES if it is possible to reply to this event
*/
- (BOOL)canReplyToEvent:(MXEvent *)eventToReply;

/**
Send a reply to an event with text message to the room.
It's only supported to reply to event with 'm.room.message' event type and following message types: 'm.text', 'm.text', 'm.emote', 'm.notice', 'm.image', 'm.file', 'm.video', 'm.audio'.
@param eventToReply The event to reply.
@param textMessage the text to send.
@param formattedTextMessage the optional HTML formatted string of the text to send.
@param stringLocalizations string localizations used when building reply message.
@param localEcho a pointer to a MXEvent object (@see sendMessageWithContent: for details).
@param success A block object called when the operation succeeds. It returns
the event id of the event generated on the home server
@param failure A block object called when the operation fails.
@return a MXHTTPOperation instance.
*/
- (MXHTTPOperation*)sendReplyToEvent:(MXEvent*)eventToReply
withTextMessage:(NSString*)textMessage
formattedTextMessage:(NSString*)formattedTextMessage
stringLocalizations:(id<MXSendReplyEventStringsLocalizable>)stringLocalizations
localEcho:(MXEvent**)localEcho
success:(void (^)(NSString *eventId))success
failure:(void (^)(NSError *error))failure NS_REFINED_FOR_SWIFT;


#pragma mark - Events timeline
/**
Open a new `MXEventTimeline` instance around the passed event.
Expand Down
11 changes: 11 additions & 0 deletions MatrixSDK/Data/MXRoomState.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#import "MXEnumConstants.h"
#import "MXRoomMembersCount.h"
#import "MXStore.h"
#import "MXRoomTombStoneContent.h"
#import "MXRoomCreateContent.h"

@class MXSession;

Expand Down Expand Up @@ -150,6 +152,15 @@ Use MXRoomSummary.displayname to get a computed room display name.
*/
@property (nonatomic, readonly) NSString *encryptionAlgorithm;

/**
Indicate whether this room is obsolete (had a `m.room.tombstone` state event type).
*/
@property (nonatomic, readonly) BOOL isObsolete;

/**
If any the state event content for event type `m.room.tombstone`
*/
@property (nonatomic, strong, readonly) MXRoomTombStoneContent *tombStoneContent;

/**
Create a `MXRoomState` instance.
Expand Down
19 changes: 19 additions & 0 deletions MatrixSDK/Data/MXRoomState.m
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,25 @@ - (NSString *)encryptionAlgorithm
return stateEvents[kMXEventTypeStringRoomEncryption].lastObject.content[@"algorithm"];
}

- (BOOL)isObsolete
{
return self.tombStoneContent != nil;
}

- (MXRoomTombStoneContent*)tombStoneContent
{
MXRoomTombStoneContent *roomTombStoneContent = nil;

// Check it from the state events
MXEvent *event = stateEvents[kMXEventTypeStringRoomTombStone].lastObject;
NSDictionary *eventContent = [self contentOfEvent:event];
if (eventContent)
{
roomTombStoneContent = [MXRoomTombStoneContent modelFromJSON:eventContent];
}

return roomTombStoneContent;
}

#pragma mark - State events handling
- (void)handleStateEvents:(NSArray<MXEvent *> *)events;
Expand Down
5 changes: 5 additions & 0 deletions MatrixSDK/Data/MXRoomSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ FOUNDATION_EXPORT NSString *const kMXRoomSummaryDidChangeNotification;
*/
@property (nonatomic) BOOL isConferenceUserRoom;

/**
Indicate whether this room should be hidden from the user.
*/
@property (nonatomic) BOOL hiddenFromUser;

/**
Reset data related to room state.
Expand Down
4 changes: 4 additions & 0 deletions MatrixSDK/Data/MXRoomSummary.m
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder
_lastMessageString = lastMessageData[@"lastMessageString"];
_lastMessageAttributedString = lastMessageData[@"lastMessageAttributedString"];
_lastMessageOthers = lastMessageData[@"lastMessageOthers"];

_hiddenFromUser = [aDecoder decodeBoolForKey:@"hiddenFromUser"];
}
return self;
}
Expand Down Expand Up @@ -619,6 +621,8 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:lastMessageData forKey:@"lastMessageData"];
}

[aCoder encodeBool:_hiddenFromUser forKey:@"hiddenFromUser"];
}


Expand Down
Loading

0 comments on commit 7e5ff40

Please sign in to comment.