From 48accce4d9b505b1c5313bd8f50257f1e9fa2154 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 13:10:20 +0300 Subject: [PATCH 1/8] Move models to dedicated files --- MatrixSDK.xcodeproj/project.pbxproj | 228 +++++++ MatrixSDK/JSONModels/MXJSONModels.h | 335 ----------- MatrixSDK/JSONModels/MXJSONModels.m | 556 ------------------ .../Sync/Group/MXGroupSyncProfile.h | 38 ++ .../Sync/Group/MXGroupSyncProfile.m | 43 ++ .../Sync/Group/MXGroupsSyncResponse.h | 45 ++ .../Sync/Group/MXGroupsSyncResponse.m | 69 +++ .../Sync/Group/MXInvitedGroupSync.h | 40 ++ .../Sync/Group/MXInvitedGroupSync.m | 44 ++ .../JSONModels/Sync/MXDeviceListResponse.h | 38 ++ .../JSONModels/Sync/MXDeviceListResponse.m | 42 ++ MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.h | 39 ++ MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.m | 42 ++ .../JSONModels/Sync/MXPresenceSyncResponse.h | 35 ++ .../JSONModels/Sync/MXPresenceSyncResponse.m | 47 ++ MatrixSDK/JSONModels/Sync/MXRoomInviteState.h | 35 ++ MatrixSDK/JSONModels/Sync/MXRoomInviteState.m | 47 ++ .../JSONModels/Sync/MXRoomsSyncResponse.h | 46 ++ .../JSONModels/Sync/MXRoomsSyncResponse.m | 84 +++ MatrixSDK/JSONModels/Sync/MXSyncResponse.h | 75 +++ MatrixSDK/JSONModels/Sync/MXSyncResponse.m | 61 ++ .../JSONModels/Sync/MXToDeviceSyncResponse.h | 35 ++ .../JSONModels/Sync/MXToDeviceSyncResponse.m | 47 ++ MatrixSDK/JSONModels/Sync/Room/MXRoomSync.h | 65 ++ MatrixSDK/JSONModels/Sync/Room/MXRoomSync.m | 57 ++ .../Sync/Room/MXRoomSyncAccountData.h | 35 ++ .../Sync/Room/MXRoomSyncAccountData.m | 47 ++ .../Sync/Room/MXRoomSyncEphemeral.h | 35 ++ .../Sync/Room/MXRoomSyncEphemeral.m | 47 ++ .../JSONModels/Sync/Room/MXRoomSyncState.h | 35 ++ .../JSONModels/Sync/Room/MXRoomSyncState.m | 47 ++ .../JSONModels/Sync/Room/MXRoomSyncSummary.h | 47 ++ .../JSONModels/Sync/Room/MXRoomSyncSummary.m | 60 ++ .../JSONModels/Sync/Room/MXRoomSyncTimeline.h | 45 ++ .../JSONModels/Sync/Room/MXRoomSyncTimeline.m | 51 ++ .../Sync/Room/MXRoomSyncUnreadNotifications.h | 38 ++ .../Sync/Room/MXRoomSyncUnreadNotifications.m | 42 ++ 37 files changed, 1831 insertions(+), 891 deletions(-) create mode 100644 MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h create mode 100644 MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.m create mode 100644 MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h create mode 100644 MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m create mode 100644 MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.h create mode 100644 MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.m create mode 100644 MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h create mode 100644 MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m create mode 100644 MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.h create mode 100644 MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.m create mode 100644 MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.h create mode 100644 MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.m create mode 100644 MatrixSDK/JSONModels/Sync/MXRoomInviteState.h create mode 100644 MatrixSDK/JSONModels/Sync/MXRoomInviteState.m create mode 100644 MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h create mode 100644 MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m create mode 100644 MatrixSDK/JSONModels/Sync/MXSyncResponse.h create mode 100644 MatrixSDK/JSONModels/Sync/MXSyncResponse.m create mode 100644 MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.h create mode 100644 MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.m create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSync.h create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSync.m create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.h create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.m create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.h create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.m create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.h create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.m create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.h create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.m create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.h create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.m create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.h create mode 100644 MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.m diff --git a/MatrixSDK.xcodeproj/project.pbxproj b/MatrixSDK.xcodeproj/project.pbxproj index 99e1a02ee3..26063ed36c 100644 --- a/MatrixSDK.xcodeproj/project.pbxproj +++ b/MatrixSDK.xcodeproj/project.pbxproj @@ -1284,6 +1284,74 @@ EC383BB72541C518002FBBE6 /* MXBackgroundPushRulesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC383BB52540E15E002FBBE6 /* MXBackgroundPushRulesManager.swift */; }; EC383BBF2542F1E3002FBBE6 /* MXBackgroundSyncServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC383BBD2542F141002FBBE6 /* MXBackgroundSyncServiceTests.swift */; }; EC383BC02542F1E4002FBBE6 /* MXBackgroundSyncServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC383BBD2542F141002FBBE6 /* MXBackgroundSyncServiceTests.swift */; }; + EC60ED5D265CFC2C00B39A4E /* MXSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED5B265CFC2C00B39A4E /* MXSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED5E265CFC2C00B39A4E /* MXSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED5B265CFC2C00B39A4E /* MXSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED5F265CFC2C00B39A4E /* MXSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED5C265CFC2C00B39A4E /* MXSyncResponse.m */; }; + EC60ED60265CFC2C00B39A4E /* MXSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED5C265CFC2C00B39A4E /* MXSyncResponse.m */; }; + EC60ED67265CFC7200B39A4E /* MXPresenceSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED65265CFC7200B39A4E /* MXPresenceSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED68265CFC7200B39A4E /* MXPresenceSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED65265CFC7200B39A4E /* MXPresenceSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED69265CFC7200B39A4E /* MXPresenceSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED66265CFC7200B39A4E /* MXPresenceSyncResponse.m */; }; + EC60ED6A265CFC7200B39A4E /* MXPresenceSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED66265CFC7200B39A4E /* MXPresenceSyncResponse.m */; }; + EC60ED71265CFCA500B39A4E /* MXToDeviceSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED6F265CFCA500B39A4E /* MXToDeviceSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED72265CFCA500B39A4E /* MXToDeviceSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED6F265CFCA500B39A4E /* MXToDeviceSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED73265CFCA500B39A4E /* MXToDeviceSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED70265CFCA500B39A4E /* MXToDeviceSyncResponse.m */; }; + EC60ED74265CFCA500B39A4E /* MXToDeviceSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED70265CFCA500B39A4E /* MXToDeviceSyncResponse.m */; }; + EC60ED7B265CFCD100B39A4E /* MXDeviceListResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED79265CFCD100B39A4E /* MXDeviceListResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED7C265CFCD100B39A4E /* MXDeviceListResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED79265CFCD100B39A4E /* MXDeviceListResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED7D265CFCD100B39A4E /* MXDeviceListResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED7A265CFCD100B39A4E /* MXDeviceListResponse.m */; }; + EC60ED7E265CFCD100B39A4E /* MXDeviceListResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED7A265CFCD100B39A4E /* MXDeviceListResponse.m */; }; + EC60ED85265CFD0700B39A4E /* MXRoomsSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED83265CFD0700B39A4E /* MXRoomsSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED86265CFD0700B39A4E /* MXRoomsSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED83265CFD0700B39A4E /* MXRoomsSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED87265CFD0700B39A4E /* MXRoomsSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED84265CFD0700B39A4E /* MXRoomsSyncResponse.m */; }; + EC60ED88265CFD0700B39A4E /* MXRoomsSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED84265CFD0700B39A4E /* MXRoomsSyncResponse.m */; }; + EC60ED8F265CFD3B00B39A4E /* MXRoomSync.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED8D265CFD3B00B39A4E /* MXRoomSync.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED90265CFD3B00B39A4E /* MXRoomSync.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED8D265CFD3B00B39A4E /* MXRoomSync.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED91265CFD3B00B39A4E /* MXRoomSync.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED8E265CFD3B00B39A4E /* MXRoomSync.m */; }; + EC60ED92265CFD3B00B39A4E /* MXRoomSync.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED8E265CFD3B00B39A4E /* MXRoomSync.m */; }; + EC60ED9A265CFE1700B39A4E /* MXRoomSyncState.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED98265CFE1700B39A4E /* MXRoomSyncState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED9B265CFE1700B39A4E /* MXRoomSyncState.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60ED98265CFE1700B39A4E /* MXRoomSyncState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60ED9C265CFE1700B39A4E /* MXRoomSyncState.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED99265CFE1700B39A4E /* MXRoomSyncState.m */; }; + EC60ED9D265CFE1700B39A4E /* MXRoomSyncState.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60ED99265CFE1700B39A4E /* MXRoomSyncState.m */; }; + EC60EDA8265CFE3B00B39A4E /* MXRoomSyncTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDA6265CFE3B00B39A4E /* MXRoomSyncTimeline.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDA9265CFE3B00B39A4E /* MXRoomSyncTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDA6265CFE3B00B39A4E /* MXRoomSyncTimeline.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDAA265CFE3B00B39A4E /* MXRoomSyncTimeline.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDA7265CFE3B00B39A4E /* MXRoomSyncTimeline.m */; }; + EC60EDAB265CFE3B00B39A4E /* MXRoomSyncTimeline.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDA7265CFE3B00B39A4E /* MXRoomSyncTimeline.m */; }; + EC60EDB2265CFE6200B39A4E /* MXRoomSyncEphemeral.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDB0265CFE6200B39A4E /* MXRoomSyncEphemeral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDB3265CFE6200B39A4E /* MXRoomSyncEphemeral.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDB0265CFE6200B39A4E /* MXRoomSyncEphemeral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDB4265CFE6200B39A4E /* MXRoomSyncEphemeral.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDB1265CFE6200B39A4E /* MXRoomSyncEphemeral.m */; }; + EC60EDB5265CFE6200B39A4E /* MXRoomSyncEphemeral.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDB1265CFE6200B39A4E /* MXRoomSyncEphemeral.m */; }; + EC60EDBC265CFE8600B39A4E /* MXRoomSyncAccountData.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDBA265CFE8600B39A4E /* MXRoomSyncAccountData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDBD265CFE8600B39A4E /* MXRoomSyncAccountData.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDBA265CFE8600B39A4E /* MXRoomSyncAccountData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDBE265CFE8600B39A4E /* MXRoomSyncAccountData.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDBB265CFE8600B39A4E /* MXRoomSyncAccountData.m */; }; + EC60EDBF265CFE8600B39A4E /* MXRoomSyncAccountData.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDBB265CFE8600B39A4E /* MXRoomSyncAccountData.m */; }; + EC60EDC6265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDC4265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDC7265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDC4265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDC8265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDC5265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m */; }; + EC60EDC9265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDC5265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m */; }; + EC60EDD0265CFECC00B39A4E /* MXRoomSyncSummary.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDCE265CFECC00B39A4E /* MXRoomSyncSummary.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDD1265CFECC00B39A4E /* MXRoomSyncSummary.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDCE265CFECC00B39A4E /* MXRoomSyncSummary.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDD2265CFECC00B39A4E /* MXRoomSyncSummary.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDCF265CFECC00B39A4E /* MXRoomSyncSummary.m */; }; + EC60EDD3265CFECC00B39A4E /* MXRoomSyncSummary.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDCF265CFECC00B39A4E /* MXRoomSyncSummary.m */; }; + EC60EDDA265CFF0600B39A4E /* MXInvitedRoomSync.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDD8265CFF0600B39A4E /* MXInvitedRoomSync.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDDB265CFF0600B39A4E /* MXInvitedRoomSync.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDD8265CFF0600B39A4E /* MXInvitedRoomSync.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDDC265CFF0600B39A4E /* MXInvitedRoomSync.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDD9265CFF0600B39A4E /* MXInvitedRoomSync.m */; }; + EC60EDDD265CFF0600B39A4E /* MXInvitedRoomSync.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDD9265CFF0600B39A4E /* MXInvitedRoomSync.m */; }; + EC60EDE8265CFF3100B39A4E /* MXRoomInviteState.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDE6265CFF3100B39A4E /* MXRoomInviteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDE9265CFF3100B39A4E /* MXRoomInviteState.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDE6265CFF3100B39A4E /* MXRoomInviteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDEA265CFF3100B39A4E /* MXRoomInviteState.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDE7265CFF3100B39A4E /* MXRoomInviteState.m */; }; + EC60EDEB265CFF3100B39A4E /* MXRoomInviteState.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDE7265CFF3100B39A4E /* MXRoomInviteState.m */; }; + EC60EDF2265CFFAC00B39A4E /* MXGroupsSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDF0265CFFAC00B39A4E /* MXGroupsSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDF3265CFFAC00B39A4E /* MXGroupsSyncResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDF0265CFFAC00B39A4E /* MXGroupsSyncResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDF4265CFFAC00B39A4E /* MXGroupsSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDF1265CFFAC00B39A4E /* MXGroupsSyncResponse.m */; }; + EC60EDF5265CFFAC00B39A4E /* MXGroupsSyncResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDF1265CFFAC00B39A4E /* MXGroupsSyncResponse.m */; }; + EC60EDFC265CFFD200B39A4E /* MXInvitedGroupSync.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDFA265CFFD200B39A4E /* MXInvitedGroupSync.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDFD265CFFD200B39A4E /* MXInvitedGroupSync.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EDFA265CFFD200B39A4E /* MXInvitedGroupSync.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EDFE265CFFD200B39A4E /* MXInvitedGroupSync.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDFB265CFFD200B39A4E /* MXInvitedGroupSync.m */; }; + EC60EDFF265CFFD200B39A4E /* MXInvitedGroupSync.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EDFB265CFFD200B39A4E /* MXInvitedGroupSync.m */; }; + EC60EE06265CFFF400B39A4E /* MXGroupSyncProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EE04265CFFF400B39A4E /* MXGroupSyncProfile.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EE07265CFFF400B39A4E /* MXGroupSyncProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = EC60EE04265CFFF400B39A4E /* MXGroupSyncProfile.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EC60EE08265CFFF400B39A4E /* MXGroupSyncProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EE05265CFFF400B39A4E /* MXGroupSyncProfile.m */; }; + EC60EE09265CFFF400B39A4E /* MXGroupSyncProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = EC60EE05265CFFF400B39A4E /* MXGroupSyncProfile.m */; }; EC619D9224DD834B00663A80 /* MXPushGatewayRestClient.m in Sources */ = {isa = PBXBuildFile; fileRef = EC619D9024DD834B00663A80 /* MXPushGatewayRestClient.m */; }; EC619D9324DD834B00663A80 /* MXPushGatewayRestClient.h in Headers */ = {isa = PBXBuildFile; fileRef = EC619D9124DD834B00663A80 /* MXPushGatewayRestClient.h */; settings = {ATTRIBUTES = (Public, ); }; }; EC8A538B25B1BC77004E0802 /* MXCallCandidate.h in Headers */ = {isa = PBXBuildFile; fileRef = EC8A536C25B1BC77004E0802 /* MXCallCandidate.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -2103,6 +2171,40 @@ EC383BB52540E15E002FBBE6 /* MXBackgroundPushRulesManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXBackgroundPushRulesManager.swift; sourceTree = ""; }; EC383BBD2542F141002FBBE6 /* MXBackgroundSyncServiceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXBackgroundSyncServiceTests.swift; sourceTree = ""; }; EC383BC12542F251002FBBE6 /* MatrixSDKTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MatrixSDKTests-Bridging-Header.h"; sourceTree = ""; }; + EC60ED5B265CFC2C00B39A4E /* MXSyncResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXSyncResponse.h; sourceTree = ""; }; + EC60ED5C265CFC2C00B39A4E /* MXSyncResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXSyncResponse.m; sourceTree = ""; }; + EC60ED65265CFC7200B39A4E /* MXPresenceSyncResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXPresenceSyncResponse.h; sourceTree = ""; }; + EC60ED66265CFC7200B39A4E /* MXPresenceSyncResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXPresenceSyncResponse.m; sourceTree = ""; }; + EC60ED6F265CFCA500B39A4E /* MXToDeviceSyncResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXToDeviceSyncResponse.h; sourceTree = ""; }; + EC60ED70265CFCA500B39A4E /* MXToDeviceSyncResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXToDeviceSyncResponse.m; sourceTree = ""; }; + EC60ED79265CFCD100B39A4E /* MXDeviceListResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXDeviceListResponse.h; sourceTree = ""; }; + EC60ED7A265CFCD100B39A4E /* MXDeviceListResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXDeviceListResponse.m; sourceTree = ""; }; + EC60ED83265CFD0700B39A4E /* MXRoomsSyncResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomsSyncResponse.h; sourceTree = ""; }; + EC60ED84265CFD0700B39A4E /* MXRoomsSyncResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomsSyncResponse.m; sourceTree = ""; }; + EC60ED8D265CFD3B00B39A4E /* MXRoomSync.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomSync.h; sourceTree = ""; }; + EC60ED8E265CFD3B00B39A4E /* MXRoomSync.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomSync.m; sourceTree = ""; }; + EC60ED98265CFE1700B39A4E /* MXRoomSyncState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomSyncState.h; sourceTree = ""; }; + EC60ED99265CFE1700B39A4E /* MXRoomSyncState.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomSyncState.m; sourceTree = ""; }; + EC60EDA6265CFE3B00B39A4E /* MXRoomSyncTimeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomSyncTimeline.h; sourceTree = ""; }; + EC60EDA7265CFE3B00B39A4E /* MXRoomSyncTimeline.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomSyncTimeline.m; sourceTree = ""; }; + EC60EDB0265CFE6200B39A4E /* MXRoomSyncEphemeral.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomSyncEphemeral.h; sourceTree = ""; }; + EC60EDB1265CFE6200B39A4E /* MXRoomSyncEphemeral.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomSyncEphemeral.m; sourceTree = ""; }; + EC60EDBA265CFE8600B39A4E /* MXRoomSyncAccountData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomSyncAccountData.h; sourceTree = ""; }; + EC60EDBB265CFE8600B39A4E /* MXRoomSyncAccountData.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomSyncAccountData.m; sourceTree = ""; }; + EC60EDC4265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomSyncUnreadNotifications.h; sourceTree = ""; }; + EC60EDC5265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomSyncUnreadNotifications.m; sourceTree = ""; }; + EC60EDCE265CFECC00B39A4E /* MXRoomSyncSummary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomSyncSummary.h; sourceTree = ""; }; + EC60EDCF265CFECC00B39A4E /* MXRoomSyncSummary.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomSyncSummary.m; sourceTree = ""; }; + EC60EDD8265CFF0600B39A4E /* MXInvitedRoomSync.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXInvitedRoomSync.h; sourceTree = ""; }; + EC60EDD9265CFF0600B39A4E /* MXInvitedRoomSync.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXInvitedRoomSync.m; sourceTree = ""; }; + EC60EDE6265CFF3100B39A4E /* MXRoomInviteState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomInviteState.h; sourceTree = ""; }; + EC60EDE7265CFF3100B39A4E /* MXRoomInviteState.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomInviteState.m; sourceTree = ""; }; + EC60EDF0265CFFAC00B39A4E /* MXGroupsSyncResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXGroupsSyncResponse.h; sourceTree = ""; }; + EC60EDF1265CFFAC00B39A4E /* MXGroupsSyncResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXGroupsSyncResponse.m; sourceTree = ""; }; + EC60EDFA265CFFD200B39A4E /* MXInvitedGroupSync.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXInvitedGroupSync.h; sourceTree = ""; }; + EC60EDFB265CFFD200B39A4E /* MXInvitedGroupSync.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXInvitedGroupSync.m; sourceTree = ""; }; + EC60EE04265CFFF400B39A4E /* MXGroupSyncProfile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXGroupSyncProfile.h; sourceTree = ""; }; + EC60EE05265CFFF400B39A4E /* MXGroupSyncProfile.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXGroupSyncProfile.m; sourceTree = ""; }; EC619D9024DD834B00663A80 /* MXPushGatewayRestClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXPushGatewayRestClient.m; sourceTree = ""; }; EC619D9124DD834B00663A80 /* MXPushGatewayRestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXPushGatewayRestClient.h; sourceTree = ""; }; EC8A536C25B1BC77004E0802 /* MXCallCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCallCandidate.h; sourceTree = ""; }; @@ -2877,6 +2979,7 @@ 3281E8B219E42DFE00976E1A /* JSONModels */ = { isa = PBXGroup; children = ( + EC60ED5A265CFBD000B39A4E /* Sync */, EC8A53CB25B1BCC6004E0802 /* ThirdParty */, EC8A536B25B1BC77004E0802 /* Call */, 327E9AE422859FE300A98BC1 /* Aggregations */, @@ -3697,6 +3800,63 @@ path = SyncResponseFileStore; sourceTree = ""; }; + EC60ED5A265CFBD000B39A4E /* Sync */ = { + isa = PBXGroup; + children = ( + EC60ED5B265CFC2C00B39A4E /* MXSyncResponse.h */, + EC60ED5C265CFC2C00B39A4E /* MXSyncResponse.m */, + EC60ED65265CFC7200B39A4E /* MXPresenceSyncResponse.h */, + EC60ED66265CFC7200B39A4E /* MXPresenceSyncResponse.m */, + EC60ED6F265CFCA500B39A4E /* MXToDeviceSyncResponse.h */, + EC60ED70265CFCA500B39A4E /* MXToDeviceSyncResponse.m */, + EC60ED79265CFCD100B39A4E /* MXDeviceListResponse.h */, + EC60ED7A265CFCD100B39A4E /* MXDeviceListResponse.m */, + EC60ED83265CFD0700B39A4E /* MXRoomsSyncResponse.h */, + EC60ED84265CFD0700B39A4E /* MXRoomsSyncResponse.m */, + EC60ED97265CFDFB00B39A4E /* Room */, + EC60EDD8265CFF0600B39A4E /* MXInvitedRoomSync.h */, + EC60EDD9265CFF0600B39A4E /* MXInvitedRoomSync.m */, + EC60EDE6265CFF3100B39A4E /* MXRoomInviteState.h */, + EC60EDE7265CFF3100B39A4E /* MXRoomInviteState.m */, + EC60EE0E265D001F00B39A4E /* Group */, + ); + path = Sync; + sourceTree = ""; + }; + EC60ED97265CFDFB00B39A4E /* Room */ = { + isa = PBXGroup; + children = ( + EC60ED8D265CFD3B00B39A4E /* MXRoomSync.h */, + EC60ED8E265CFD3B00B39A4E /* MXRoomSync.m */, + EC60ED98265CFE1700B39A4E /* MXRoomSyncState.h */, + EC60ED99265CFE1700B39A4E /* MXRoomSyncState.m */, + EC60EDA6265CFE3B00B39A4E /* MXRoomSyncTimeline.h */, + EC60EDA7265CFE3B00B39A4E /* MXRoomSyncTimeline.m */, + EC60EDB0265CFE6200B39A4E /* MXRoomSyncEphemeral.h */, + EC60EDB1265CFE6200B39A4E /* MXRoomSyncEphemeral.m */, + EC60EDBA265CFE8600B39A4E /* MXRoomSyncAccountData.h */, + EC60EDBB265CFE8600B39A4E /* MXRoomSyncAccountData.m */, + EC60EDC4265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h */, + EC60EDC5265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m */, + EC60EDCE265CFECC00B39A4E /* MXRoomSyncSummary.h */, + EC60EDCF265CFECC00B39A4E /* MXRoomSyncSummary.m */, + ); + path = Room; + sourceTree = ""; + }; + EC60EE0E265D001F00B39A4E /* Group */ = { + isa = PBXGroup; + children = ( + EC60EDF0265CFFAC00B39A4E /* MXGroupsSyncResponse.h */, + EC60EDF1265CFFAC00B39A4E /* MXGroupsSyncResponse.m */, + EC60EDFA265CFFD200B39A4E /* MXInvitedGroupSync.h */, + EC60EDFB265CFFD200B39A4E /* MXInvitedGroupSync.m */, + EC60EE04265CFFF400B39A4E /* MXGroupSyncProfile.h */, + EC60EE05265CFFF400B39A4E /* MXGroupSyncProfile.m */, + ); + path = Group; + sourceTree = ""; + }; EC619D8F24DD834B00663A80 /* PushGateway */ = { isa = PBXGroup; children = ( @@ -3860,6 +4020,7 @@ 3281E8B719E42DFE00976E1A /* MXJSONModel.h in Headers */, EC8A539325B1BC77004E0802 /* MXCallSessionDescription.h in Headers */, 327E9AF62289D53800A98BC1 /* MXReactionCount.h in Headers */, + EC60EDA8265CFE3B00B39A4E /* MXRoomSyncTimeline.h in Headers */, 320B393A239FD15E00BE2C06 /* MXKeyVerificationRequest.h in Headers */, B146D4AF21A5A04300D8C2C6 /* MXMediaScanStore.h in Headers */, 32A1514A1DAF7C0C00400192 /* MXUsersDevicesMap.h in Headers */, @@ -3912,6 +4073,7 @@ 320BBF3C1D6C7D9D0079890E /* MXEventsEnumerator.h in Headers */, 32637ED41E5B00400011E20D /* MXDeviceList.h in Headers */, 3245A7501AF7B2930001D8A7 /* MXCall.h in Headers */, + EC60ED7B265CFCD100B39A4E /* MXDeviceListResponse.h in Headers */, 02CAD43B217DD12F0074700B /* MXContentScanEncryptedBody.h in Headers */, EC8A53B125B1BC77004E0802 /* MXCallReplacesEventContent.h in Headers */, 32D2CC0423422462002BD8CA /* MX3PidAddManager.h in Headers */, @@ -3920,14 +4082,17 @@ 3271877D1DA7CB2F0071C818 /* MXDecrypting.h in Headers */, 8EC5110A256822B400EC4E5B /* MXTaggedEvents.h in Headers */, 32114A851A262CE000FF2EC4 /* MXStore.h in Headers */, + EC60ED67265CFC7200B39A4E /* MXPresenceSyncResponse.h in Headers */, 32BA86AF2152A79E008F277E /* MXRoomNameDefaultStringLocalizations.h in Headers */, 32A151391DAD292400400192 /* MXMegolmEncryption.h in Headers */, EC8A538B25B1BC77004E0802 /* MXCallCandidate.h in Headers */, F03EF5041DF01596009DF592 /* MXLRUCache.h in Headers */, EC8A539D25B1BC77004E0802 /* MXCallCandidatesEventContent.h in Headers */, + EC60EDC6265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h in Headers */, B172857C2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.h in Headers */, 329FB1791A0A74B100A5E88E /* MXTools.h in Headers */, 322691321E5EF77D00966A6E /* MXDeviceListOperation.h in Headers */, + EC60EE06265CFFF400B39A4E /* MXGroupSyncProfile.h in Headers */, 32481A841C03572900782AD3 /* MXRoomAccountData.h in Headers */, 327E9AE12285497100A98BC1 /* MXEventContentRelatesTo.h in Headers */, 32133025228BFA800070BA9B /* MXReactionCountChangeListener.h in Headers */, @@ -3935,6 +4100,7 @@ 32A9770421626E5C00919CC0 /* MXServerNotices.h in Headers */, 021AFBA42179E91900742B2C /* MXEncryptedContentFile.h in Headers */, B146D4F021A5AF7F00D8C2C6 /* MXRealmEventScanMapper.h in Headers */, + EC60EDDA265CFF0600B39A4E /* MXInvitedRoomSync.h in Headers */, B146D47F21A59E2400D8C2C6 /* MXEventScan.h in Headers */, B146D4E121A5AEF200D8C2C6 /* MXRealmMediaScanMapper.h in Headers */, 32C78B6C256CFC4D008130B1 /* MXCryptoMigration.h in Headers */, @@ -3944,7 +4110,9 @@ EC619D9324DD834B00663A80 /* MXPushGatewayRestClient.h in Headers */, 32C78B68256CFC4D008130B1 /* MXCryptoVersion.h in Headers */, 320B3934239FA56900BE2C06 /* MXKeyVerificationByDMRequest.h in Headers */, + EC60EDE8265CFF3100B39A4E /* MXRoomInviteState.h in Headers */, 324DD2A6246AE81300377005 /* MXSecretStorageKeyContent.h in Headers */, + EC60ED8F265CFD3B00B39A4E /* MXRoomSync.h in Headers */, EC8A53C325B1BC77004E0802 /* MXCallInviteEventContent.h in Headers */, 3281E8B919E42DFE00976E1A /* MXJSONModels.h in Headers */, 3A108AA225810FE5005EEBE9 /* MXRawDataKey.h in Headers */, @@ -3989,6 +4157,7 @@ 327A5F51239805F600ED6329 /* MXKeyVerificationKey.h in Headers */, 327E9ADC2284804500A98BC1 /* MXEventRelations.h in Headers */, C61A4CC41E5F38CB00442158 /* SwiftMatrixSDK.h in Headers */, + EC60EDB2265CFE6200B39A4E /* MXRoomSyncEphemeral.h in Headers */, EC8A53E825B1BCC6004E0802 /* MXThirdpartyProtocolsResponse.h in Headers */, 321CFDFF2254E8C4004D31DF /* MXEmojiRepresentation.h in Headers */, 324BE4681E3FADB1008D99D4 /* MXMegolmExportEncryption.h in Headers */, @@ -4000,11 +4169,15 @@ EC8A53B325B1BC77004E0802 /* MXUserModel.h in Headers */, 32F945F81FAB83D900622468 /* MXIncomingRoomKeyRequestCancellation.h in Headers */, 02CAD438217DD12F0074700B /* MXContentScanResult.h in Headers */, + EC60EDFC265CFFD200B39A4E /* MXInvitedGroupSync.h in Headers */, 323F879625554FF2009E9E67 /* MXTaskProfile_Private.h in Headers */, 32618E7B20EFA45B00E1D2EA /* MXRoomMembers.h in Headers */, 329E808C224E2E1B00A48C3A /* MXOutgoingSASTransaction.h in Headers */, B146D4D521A5A44E00D8C2C6 /* MXScanRealmProvider.h in Headers */, + EC60EDD0265CFECC00B39A4E /* MXRoomSyncSummary.h in Headers */, + EC60EDBC265CFE8600B39A4E /* MXRoomSyncAccountData.h in Headers */, 32CEEF4323AD2A6C0039BA98 /* MXCrossSigningKey.h in Headers */, + EC60ED71265CFCA500B39A4E /* MXToDeviceSyncResponse.h in Headers */, 327E9ABC2284521C00A98BC1 /* MXEventUnsignedData.h in Headers */, ECF29BDE264195320053E6D6 /* MXAssertedIdentityModel.h in Headers */, 3A108A9825810F62005EEBE9 /* MXAesKeyData.h in Headers */, @@ -4059,8 +4232,10 @@ 32133019228B010C0070BA9B /* MXRealmReactionCount.h in Headers */, 3275FD9821A6B53300B9C13D /* MXLoginPolicyData.h in Headers */, F082946D1DB66C3D00CEAB63 /* MXInvite3PID.h in Headers */, + EC60ED5D265CFC2C00B39A4E /* MXSyncResponse.h in Headers */, 32AF929724115D8B0008A0FD /* MXPendingSecretShareRequest.h in Headers */, 3233606F1A403A0D0071A488 /* MXFileStore.h in Headers */, + EC60ED85265CFD0700B39A4E /* MXRoomsSyncResponse.h in Headers */, B146D4F621A5BB9F00D8C2C6 /* MXRealmMediaScanStore.h in Headers */, 328BCB3321947BE200A976D3 /* MXKeyBackupVersionTrust.h in Headers */, 325AF3E124897D9400EF937D /* MXSecretRecoveryResult.h in Headers */, @@ -4086,6 +4261,7 @@ B1136962230AC9D900E2B2FA /* MXIdentityService.h in Headers */, B19A309C240424BD00FB6F35 /* MXQRCodeTransaction.h in Headers */, 9274AFE81EE580240009BEB6 /* MXCallKitAdapter.h in Headers */, + EC60EDF2265CFFAC00B39A4E /* MXGroupsSyncResponse.h in Headers */, 321CFDE622525A49004D31DF /* MXSASTransaction.h in Headers */, B19A30CE24042F0800FB6F35 /* MXSelfVerifyingMasterKeyTrustedQRCodeData.h in Headers */, 32DC15D01A8CF7AE006F9AD3 /* MXNotificationCenter.h in Headers */, @@ -4103,6 +4279,7 @@ B19A30AA2404257700FB6F35 /* MXQRCodeKeyVerificationStart.h in Headers */, 32F00ABB2488E1CD00131741 /* MXRecoveryService.h in Headers */, 3256E3811DCB91EB003C9718 /* MXCryptoConstants.h in Headers */, + EC60ED9A265CFE1700B39A4E /* MXRoomSyncState.h in Headers */, 320DFDE619DD99B60068622A /* MXHTTPClient.h in Headers */, 320A8840217F4E3F002EA952 /* MXMegolmBackupAuthData.h in Headers */, 32133021228BF7BC0070BA9B /* MXReactionCountChange.h in Headers */, @@ -4123,10 +4300,13 @@ B14EF3282397E90400758AF0 /* MXMegolmDecryption.h in Headers */, B14EF31E2397E90400758AF0 /* MXOlmDevice.h in Headers */, B14EF2DF2397E90400758AF0 /* MXDecryptionResult.h in Headers */, + EC60ED68265CFC7200B39A4E /* MXPresenceSyncResponse.h in Headers */, B14EF2C52397E90400758AF0 /* MXPushRuleDisplayNameCondtionChecker.h in Headers */, B14EF30E2397E90400758AF0 /* MXPushRuleRoomMemberCountConditionChecker.h in Headers */, B14EF3182397E90400758AF0 /* MXPushRuleSenderNotificationPermissionConditionChecker.h in Headers */, + EC60ED5E265CFC2C00B39A4E /* MXSyncResponse.h in Headers */, B14EF3272397E90400758AF0 /* MXPushRuleEventMatchConditionChecker.h in Headers */, + EC60EDA9265CFE3B00B39A4E /* MXRoomSyncTimeline.h in Headers */, B14EF2E32397E90400758AF0 /* MXDecrypting.h in Headers */, B14EF3062397E90400758AF0 /* MXEncrypting.h in Headers */, B14EF2972397E90400758AF0 /* MXCrypto.h in Headers */, @@ -4144,6 +4324,7 @@ B14EF29E2397E90400758AF0 /* MXMediaScanStoreDelegate.h in Headers */, B14EF29F2397E90400758AF0 /* MXAllowedCertificates.h in Headers */, B14EF2A02397E90400758AF0 /* MXRealmAggregationsMapper.h in Headers */, + EC60ED7C265CFCD100B39A4E /* MXDeviceListResponse.h in Headers */, B14EF2A12397E90400758AF0 /* NSObject+sortedKeys.h in Headers */, 32A9F8DF244720B10069C65B /* MXThrottler.h in Headers */, B14EF2A22397E90400758AF0 /* MXRoomSummaryUpdater.h in Headers */, @@ -4202,6 +4383,7 @@ B14EF2C42397E90400758AF0 /* MXRealmHelper.h in Headers */, B14EF2C62397E90400758AF0 /* MXReactionRelation.h in Headers */, B14EF2C72397E90400758AF0 /* MXMediaManager.h in Headers */, + EC60EDDB265CFF0600B39A4E /* MXInvitedRoomSync.h in Headers */, B14EF2C82397E90400758AF0 /* MXCallManager.h in Headers */, B14EF2C92397E90400758AF0 /* MXRealmReactionRelation.h in Headers */, B14EF2CA2397E90400758AF0 /* MXAnalyticsDelegate.h in Headers */, @@ -4225,6 +4407,7 @@ B19A30D524042F2700FB6F35 /* MXSelfVerifyingMasterKeyNotTrustedQRCodeData.h in Headers */, B1C854EF25E7B498005867D0 /* MXRoomType.h in Headers */, B124BBCD256453C90028996D /* MXMembershipTransitionState.h in Headers */, + EC60ED72265CFCA500B39A4E /* MXToDeviceSyncResponse.h in Headers */, B14EF2D72397E90400758AF0 /* MXAggregationsStore.h in Headers */, B14EF2D82397E90400758AF0 /* MXCredentials.h in Headers */, B14EF2D92397E90400758AF0 /* MXEncryptedContentKey.h in Headers */, @@ -4252,9 +4435,11 @@ ECD623FF25D3DCC900DC0A0B /* MXOlmDecryption.h in Headers */, B14EF2EB2397E90400758AF0 /* MXRoomAccountData.h in Headers */, B14EF2EC2397E90400758AF0 /* MXEventContentRelatesTo.h in Headers */, + EC60EDFD265CFFD200B39A4E /* MXInvitedGroupSync.h in Headers */, B19A30BF2404268600FB6F35 /* MXQRCodeData.h in Headers */, B14EF2ED2397E90400758AF0 /* MXReactionCountChangeListener.h in Headers */, B14EF2EE2397E90400758AF0 /* MXTransactionCancelCode.h in Headers */, + EC60EDB3265CFE6200B39A4E /* MXRoomSyncEphemeral.h in Headers */, B14EF2EF2397E90400758AF0 /* MXServerNotices.h in Headers */, 3A23A742256D322C00B9D00F /* MXAes.h in Headers */, B14EF2F02397E90400758AF0 /* MXEncryptedContentFile.h in Headers */, @@ -4286,6 +4471,7 @@ 325AF3E224897D9400EF937D /* MXSecretRecoveryResult.h in Headers */, B14EF3022397E90400758AF0 /* MXEncryptedAttachments.h in Headers */, B14EF3032397E90400758AF0 /* MXEventsByTypesEnumeratorOnArray.h in Headers */, + EC60ED90265CFD3B00B39A4E /* MXRoomSync.h in Headers */, B14EF3042397E90400758AF0 /* MXKeyVerificationTransaction.h in Headers */, B14EF3052397E90400758AF0 /* MXIdentityServerHashDetails.h in Headers */, 324AAC7D2399143400380A66 /* MXKeyVerificationAccept.h in Headers */, @@ -4297,6 +4483,7 @@ B14EF30C2397E90400758AF0 /* MXDeviceInfo.h in Headers */, 32B0E34023A378320054FF1A /* MXEventReference.h in Headers */, 324AAC802399143400380A66 /* MXKeyVerificationJSONModel.h in Headers */, + EC60ED9B265CFE1700B39A4E /* MXRoomSyncState.h in Headers */, B14EF30D2397E90400758AF0 /* MXEventRelations.h in Headers */, 32261B8B23C74A230018F1E2 /* MXDeviceTrustLevel.h in Headers */, 324DD2B7246C21C700377005 /* MXSecretStorageKeyCreationInfo.h in Headers */, @@ -4306,6 +4493,7 @@ B14EF3112397E90400758AF0 /* MXMegolmExportEncryption.h in Headers */, B14EF3122397E90400758AF0 /* MXIdentityServerRestClient.h in Headers */, B14EF3132397E90400758AF0 /* MXHTTPOperation.h in Headers */, + EC60EDC7265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.h in Headers */, B19A30AD2404257700FB6F35 /* MXSASKeyVerificationStart.h in Headers */, B14EF3142397E90400758AF0 /* MXLoginTerms.h in Headers */, B14EF3152397E90400758AF0 /* MXIncomingRoomKeyRequestCancellation.h in Headers */, @@ -4338,7 +4526,9 @@ B14EF3262397E90400758AF0 /* MXEventScanStoreDelegate.h in Headers */, B14EF3292397E90400758AF0 /* MXAutoDiscovery.h in Headers */, EC8A53D725B1BCC6004E0802 /* MXThirdPartyUserInstance.h in Headers */, + EC60EDD1265CFECC00B39A4E /* MXRoomSyncSummary.h in Headers */, B14EF32A2397E90400758AF0 /* MXSessionEventListener.h in Headers */, + EC60EDBD265CFE8600B39A4E /* MXRoomSyncAccountData.h in Headers */, B14EF32B2397E90400758AF0 /* MXBackgroundModeHandler.h in Headers */, B14EF32C2397E90400758AF0 /* MXRoomPredecessorInfo.h in Headers */, B14EF32D2397E90400758AF0 /* MXCallStack.h in Headers */, @@ -4348,6 +4538,7 @@ 3291DC8423DF52E20009732F /* MXRoomCreationParameters.h in Headers */, B14EF3312397E90400758AF0 /* MXPeekingRoom.h in Headers */, EC8A539425B1BC77004E0802 /* MXCallSessionDescription.h in Headers */, + EC60EDF3265CFFAC00B39A4E /* MXGroupsSyncResponse.h in Headers */, EC8A539A25B1BC77004E0802 /* MXCallNegotiateEventContent.h in Headers */, B14EF3322397E90400758AF0 /* MXRoomMember.h in Headers */, B14EF3332397E90400758AF0 /* MXSession.h in Headers */, @@ -4355,6 +4546,7 @@ B14EF3352397E90400758AF0 /* MXDiscoveredClientConfig.h in Headers */, B14EF3362397E90400758AF0 /* MXEventScanStore.h in Headers */, 3287165023C4C12200D720CA /* MXKeyVerificationManager_Private.h in Headers */, + EC60EE07265CFFF400B39A4E /* MXGroupSyncProfile.h in Headers */, 324AAC7E2399143400380A66 /* MXKeyVerificationCancel.h in Headers */, B14EF3372397E90400758AF0 /* MXRoomTombStoneContent.h in Headers */, 3274538B23FD918800438328 /* MXKeyVerificationByToDeviceRequest.h in Headers */, @@ -4383,10 +4575,12 @@ B19A30AB2404257700FB6F35 /* MXQRCodeKeyVerificationStart.h in Headers */, B14EF34A2397E90400758AF0 /* MXAntivirusScanStatusFormatter.h in Headers */, B14EF34B2397E90400758AF0 /* MXEventListener.h in Headers */, + EC60EDE9265CFF3100B39A4E /* MXRoomInviteState.h in Headers */, B14EF34C2397E90400758AF0 /* MXMediaScan.h in Headers */, B14EF34D2397E90400758AF0 /* MXRoomOperation.h in Headers */, B14EF34E2397E90400758AF0 /* MXReceiptData.h in Headers */, B14EF34F2397E90400758AF0 /* MXEventAnnotation.h in Headers */, + EC60ED86265CFD0700B39A4E /* MXRoomsSyncResponse.h in Headers */, B14EF3502397E90400758AF0 /* MXIdentityService.h in Headers */, B14EF3512397E90400758AF0 /* MXCallKitAdapter.h in Headers */, B14EF3522397E90400758AF0 /* MXSASTransaction.h in Headers */, @@ -4690,6 +4884,7 @@ files = ( 32A1513F1DAF768D00400192 /* MXOlmInboundGroupSession.m in Sources */, 3259CFE626026A6F00C365DB /* MXRestClient+Extensions.swift in Sources */, + EC60ED91265CFD3B00B39A4E /* MXRoomSync.m in Sources */, EC8A53A125B1BC77004E0802 /* MXCallSelectAnswerEventContent.m in Sources */, B14EECE72577F76100448735 /* MXLoginSSOFlow.m in Sources */, 32481A851C03572900782AD3 /* MXRoomAccountData.m in Sources */, @@ -4697,6 +4892,7 @@ 327A5F56239805F600ED6329 /* MXKeyVerificationCancel.m in Sources */, B146D4FB21A5BF7200D8C2C6 /* MXRealmEventScanStore.m in Sources */, B146D4D921A5A44E00D8C2C6 /* MXScanRealmFileProvider.m in Sources */, + EC60ED69265CFC7200B39A4E /* MXPresenceSyncResponse.m in Sources */, 3259D02326037A7200C365DB /* NSArray.swift in Sources */, B146D50321A5C6D700D8C2C6 /* MXScanManager.m in Sources */, F082946E1DB66C3D00CEAB63 /* MXInvite3PID.m in Sources */, @@ -4720,10 +4916,12 @@ 32DC15D51A8CF874006F9AD3 /* MXPushRuleEventMatchConditionChecker.m in Sources */, 32B94E06228EE90300716A26 /* MXRealmReactionRelation.m in Sources */, 320BBF411D6C81550079890E /* MXEventsByTypesEnumeratorOnArray.m in Sources */, + EC60ED87265CFD0700B39A4E /* MXRoomsSyncResponse.m in Sources */, 3213301E228B190F0070BA9B /* MXRealmAggregationsMapper.m in Sources */, 8EC511062568216B00EC4E5B /* MXTaggedEventInfo.m in Sources */, 32792BDD2296B90A00F4FC9D /* MXAggregatedEditsUpdater.m in Sources */, 3259CD541DF860C300186944 /* MXRealmCryptoStore.m in Sources */, + EC60EDAA265CFE3B00B39A4E /* MXRoomSyncTimeline.m in Sources */, EC8A53E225B1BCC6004E0802 /* MXThirdPartyUserInstance.m in Sources */, 321B41401E09937E009EEEC7 /* MXRoomSummary.m in Sources */, 32CAB1081A91EA34008C5BB9 /* MXPushRuleRoomMemberCountConditionChecker.m in Sources */, @@ -4740,6 +4938,7 @@ 322A51C41D9AC8FE00C8536D /* MXCryptoAlgorithms.m in Sources */, B1798D0824091A0100308A8F /* MXBase64Tools.m in Sources */, B182B08823167A640057972E /* MXIdentityServerHashDetails.m in Sources */, + EC60EDBE265CFE8600B39A4E /* MXRoomSyncAccountData.m in Sources */, 324DD2A2246AE1EF00377005 /* MXEncryptedSecretContent.m in Sources */, 329FB1761A0A3A1600A5E88E /* MXRoomMember.m in Sources */, 3251D41F25AF01D7001E6E77 /* MXUIKitApplicationStateService.swift in Sources */, @@ -4766,6 +4965,7 @@ 32C474C222AF7A2D00CFBCD2 /* MXReactionOperation.m in Sources */, 3256E3821DCB91EB003C9718 /* MXCryptoConstants.m in Sources */, EC8A53B525B1BC77004E0802 /* MXCallHangupEventContent.m in Sources */, + EC60EDB4265CFE6200B39A4E /* MXRoomSyncEphemeral.m in Sources */, B18D18C22152B8E4003677D1 /* MXRoomMember.swift in Sources */, 32BBAE6F2178E99100D85F46 /* MXKeyBackupVersion.m in Sources */, 326056861C76FDF2009D44AD /* MXEventTimeline.m in Sources */, @@ -4774,10 +4974,12 @@ 327E9ABD2284521C00A98BC1 /* MXEventUnsignedData.m in Sources */, 32AF9286240EA2430008A0FD /* MXSecretShareRequest.m in Sources */, 32A1513A1DAD292400400192 /* MXMegolmEncryption.m in Sources */, + EC60EDFE265CFFD200B39A4E /* MXInvitedGroupSync.m in Sources */, 8EC5110C256822B400EC4E5B /* MXTaggedEvents.m in Sources */, 32F945F71FAB83D900622468 /* MXIncomingRoomKeyRequest.m in Sources */, 32D2CC09234336D6002BD8CA /* MX3PidAddManager.swift in Sources */, F0173EAD1FCF0E8900B5F6A3 /* MXGroup.m in Sources */, + EC60EDDC265CFF0600B39A4E /* MXInvitedRoomSync.m in Sources */, 32CEEF5123B0AB030039BA98 /* MXCrossSigning.m in Sources */, 32720D9F222EAA6F0086FFF5 /* MXAutoDiscovery.m in Sources */, 3297912923A93D4B00F7BB9B /* MXKeyVerification.m in Sources */, @@ -4799,6 +5001,7 @@ 32549AF723F2E2790002576B /* MXKeyVerificationReady.m in Sources */, B11BD45522CB583E0064D8B0 /* MXReplyEventBodyParts.m in Sources */, EC8A53A325B1BC77004E0802 /* MXCallEventContent.m in Sources */, + EC60EDEA265CFF3100B39A4E /* MXRoomInviteState.m in Sources */, 32F945F51FAB83D900622468 /* MXIncomingRoomKeyRequestCancellation.m in Sources */, 32D776821A27877300FC4AA2 /* MXMemoryRoomStore.m in Sources */, EC8A53BF25B1BC77004E0802 /* MXCallRejectReplacementEventContent.m in Sources */, @@ -4817,6 +5020,7 @@ 320DFDE319DD99B60068622A /* MXError.m in Sources */, 327C3E4D23A39D91006183D1 /* MXAggregatedReferencesUpdater.m in Sources */, 325380E9228DAD4A00ADDEFA /* MXAggregatedReactions.m in Sources */, + EC60EDD2265CFECC00B39A4E /* MXRoomSyncSummary.m in Sources */, 021AFBA52179E91900742B2C /* MXEncryptedContentKey.m in Sources */, 32F634AC1FC5E3480054EF49 /* MXEventDecryptionResult.m in Sources */, 327137281A24D50A00DB6757 /* MXMyUser.m in Sources */, @@ -4849,6 +5053,7 @@ B1798304211B3649001FD722 /* MXRoomSummary.swift in Sources */, 9274AFE91EE580240009BEB6 /* MXCallKitAdapter.m in Sources */, 3274538C23FD918800438328 /* MXKeyVerificationByToDeviceRequest.m in Sources */, + EC60EE08265CFFF400B39A4E /* MXGroupSyncProfile.m in Sources */, B19A30A0240424BD00FB6F35 /* MXQRCodeTransaction.m in Sources */, C63E78B01F26588000AC692F /* MXRoomPowerLevels.swift in Sources */, EC383BA5253DE6C9002FBBE6 /* MXSyncResponseStore.swift in Sources */, @@ -4884,12 +5089,14 @@ 325AF3E324897D9400EF937D /* MXSecretRecoveryResult.m in Sources */, F03EF5091DF071D5009DF592 /* MXEncryptedAttachments.m in Sources */, 324DD2C1246D658500377005 /* MXHkdfSha256.m in Sources */, + EC60ED73265CFCA500B39A4E /* MXToDeviceSyncResponse.m in Sources */, 3274538623FD69D600438328 /* MXKeyVerificationRequestByToDeviceJSONModel.m in Sources */, 324DD2C7246E638B00377005 /* MXAesHmacSha2.m in Sources */, B172857D2100D4F60052C51E /* MXSendReplyEventDefaultStringLocalizations.m in Sources */, 321CFDEF225264C4004D31DF /* NSArray+MatrixSDK.m in Sources */, 327A5F52239805F600ED6329 /* MXKeyVerificationStart.m in Sources */, 3294FD9D22F321B0007F1E60 /* MXServiceTermsRestClient.m in Sources */, + EC60ED7D265CFCD100B39A4E /* MXDeviceListResponse.m in Sources */, 3A23A73F256D322C00B9D00F /* MXAes.m in Sources */, 323547DD2226FC5700F15F94 /* MXCredentials.m in Sources */, 32FA10CF1FA1C9F700E54233 /* MXOutgoingRoomKeyRequest.m in Sources */, @@ -4909,6 +5116,7 @@ 32A31BBF20D3F2EC005916C7 /* MXFilterObject.m in Sources */, 320DFDE719DD99B60068622A /* MXHTTPClient.m in Sources */, 32FE41371D0AB7070060835E /* MXEnumConstants.m in Sources */, + EC60EDF4265CFFAC00B39A4E /* MXGroupsSyncResponse.m in Sources */, 320DFDE119DD99B60068622A /* MXSession.m in Sources */, B17982F62119E4A2001FD722 /* MXRoomTombStoneContent.m in Sources */, C602B58E1F22A8D700B67D87 /* MXImage.swift in Sources */, @@ -4917,6 +5125,7 @@ 3295401A216385F100E300FC /* MXServerNoticeContent.m in Sources */, B19A30A82404257700FB6F35 /* MXSASKeyVerificationStart.m in Sources */, 02CAD439217DD12F0074700B /* MXContentScanResult.m in Sources */, + EC60ED9C265CFE1700B39A4E /* MXRoomSyncState.m in Sources */, 32133016228AF4EF0070BA9B /* MXRealmAggregationsStore.m in Sources */, B19A30A62404257700FB6F35 /* MXQRCodeKeyVerificationStart.m in Sources */, B146D47B21A5958400D8C2C6 /* MXAntivirusScanStatusFormatter.m in Sources */, @@ -4935,6 +5144,7 @@ 323F8865212D4E480001C73C /* MXMatrixVersions.m in Sources */, 32133026228BFA800070BA9B /* MXReactionCountChangeListener.m in Sources */, 320A883D217F4E35002EA952 /* MXMegolmBackupCreationInfo.m in Sources */, + EC60EDC8265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m in Sources */, 320DFDDC19DD99B60068622A /* MXRoom.m in Sources */, EC8A538D25B1BC77004E0802 /* MXCallSessionDescription.m in Sources */, F08B8D5D1E014711006171A8 /* NSData+MatrixSDK.m in Sources */, @@ -4980,6 +5190,7 @@ B146D4F721A5BB9F00D8C2C6 /* MXRealmMediaScanStore.m in Sources */, 32999DE422DCD1AD004FF987 /* MXPusherData.m in Sources */, 322A51C81D9BBD3C00C8536D /* MXOlmDevice.m in Sources */, + EC60ED5F265CFC2C00B39A4E /* MXSyncResponse.m in Sources */, EC383BA2253DE4B1002FBBE6 /* MXBackgroundSyncService.swift in Sources */, 32442FB221EDD21300D2411B /* MXKeyBackupPassword.m in Sources */, 3A108A9A25810F62005EEBE9 /* MXAesKeyData.m in Sources */, @@ -5111,8 +5322,10 @@ B14EF1E22397E90400758AF0 /* MXPushRuleRoomMemberCountConditionChecker.m in Sources */, B14EF1E32397E90400758AF0 /* MXCall.m in Sources */, B14EF1E42397E90400758AF0 /* MXWellknownIntegrations.m in Sources */, + EC60EDF5265CFFAC00B39A4E /* MXGroupsSyncResponse.m in Sources */, B14EF1E52397E90400758AF0 /* MXLoginPolicy.m in Sources */, B14EF1E62397E90400758AF0 /* (null) in Sources */, + EC60EDB5265CFE6200B39A4E /* MXRoomSyncEphemeral.m in Sources */, B14EF1E72397E90400758AF0 /* MXRoomThirdPartyInvite.m in Sources */, B14EF1E82397E90400758AF0 /* MXRoomPowerLevels.m in Sources */, 32EEA85E260401490041425B /* MXSummable.swift in Sources */, @@ -5188,6 +5401,7 @@ B14EF2112397E90400758AF0 /* MXIncomingRoomKeyRequestCancellation.m in Sources */, B14EF2122397E90400758AF0 /* MXMemoryRoomStore.m in Sources */, B14EF2132397E90400758AF0 /* MXUIKitBackgroundTask.m in Sources */, + EC60EDFF265CFFD200B39A4E /* MXInvitedGroupSync.m in Sources */, B14EF2142397E90400758AF0 /* MXPeekingRoomSummary.m in Sources */, B14EF2152397E90400758AF0 /* MXRoom.swift in Sources */, B14EF2162397E90400758AF0 /* MXOlmSession.m in Sources */, @@ -5203,10 +5417,12 @@ B14EF21C2397E90400758AF0 /* MXAggregatedReactions.m in Sources */, B14EF21D2397E90400758AF0 /* MXEncryptedContentKey.m in Sources */, B14EF21E2397E90400758AF0 /* MXEventDecryptionResult.m in Sources */, + EC60EDBF265CFE8600B39A4E /* MXRoomSyncAccountData.m in Sources */, 320B393D239FD15E00BE2C06 /* MXKeyVerificationRequest.m in Sources */, EC05473725FF8A3C0047ECD7 /* MXVirtualRoomInfo.m in Sources */, 3290293524CB10D000DA7BB6 /* MatrixSDKVersion.m in Sources */, B14EF21F2397E90400758AF0 /* MXMyUser.m in Sources */, + EC60EDAB265CFE3B00B39A4E /* MXRoomSyncTimeline.m in Sources */, B14EF2202397E90400758AF0 /* (null) in Sources */, B14EF2212397E90400758AF0 /* MX3PID.swift in Sources */, EC383BB325406892002FBBE6 /* MXSyncResponseStore.swift in Sources */, @@ -5216,9 +5432,11 @@ B14EF2252397E90400758AF0 /* MXOutgoingSASTransaction.m in Sources */, B14EF2262397E90400758AF0 /* MXOlmEncryption.m in Sources */, 324AAC782399140D00380A66 /* MXKeyVerificationJSONModel.m in Sources */, + EC60ED74265CFCA500B39A4E /* MXToDeviceSyncResponse.m in Sources */, B14EF2272397E90400758AF0 /* MXOlmDecryption.m in Sources */, B14EF2282397E90400758AF0 /* MXNoStore.m in Sources */, ECF29BD4264194BB0053E6D6 /* MXCallAssertedIdentityEventContent.m in Sources */, + EC60EDDD265CFF0600B39A4E /* MXInvitedRoomSync.m in Sources */, B14EF2292397E90400758AF0 /* MXRealmEventScanMapper.m in Sources */, B14EF22A2397E90400758AF0 /* MXReplyEventFormattedBodyParts.m in Sources */, 324AAC7A2399140D00380A66 /* MXKeyVerificationMac.m in Sources */, @@ -5291,6 +5509,7 @@ EC383BB425406894002FBBE6 /* MXSyncResponseFileStore.swift in Sources */, B14EF2572397E90400758AF0 /* MXMegolmExportEncryption.m in Sources */, B14EF2582397E90400758AF0 /* MXFilterObject.m in Sources */, + EC60EDEB265CFF3100B39A4E /* MXRoomInviteState.m in Sources */, 8EC511072568216B00EC4E5B /* MXTaggedEventInfo.m in Sources */, B14EF2592397E90400758AF0 /* MXHTTPClient.m in Sources */, 3251D42025AF01D7001E6E77 /* MXUIKitApplicationStateService.swift in Sources */, @@ -5328,9 +5547,12 @@ B14EF26D2397E90400758AF0 /* NSData+MatrixSDK.m in Sources */, EC383BB22540688E002FBBE6 /* MXBackgroundStore.swift in Sources */, B14EF26E2397E90400758AF0 /* MXFileRoomStore.m in Sources */, + EC60ED9D265CFE1700B39A4E /* MXRoomSyncState.m in Sources */, 324676ED25C15F4600EA855B /* MXMemory.swift in Sources */, + EC60ED6A265CFC7200B39A4E /* MXPresenceSyncResponse.m in Sources */, 3A108AA525810FE5005EEBE9 /* MXRawDataKey.m in Sources */, 324DD29C246AD2B500377005 /* MXSecretStorage.m in Sources */, + EC60EDC9265CFEA800B39A4E /* MXRoomSyncUnreadNotifications.m in Sources */, B14EF26F2397E90400758AF0 /* MXUser.m in Sources */, 324AAC772399140D00380A66 /* MXKeyVerificationDone.m in Sources */, B14EF2702397E90400758AF0 /* MXIdentityServerRestClient.swift in Sources */, @@ -5338,6 +5560,7 @@ B14EF2722397E90400758AF0 /* MXDiscoveredClientConfig.m in Sources */, B19A30A1240424BD00FB6F35 /* MXQRCodeTransaction.m in Sources */, B14EF2732397E90400758AF0 /* MXRealmEventScan.m in Sources */, + EC60ED88265CFD0700B39A4E /* MXRoomsSyncResponse.m in Sources */, B14EF2742397E90400758AF0 /* MXDeviceListOperationsPool.m in Sources */, B14EF2752397E90400758AF0 /* MXResponse.swift in Sources */, B14EF2762397E90400758AF0 /* MXRoomNameDefaultStringLocalizations.m in Sources */, @@ -5355,11 +5578,13 @@ B14EF2802397E90400758AF0 /* MXServiceTerms.m in Sources */, 3229535425A5F7220012FCF0 /* MXBackgroundCryptoStore.m in Sources */, B14EF2812397E90400758AF0 /* MXNotificationCenter.m in Sources */, + EC60ED60265CFC2C00B39A4E /* MXSyncResponse.m in Sources */, 3A108AB825812995005EEBE9 /* MXKeyProvider.m in Sources */, B14EF2822397E90400758AF0 /* MXDeviceList.m in Sources */, 320B3937239FA56900BE2C06 /* MXKeyVerificationByDMRequest.m in Sources */, B14EF2832397E90400758AF0 /* MXRoomCreateContent.m in Sources */, EC8A53B025B1BC77004E0802 /* MXCallAnswerEventContent.m in Sources */, + EC60ED7E265CFCD100B39A4E /* MXDeviceListResponse.m in Sources */, 323F879025553D84009E9E67 /* MXTaskProfile.m in Sources */, B14EF2842397E90400758AF0 /* MXUIKitBackgroundModeHandler.m in Sources */, B14EF2852397E90400758AF0 /* (null) in Sources */, @@ -5379,10 +5604,12 @@ B14EF28A2397E90400758AF0 /* MXTools.m in Sources */, B14EF28B2397E90400758AF0 /* MXRoomSummaryUpdater.m in Sources */, B14EF28C2397E90400758AF0 /* MXScanRealmInMemoryProvider.m in Sources */, + EC60ED92265CFD3B00B39A4E /* MXRoomSync.m in Sources */, B14EF28D2397E90400758AF0 /* MXMegolmSessionData.m in Sources */, 3259D02626037A7200C365DB /* NSDictionary.swift in Sources */, EC8A53BE25B1BC77004E0802 /* MXCallRejectEventContent.m in Sources */, B14EF28E2397E90400758AF0 /* MXKeyVerificationTransaction.m in Sources */, + EC60EE09265CFFF400B39A4E /* MXGroupSyncProfile.m in Sources */, B14EF28F2397E90400758AF0 /* MXEventTimeline.swift in Sources */, B14EF2902397E90400758AF0 /* MXJSONModels.swift in Sources */, 325AF3E424897D9400EF937D /* MXSecretRecoveryResult.m in Sources */, @@ -5390,6 +5617,7 @@ B14EF2912397E90400758AF0 /* MXOutgoingRoomKeyRequestManager.m in Sources */, B14EF2922397E90400758AF0 /* MXWellKnown.m in Sources */, B14EF2932397E90400758AF0 /* MXRestClient.m in Sources */, + EC60EDD3265CFECC00B39A4E /* MXRoomSyncSummary.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MatrixSDK/JSONModels/MXJSONModels.h b/MatrixSDK/JSONModels/MXJSONModels.h index 5c10ea8c49..a87d0c6928 100644 --- a/MatrixSDK/JSONModels/MXJSONModels.h +++ b/MatrixSDK/JSONModels/MXJSONModels.h @@ -1050,341 +1050,6 @@ FOUNDATION_EXPORT NSString *const kMXPushRuleScopeStringDevice; @end -/** - `MXRoomSyncState` represents the state updates for a room during server sync. - */ -@interface MXRoomSyncState : MXJSONModel - - /** - List of state events (array of MXEvent). The resulting state corresponds to the *start* of the timeline. - */ - @property (nonatomic) NSArray *events; - -@end - -/** - `MXRoomSyncTimeline` represents the timeline of messages and state changes for a room during server sync. - */ -@interface MXRoomSyncTimeline : MXJSONModel - - /** - List of events (array of MXEvent). - */ - @property (nonatomic) NSArray *events; - - /** - Boolean which tells whether there are more events on the server - */ - @property (nonatomic) BOOL limited; - - /** - If the batch was limited then this is a token that can be supplied to the server to retrieve more events - */ - @property (nonatomic) NSString *prevBatch; - -@end - -/** - `MXRoomSyncEphemeral` represents the ephemeral events in the room that aren't recorded in the timeline or state of the room (e.g. typing). - */ -@interface MXRoomSyncEphemeral : MXJSONModel - - /** - List of ephemeral events (array of MXEvent). - */ - @property (nonatomic) NSArray *events; - -@end - -/** - `MXRoomSyncAccountData` represents the account data events for a room. - */ -@interface MXRoomSyncAccountData : MXJSONModel - - /** - List of account data events (array of MXEvent). - */ - @property (nonatomic) NSArray *events; - -@end - -/** - `MXRoomInviteState` represents the state of a room that the user has been invited to. - */ -@interface MXRoomInviteState : MXJSONModel - - /** - List of state events (array of MXEvent). - */ - @property (nonatomic) NSArray *events; - -@end - -/** - `MXRoomSyncUnreadNotifications` represents the unread counts for a room. - */ -@interface MXRoomSyncUnreadNotifications : MXJSONModel - - /** - The number of unread messages that match the push notification rules. - */ - @property (nonatomic) NSUInteger notificationCount; - - /** - The number of highlighted unread messages (subset of notifications). - */ - @property (nonatomic) NSUInteger highlightCount; - -@end - -/** - `MXRoomSyncSummary` represents the summary of a room. - */ -@interface MXRoomSyncSummary : MXJSONModel - -/** - Present only if the room has no m.room.name or m.room.canonical_alias. - Lists the mxids of the first 5 members in the room who are currently joined or - invited (ordered by stream ordering as seen on the server). - */ -@property (nonatomic) NSArray *heroes; - -/** - The number of m.room.members in state ‘joined’ (including the syncing user). - -1 means the information was not sent by the server. - */ -@property (nonatomic) NSUInteger joinedMemberCount; - -/** - The number of m.room.members in state ‘invited’. - -1 means the information was not sent by the server. - */ -@property (nonatomic) NSUInteger invitedMemberCount; - -@end - - -/** - `MXRoomSync` represents the response for a room during server sync. - */ -@interface MXRoomSync : MXJSONModel - - /** - The state updates for the room. - */ - @property (nonatomic) MXRoomSyncState *state; - - /** - The timeline of messages and state changes in the room. - */ - @property (nonatomic) MXRoomSyncTimeline *timeline; - - /** - The ephemeral events in the room that aren't recorded in the timeline or state of the room (e.g. typing, receipts). - */ - @property (nonatomic) MXRoomSyncEphemeral *ephemeral; - - /** - The account data events for the room (e.g. tags). - */ - @property (nonatomic) MXRoomSyncAccountData *accountData; - - /** - The notification counts for the room. - */ - @property (nonatomic) MXRoomSyncUnreadNotifications *unreadNotifications; - - /** - The room summary. Sent in case of lazy-loading of members. - */ - @property (nonatomic) MXRoomSyncSummary *summary; - -@end - -/** - `MXInvitedRoomSync` represents a room invitation during server sync. - */ -@interface MXInvitedRoomSync : MXJSONModel - - /** - The state of a room that the user has been invited to. These state events may only have the 'sender', 'type', 'state_key' - and 'content' keys present. These events do not replace any state that the client already has for the room, for example if - the client has archived the room. Instead the client should keep two separate copies of the state: the one from the 'invite_state' - and one from the archived 'state'. If the client joins the room then the current state will be given as a delta against the - archived 'state' not the 'invite_state'. - */ - @property (nonatomic) MXRoomInviteState *inviteState; - -@end - -/** - `MXGroupSyncProfile` represents the profile of a group. - */ -@interface MXGroupSyncProfile : MXJSONModel - - /** - The name of the group, if any. May be nil. - */ - @property (nonatomic) NSString *name; - - /** - The URL for the group's avatar. May be nil. - */ - @property (nonatomic) NSString *avatarUrl; - -@end - -/** - `MXInvitedGroupSync` represents a group invitation during server sync. - */ -@interface MXInvitedGroupSync : MXJSONModel - - /** - The identifier of the inviter. - */ - @property (nonatomic) NSString *inviter; - - /** - The group profile. - */ - @property (nonatomic) MXGroupSyncProfile *profile; - -@end - -/** - `MXRoomsSyncResponse` represents the rooms list in server sync response. - */ -@interface MXRoomsSyncResponse : MXJSONModel - - /** - Joined rooms: keys are rooms ids. - */ - @property (nonatomic) NSDictionary *join; - - /** - Invitations. The rooms that the user has been invited to: keys are rooms ids. - */ - @property (nonatomic) NSDictionary *invite; - - /** - Left rooms. The rooms that the user has left or been banned from: keys are rooms ids. - */ - @property (nonatomic) NSDictionary *leave; - -@end - -/** - `MXGroupsSyncResponse` represents the groups list in server sync response. - */ -@interface MXGroupsSyncResponse : MXJSONModel - - /** - Joined groups: An array of groups ids. - */ - @property (nonatomic) NSArray *join; - - /** - Invitations. The groups that the user has been invited to: keys are groups ids. - */ - @property (nonatomic) NSDictionary *invite; - - /** - Left groups. An array of groups ids: the groups that the user has left or been banned from. - */ - @property (nonatomic) NSArray *leave; - -@end - -/** - `MXPresenceSyncResponse` represents the updates to the presence status of other users during server sync. - */ -@interface MXPresenceSyncResponse : MXJSONModel - - /** - List of presence events (array of MXEvent with type m.presence). - */ - @property (nonatomic) NSArray *events; - -@end - -/** - `MXToDeviceSyncResponse` represents the data directly sent to one of user's devices. - */ -@interface MXToDeviceSyncResponse : MXJSONModel - - /** - List of direct-to-device events. - */ - @property (nonatomic) NSArray *events; - -@end - - -/** - `MXDeviceListResponse` represents the devices that have changed. - */ -@interface MXDeviceListResponse : MXJSONModel - - /** - List of user ids whose devices have changed (new, removed). - */ - @property (nonatomic) NSArray *changed; - - /** - List of user ids who are no more tracked. - */ - @property (nonatomic) NSArray *left; - -@end - -/** - `MXSyncResponse` represents the request response for server sync. - */ -@interface MXSyncResponse : MXJSONModel - - /** - The user private data. - */ - @property (nonatomic) NSDictionary *accountData; - - /** - The opaque token for the end. - */ - @property (nonatomic) NSString *nextBatch; - - /** - The updates to the presence status of other users. - */ - @property (nonatomic) MXPresenceSyncResponse *presence; - - /** - Data directly sent to one of user's devices. - */ - @property (nonatomic) MXToDeviceSyncResponse *toDevice; - - /** - Devices list update. - */ - @property (nonatomic) MXDeviceListResponse *deviceLists; - - /** - The number of one time keys the server has for our device. - algorithm -> number of keys for that algorithm. - */ - @property (nonatomic) NSDictionary *deviceOneTimeKeysCount; - - /** - List of rooms. - */ - @property (nonatomic) MXRoomsSyncResponse *rooms; - - /** - List of groups. - */ - @property (nonatomic) MXGroupsSyncResponse *groups; - -@end - #pragma mark - Crypto /** `MXKeysUploadResponse` represents the response to /keys/upload request made by diff --git a/MatrixSDK/JSONModels/MXJSONModels.m b/MatrixSDK/JSONModels/MXJSONModels.m index 370b9b6e1e..90a0764a13 100644 --- a/MatrixSDK/JSONModels/MXJSONModels.m +++ b/MatrixSDK/JSONModels/MXJSONModels.m @@ -1024,562 +1024,6 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary @end -@implementation MXRoomSyncState - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomSyncState *roomSyncState = [[MXRoomSyncState alloc] init]; - if (roomSyncState) - { - MXJSONModelSetMXJSONModelArray(roomSyncState.events, MXEvent, JSONDictionary[@"events"]); - } - return roomSyncState; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; - for (MXEvent *event in self.events) - { - [jsonEvents addObject:event.JSONDictionary]; - } - JSONDictionary[@"events"] = jsonEvents; - - return JSONDictionary; -} - -@end - -@implementation MXRoomSyncTimeline - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomSyncTimeline *roomSyncTimeline = [[MXRoomSyncTimeline alloc] init]; - if (roomSyncTimeline) - { - MXJSONModelSetMXJSONModelArray(roomSyncTimeline.events, MXEvent, JSONDictionary[@"events"]); - MXJSONModelSetBoolean(roomSyncTimeline.limited , JSONDictionary[@"limited"]); - MXJSONModelSetString(roomSyncTimeline.prevBatch, JSONDictionary[@"prev_batch"]); - } - return roomSyncTimeline; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; - for (MXEvent *event in self.events) - { - [jsonEvents addObject:event.JSONDictionary]; - } - JSONDictionary[@"events"] = jsonEvents; - JSONDictionary[@"limited"] = @(self.limited); - JSONDictionary[@"prev_batch"] = self.prevBatch; - - return JSONDictionary; -} - -@end - -@implementation MXRoomSyncEphemeral - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomSyncEphemeral *roomSyncEphemeral = [[MXRoomSyncEphemeral alloc] init]; - if (roomSyncEphemeral) - { - MXJSONModelSetMXJSONModelArray(roomSyncEphemeral.events, MXEvent, JSONDictionary[@"events"]); - } - return roomSyncEphemeral; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; - for (MXEvent *event in self.events) - { - [jsonEvents addObject:event.JSONDictionary]; - } - JSONDictionary[@"events"] = jsonEvents; - - return JSONDictionary; -} - -@end - -@implementation MXRoomSyncAccountData - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomSyncAccountData *roomSyncAccountData = [[MXRoomSyncAccountData alloc] init]; - if (roomSyncAccountData) - { - MXJSONModelSetMXJSONModelArray(roomSyncAccountData.events, MXEvent, JSONDictionary[@"events"]); - } - return roomSyncAccountData; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; - for (MXEvent *event in self.events) - { - [jsonEvents addObject:event.JSONDictionary]; - } - JSONDictionary[@"events"] = jsonEvents; - - return JSONDictionary; -} - -@end - -@implementation MXRoomInviteState - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomInviteState *roomInviteState = [[MXRoomInviteState alloc] init]; - if (roomInviteState) - { - MXJSONModelSetMXJSONModelArray(roomInviteState.events, MXEvent, JSONDictionary[@"events"]); - } - return roomInviteState; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; - for (MXEvent *event in self.events) - { - [jsonEvents addObject:event.JSONDictionary]; - } - JSONDictionary[@"events"] = jsonEvents; - - return JSONDictionary; -} - -@end - -@implementation MXRoomSyncUnreadNotifications - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomSyncUnreadNotifications *roomSyncUnreadNotifications = [[MXRoomSyncUnreadNotifications alloc] init]; - if (roomSyncUnreadNotifications) - { - MXJSONModelSetUInteger(roomSyncUnreadNotifications.notificationCount, JSONDictionary[@"notification_count"]); - MXJSONModelSetUInteger(roomSyncUnreadNotifications.highlightCount, JSONDictionary[@"highlight_count"]); - } - return roomSyncUnreadNotifications; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"notification_count"] = @(self.notificationCount); - JSONDictionary[@"highlight_count"] = @(self.highlightCount); - - return JSONDictionary; -} - -@end - -@implementation MXRoomSyncSummary - -- (instancetype)init -{ - self = [super init]; - if (self) - { - _joinedMemberCount = -1; - _invitedMemberCount = -1; - } - return self; -} - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomSyncSummary *roomSyncSummary; - - if (JSONDictionary.count) - { - roomSyncSummary = [MXRoomSyncSummary new]; - if (roomSyncSummary) - { - MXJSONModelSetArray(roomSyncSummary.heroes, JSONDictionary[@"m.heroes"]); - MXJSONModelSetUInteger(roomSyncSummary.joinedMemberCount, JSONDictionary[@"m.joined_member_count"]); - MXJSONModelSetUInteger(roomSyncSummary.invitedMemberCount, JSONDictionary[@"m.invited_member_count"]); - } - } - return roomSyncSummary; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"m.heroes"] = self.heroes; - JSONDictionary[@"m.joined_member_count"] = @(self.joinedMemberCount); - JSONDictionary[@"m.invited_member_count"] = @(self.invitedMemberCount); - - return JSONDictionary; -} - -@end - - -@implementation MXRoomSync - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomSync *roomSync = [[MXRoomSync alloc] init]; - if (roomSync) - { - MXJSONModelSetMXJSONModel(roomSync.state, MXRoomSyncState, JSONDictionary[@"state"]); - MXJSONModelSetMXJSONModel(roomSync.timeline, MXRoomSyncTimeline, JSONDictionary[@"timeline"]); - MXJSONModelSetMXJSONModel(roomSync.ephemeral, MXRoomSyncEphemeral, JSONDictionary[@"ephemeral"]); - MXJSONModelSetMXJSONModel(roomSync.accountData, MXRoomSyncAccountData, JSONDictionary[@"account_data"]); - MXJSONModelSetMXJSONModel(roomSync.unreadNotifications, MXRoomSyncUnreadNotifications, JSONDictionary[@"unread_notifications"]); - MXJSONModelSetMXJSONModel(roomSync.summary, MXRoomSyncSummary, JSONDictionary[@"summary"]); - } - return roomSync; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"state"] = self.state.JSONDictionary; - JSONDictionary[@"timeline"] = self.timeline.JSONDictionary; - JSONDictionary[@"ephemeral"] = self.ephemeral.JSONDictionary; - JSONDictionary[@"account_data"] = self.accountData.JSONDictionary; - JSONDictionary[@"unread_notifications"] = self.unreadNotifications.JSONDictionary; - JSONDictionary[@"summary"] = self.summary.JSONDictionary; - - return JSONDictionary; -} - -@end - -@implementation MXInvitedRoomSync - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXInvitedRoomSync *invitedRoomSync = [[MXInvitedRoomSync alloc] init]; - if (invitedRoomSync) - { - MXJSONModelSetMXJSONModel(invitedRoomSync.inviteState, MXRoomInviteState, JSONDictionary[@"invite_state"]); - } - return invitedRoomSync; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"invite_state"] = self.inviteState.JSONDictionary; - - return JSONDictionary; -} - -@end - -#pragma mark - Group -#pragma mark - - -@implementation MXGroupSyncProfile - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXGroupSyncProfile *groupProfile = [[MXGroupSyncProfile alloc] init]; - if (groupProfile) - { - MXJSONModelSetString(groupProfile.name, JSONDictionary[@"name"]); - MXJSONModelSetString(groupProfile.avatarUrl, JSONDictionary[@"avatar_url"]); - } - - return groupProfile; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"name"] = self.name; - JSONDictionary[@"avatar_url"] = self.avatarUrl; - - return JSONDictionary; -} - -@end - -@implementation MXInvitedGroupSync - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXInvitedGroupSync *invitedGroupSync = [[MXInvitedGroupSync alloc] init]; - if (invitedGroupSync) - { - MXJSONModelSetString(invitedGroupSync.inviter, JSONDictionary[@"inviter"]); - MXJSONModelSetMXJSONModel(invitedGroupSync.profile, MXGroupSyncProfile, JSONDictionary[@"profile"]); - } - return invitedGroupSync; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"inviter"] = self.inviter; - JSONDictionary[@"profile"] = self.profile.JSONDictionary; - - return JSONDictionary; -} - -@end - -@implementation MXPresenceSyncResponse - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXPresenceSyncResponse *presenceSyncResponse = [[MXPresenceSyncResponse alloc] init]; - if (presenceSyncResponse) - { - MXJSONModelSetMXJSONModelArray(presenceSyncResponse.events, MXEvent, JSONDictionary[@"events"]); - } - return presenceSyncResponse; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; - for (MXEvent *event in self.events) - { - [jsonEvents addObject:event.JSONDictionary]; - } - JSONDictionary[@"events"] = jsonEvents; - - return JSONDictionary; -} - -@end - -@implementation MXToDeviceSyncResponse - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXToDeviceSyncResponse *toDeviceSyncResponse = [[MXToDeviceSyncResponse alloc] init]; - if (toDeviceSyncResponse) - { - MXJSONModelSetMXJSONModelArray(toDeviceSyncResponse.events, MXEvent, JSONDictionary[@"events"]); - } - return toDeviceSyncResponse; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; - for (MXEvent *event in self.events) - { - [jsonEvents addObject:event.JSONDictionary]; - } - JSONDictionary[@"events"] = jsonEvents; - - return JSONDictionary; -} - -@end - -@implementation MXDeviceListResponse - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXDeviceListResponse *deviceListResponse = [[MXDeviceListResponse alloc] init]; - if (deviceListResponse) - { - MXJSONModelSetArray(deviceListResponse.changed, JSONDictionary[@"changed"]); - MXJSONModelSetArray(deviceListResponse.left, JSONDictionary[@"left"]); - } - return deviceListResponse; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"changed"] = self.changed; - JSONDictionary[@"left"] = self.left; - - return JSONDictionary; -} - -@end - -@implementation MXRoomsSyncResponse - -// Indeed the values in received dictionaries are JSON dictionaries. We convert them in -// MXRoomSync or MXInvitedRoomSync objects. -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXRoomsSyncResponse *roomsSync = [[MXRoomsSyncResponse alloc] init]; - if (roomsSync) - { - NSMutableDictionary *mxJoin = [NSMutableDictionary dictionary]; - for (NSString *roomId in JSONDictionary[@"join"]) - { - MXJSONModelSetMXJSONModel(mxJoin[roomId], MXRoomSync, JSONDictionary[@"join"][roomId]); - } - roomsSync.join = mxJoin; - - NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; - for (NSString *roomId in JSONDictionary[@"invite"]) - { - MXJSONModelSetMXJSONModel(mxInvite[roomId], MXInvitedRoomSync, JSONDictionary[@"invite"][roomId]); - } - roomsSync.invite = mxInvite; - - NSMutableDictionary *mxLeave = [NSMutableDictionary dictionary]; - for (NSString *roomId in JSONDictionary[@"leave"]) - { - MXJSONModelSetMXJSONModel(mxLeave[roomId], MXRoomSync, JSONDictionary[@"leave"][roomId]); - } - roomsSync.leave = mxLeave; - } - - return roomsSync; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - NSMutableDictionary *jsonJoin = [NSMutableDictionary dictionaryWithCapacity:self.join.count]; - for (NSString *key in self.join) - { - jsonJoin[key] = self.join[key].JSONDictionary; - } - JSONDictionary[@"join"] = jsonJoin; - - NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; - for (NSString *key in self.invite) - { - jsonInvite[key] = self.invite[key].JSONDictionary; - } - JSONDictionary[@"invite"] = jsonInvite; - - NSMutableDictionary *jsonLeave = [NSMutableDictionary dictionaryWithCapacity:self.leave.count]; - for (NSString *key in self.leave) - { - jsonLeave[key] = self.leave[key].JSONDictionary; - } - JSONDictionary[@"leave"] = jsonLeave; - - return JSONDictionary; -} - -@end - -@implementation MXGroupsSyncResponse - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXGroupsSyncResponse *groupsSync = [[MXGroupsSyncResponse alloc] init]; - if (groupsSync) - { - NSObject *joinedGroups = JSONDictionary[@"join"]; - if ([joinedGroups isKindOfClass:[NSDictionary class]]) - { - groupsSync.join = [NSArray arrayWithArray:((NSDictionary*)joinedGroups).allKeys]; - } - - NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; - for (NSString *groupId in JSONDictionary[@"invite"]) - { - MXJSONModelSetMXJSONModel(mxInvite[groupId], MXInvitedGroupSync, JSONDictionary[@"invite"][groupId]); - } - groupsSync.invite = mxInvite; - - NSObject *leftGroups = JSONDictionary[@"leave"]; - if ([leftGroups isKindOfClass:[NSDictionary class]]) - { - groupsSync.leave = [NSArray arrayWithArray:((NSDictionary*)leftGroups).allKeys]; - } - } - - return groupsSync; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"join"] = self.join; - - NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; - for (NSString *key in self.invite) - { - jsonInvite[key] = self.invite[key].JSONDictionary; - } - JSONDictionary[@"invite"] = jsonInvite; - - JSONDictionary[@"leave"] = self.leave; - - return JSONDictionary; -} - -@end - -@implementation MXSyncResponse - -+ (id)modelFromJSON:(NSDictionary *)JSONDictionary -{ - MXSyncResponse *syncResponse = [[MXSyncResponse alloc] init]; - if (syncResponse) - { - MXJSONModelSetDictionary(syncResponse.accountData, JSONDictionary[@"account_data"]) - MXJSONModelSetString(syncResponse.nextBatch, JSONDictionary[@"next_batch"]); - MXJSONModelSetMXJSONModel(syncResponse.presence, MXPresenceSyncResponse, JSONDictionary[@"presence"]); - MXJSONModelSetMXJSONModel(syncResponse.toDevice, MXToDeviceSyncResponse, JSONDictionary[@"to_device"]); - MXJSONModelSetMXJSONModel(syncResponse.deviceLists, MXDeviceListResponse, JSONDictionary[@"device_lists"]); - MXJSONModelSetDictionary(syncResponse.deviceOneTimeKeysCount, JSONDictionary[@"device_one_time_keys_count"]) - MXJSONModelSetMXJSONModel(syncResponse.rooms, MXRoomsSyncResponse, JSONDictionary[@"rooms"]); - MXJSONModelSetMXJSONModel(syncResponse.groups, MXGroupsSyncResponse, JSONDictionary[@"groups"]); - } - - return syncResponse; -} - -- (NSDictionary *)JSONDictionary -{ - NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - - JSONDictionary[@"account_data"] = self.accountData; - JSONDictionary[@"next_batch"] = self.nextBatch; - JSONDictionary[@"presence"] = self.presence.JSONDictionary; - JSONDictionary[@"to_device"] = self.toDevice.JSONDictionary; - JSONDictionary[@"device_lists"] = self.deviceLists.JSONDictionary; - JSONDictionary[@"device_one_time_keys_count"] = self.deviceOneTimeKeysCount; - JSONDictionary[@"rooms"] = self.rooms.JSONDictionary; - JSONDictionary[@"groups"] = self.groups.JSONDictionary; - - return JSONDictionary; -} - -@end - #pragma mark - Crypto @implementation MXKeysUploadResponse diff --git a/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h b/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h new file mode 100644 index 0000000000..767fed583a --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h @@ -0,0 +1,38 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXGroupSyncProfile` represents the profile of a group. + */ +@interface MXGroupSyncProfile : MXJSONModel + +/** + The name of the group, if any. May be nil. + */ +@property (nonatomic) NSString *name; + +/** + The URL for the group's avatar. May be nil. + */ +@property (nonatomic) NSString *avatarUrl; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.m b/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.m new file mode 100644 index 0000000000..24daaf1160 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.m @@ -0,0 +1,43 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXGroupSyncProfile.h" + +@implementation MXGroupSyncProfile + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXGroupSyncProfile *groupProfile = [[MXGroupSyncProfile alloc] init]; + if (groupProfile) + { + MXJSONModelSetString(groupProfile.name, JSONDictionary[@"name"]); + MXJSONModelSetString(groupProfile.avatarUrl, JSONDictionary[@"avatar_url"]); + } + + return groupProfile; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"name"] = self.name; + JSONDictionary[@"avatar_url"] = self.avatarUrl; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h new file mode 100644 index 0000000000..9de642c47b --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h @@ -0,0 +1,45 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXInvitedGroupSync; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXGroupsSyncResponse` represents the groups list in server sync response. + */ +@interface MXGroupsSyncResponse : MXJSONModel + +/** + Joined groups: An array of groups ids. + */ +@property (nonatomic) NSArray *join; + +/** + Invitations. The groups that the user has been invited to: keys are groups ids. + */ +@property (nonatomic) NSDictionary *invite; + +/** + Left groups. An array of groups ids: the groups that the user has left or been banned from. + */ +@property (nonatomic) NSArray *leave; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m new file mode 100644 index 0000000000..92f59f3b48 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m @@ -0,0 +1,69 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXGroupsSyncResponse.h" + +#import "MXInvitedGroupSync.h" + +@implementation MXGroupsSyncResponse + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXGroupsSyncResponse *groupsSync = [[MXGroupsSyncResponse alloc] init]; + if (groupsSync) + { + NSObject *joinedGroups = JSONDictionary[@"join"]; + if ([joinedGroups isKindOfClass:[NSDictionary class]]) + { + groupsSync.join = [NSArray arrayWithArray:((NSDictionary*)joinedGroups).allKeys]; + } + + NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; + for (NSString *groupId in JSONDictionary[@"invite"]) + { + MXJSONModelSetMXJSONModel(mxInvite[groupId], MXInvitedGroupSync, JSONDictionary[@"invite"][groupId]); + } + groupsSync.invite = mxInvite; + + NSObject *leftGroups = JSONDictionary[@"leave"]; + if ([leftGroups isKindOfClass:[NSDictionary class]]) + { + groupsSync.leave = [NSArray arrayWithArray:((NSDictionary*)leftGroups).allKeys]; + } + } + + return groupsSync; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"join"] = self.join; + + NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; + for (NSString *key in self.invite) + { + jsonInvite[key] = self.invite[key].JSONDictionary; + } + JSONDictionary[@"invite"] = jsonInvite; + + JSONDictionary[@"leave"] = self.leave; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.h b/MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.h new file mode 100644 index 0000000000..147e868796 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.h @@ -0,0 +1,40 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXGroupSyncProfile; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXInvitedGroupSync` represents a group invitation during server sync. + */ +@interface MXInvitedGroupSync : MXJSONModel + +/** + The identifier of the inviter. + */ +@property (nonatomic) NSString *inviter; + +/** + The group profile. + */ +@property (nonatomic) MXGroupSyncProfile *profile; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.m b/MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.m new file mode 100644 index 0000000000..b1d9d157f9 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.m @@ -0,0 +1,44 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXInvitedGroupSync.h" + +#import "MXGroupSyncProfile.h" + +@implementation MXInvitedGroupSync + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXInvitedGroupSync *invitedGroupSync = [[MXInvitedGroupSync alloc] init]; + if (invitedGroupSync) + { + MXJSONModelSetString(invitedGroupSync.inviter, JSONDictionary[@"inviter"]); + MXJSONModelSetMXJSONModel(invitedGroupSync.profile, MXGroupSyncProfile, JSONDictionary[@"profile"]); + } + return invitedGroupSync; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"inviter"] = self.inviter; + JSONDictionary[@"profile"] = self.profile.JSONDictionary; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h new file mode 100644 index 0000000000..e7723aec1c --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h @@ -0,0 +1,38 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXDeviceListResponse` represents the devices that have changed. + */ +@interface MXDeviceListResponse : MXJSONModel + +/** + List of user ids whose devices have changed (new, removed). + */ +@property (nonatomic) NSArray *changed; + +/** + List of user ids who are no more tracked. + */ +@property (nonatomic) NSArray *left; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m new file mode 100644 index 0000000000..842adf6844 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m @@ -0,0 +1,42 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXDeviceListResponse.h" + +@implementation MXDeviceListResponse + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXDeviceListResponse *deviceListResponse = [[MXDeviceListResponse alloc] init]; + if (deviceListResponse) + { + MXJSONModelSetArray(deviceListResponse.changed, JSONDictionary[@"changed"]); + MXJSONModelSetArray(deviceListResponse.left, JSONDictionary[@"left"]); + } + return deviceListResponse; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"changed"] = self.changed; + JSONDictionary[@"left"] = self.left; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.h b/MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.h new file mode 100644 index 0000000000..361d7b75fe --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.h @@ -0,0 +1,39 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXRoomInviteState; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXInvitedRoomSync` represents a room invitation during server sync. + */ +@interface MXInvitedRoomSync : MXJSONModel + +/** + The state of a room that the user has been invited to. These state events may only have the 'sender', 'type', 'state_key' + and 'content' keys present. These events do not replace any state that the client already has for the room, for example if + the client has archived the room. Instead the client should keep two separate copies of the state: the one from the 'invite_state' + and one from the archived 'state'. If the client joins the room then the current state will be given as a delta against the + archived 'state' not the 'invite_state'. + */ +@property (nonatomic) MXRoomInviteState *inviteState; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.m b/MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.m new file mode 100644 index 0000000000..c1c6108019 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXInvitedRoomSync.m @@ -0,0 +1,42 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXInvitedRoomSync.h" + +#import "MXRoomInviteState.h" + +@implementation MXInvitedRoomSync + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXInvitedRoomSync *invitedRoomSync = [[MXInvitedRoomSync alloc] init]; + if (invitedRoomSync) + { + MXJSONModelSetMXJSONModel(invitedRoomSync.inviteState, MXRoomInviteState, JSONDictionary[@"invite_state"]); + } + return invitedRoomSync; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"invite_state"] = self.inviteState.JSONDictionary; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.h b/MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.h new file mode 100644 index 0000000000..4ae61ebbf9 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.h @@ -0,0 +1,35 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXEvent; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXPresenceSyncResponse` represents the updates to the presence status of other users during server sync. + */ +@interface MXPresenceSyncResponse : MXJSONModel + +/** + List of presence events (array of MXEvent with type m.presence). + */ +@property (nonatomic) NSArray *events; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.m b/MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.m new file mode 100644 index 0000000000..5f329ac519 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.m @@ -0,0 +1,47 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXPresenceSyncResponse.h" + +#import "MXEvent.h" + +@implementation MXPresenceSyncResponse + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXPresenceSyncResponse *presenceSyncResponse = [[MXPresenceSyncResponse alloc] init]; + if (presenceSyncResponse) + { + MXJSONModelSetMXJSONModelArray(presenceSyncResponse.events, MXEvent, JSONDictionary[@"events"]); + } + return presenceSyncResponse; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; + for (MXEvent *event in self.events) + { + [jsonEvents addObject:event.JSONDictionary]; + } + JSONDictionary[@"events"] = jsonEvents; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/MXRoomInviteState.h b/MatrixSDK/JSONModels/Sync/MXRoomInviteState.h new file mode 100644 index 0000000000..237ee5bae8 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXRoomInviteState.h @@ -0,0 +1,35 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXEvent; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomInviteState` represents the state of a room that the user has been invited to. + */ +@interface MXRoomInviteState : MXJSONModel + +/** + List of state events (array of MXEvent). + */ +@property (nonatomic) NSArray *events; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/MXRoomInviteState.m b/MatrixSDK/JSONModels/Sync/MXRoomInviteState.m new file mode 100644 index 0000000000..7036e184ca --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXRoomInviteState.m @@ -0,0 +1,47 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomInviteState.h" + +#import "MXEvent.h" + +@implementation MXRoomInviteState + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomInviteState *roomInviteState = [[MXRoomInviteState alloc] init]; + if (roomInviteState) + { + MXJSONModelSetMXJSONModelArray(roomInviteState.events, MXEvent, JSONDictionary[@"events"]); + } + return roomInviteState; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; + for (MXEvent *event in self.events) + { + [jsonEvents addObject:event.JSONDictionary]; + } + JSONDictionary[@"events"] = jsonEvents; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h new file mode 100644 index 0000000000..0bfbbd99d3 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h @@ -0,0 +1,46 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXRoomSync; +@class MXInvitedRoomSync; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomsSyncResponse` represents the rooms list in server sync response. + */ +@interface MXRoomsSyncResponse : MXJSONModel + +/** + Joined rooms: keys are rooms ids. + */ +@property (nonatomic) NSDictionary *join; + +/** + Invitations. The rooms that the user has been invited to: keys are rooms ids. + */ +@property (nonatomic) NSDictionary *invite; + +/** + Left rooms. The rooms that the user has left or been banned from: keys are rooms ids. + */ +@property (nonatomic) NSDictionary *leave; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m new file mode 100644 index 0000000000..2c7f861e3d --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m @@ -0,0 +1,84 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomsSyncResponse.h" + +#import "MXRoomSync.h" +#import "MXInvitedRoomSync.h" + +@implementation MXRoomsSyncResponse + +// Indeed the values in received dictionaries are JSON dictionaries. We convert them in +// MXRoomSync or MXInvitedRoomSync objects. ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomsSyncResponse *roomsSync = [[MXRoomsSyncResponse alloc] init]; + if (roomsSync) + { + NSMutableDictionary *mxJoin = [NSMutableDictionary dictionary]; + for (NSString *roomId in JSONDictionary[@"join"]) + { + MXJSONModelSetMXJSONModel(mxJoin[roomId], MXRoomSync, JSONDictionary[@"join"][roomId]); + } + roomsSync.join = mxJoin; + + NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; + for (NSString *roomId in JSONDictionary[@"invite"]) + { + MXJSONModelSetMXJSONModel(mxInvite[roomId], MXInvitedRoomSync, JSONDictionary[@"invite"][roomId]); + } + roomsSync.invite = mxInvite; + + NSMutableDictionary *mxLeave = [NSMutableDictionary dictionary]; + for (NSString *roomId in JSONDictionary[@"leave"]) + { + MXJSONModelSetMXJSONModel(mxLeave[roomId], MXRoomSync, JSONDictionary[@"leave"][roomId]); + } + roomsSync.leave = mxLeave; + } + + return roomsSync; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableDictionary *jsonJoin = [NSMutableDictionary dictionaryWithCapacity:self.join.count]; + for (NSString *key in self.join) + { + jsonJoin[key] = self.join[key].JSONDictionary; + } + JSONDictionary[@"join"] = jsonJoin; + + NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; + for (NSString *key in self.invite) + { + jsonInvite[key] = self.invite[key].JSONDictionary; + } + JSONDictionary[@"invite"] = jsonInvite; + + NSMutableDictionary *jsonLeave = [NSMutableDictionary dictionaryWithCapacity:self.leave.count]; + for (NSString *key in self.leave) + { + jsonLeave[key] = self.leave[key].JSONDictionary; + } + JSONDictionary[@"leave"] = jsonLeave; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/MXSyncResponse.h b/MatrixSDK/JSONModels/Sync/MXSyncResponse.h new file mode 100644 index 0000000000..36e3dd8f20 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXSyncResponse.h @@ -0,0 +1,75 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXPresenceSyncResponse; +@class MXToDeviceSyncResponse; +@class MXDeviceListResponse; +@class MXRoomsSyncResponse; +@class MXGroupsSyncResponse; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXSyncResponse` represents the request response for server sync. + */ +@interface MXSyncResponse : MXJSONModel + +/** + The user private data. + */ +@property (nonatomic) NSDictionary *accountData; + +/** + The opaque token for the end. + */ +@property (nonatomic) NSString *nextBatch; + +/** + The updates to the presence status of other users. + */ +@property (nonatomic) MXPresenceSyncResponse *presence; + +/** + Data directly sent to one of user's devices. + */ +@property (nonatomic) MXToDeviceSyncResponse *toDevice; + +/** + Devices list update. + */ +@property (nonatomic) MXDeviceListResponse *deviceLists; + +/** + The number of one time keys the server has for our device. + algorithm -> number of keys for that algorithm. + */ +@property (nonatomic) NSDictionary *deviceOneTimeKeysCount; + +/** + List of rooms. + */ +@property (nonatomic) MXRoomsSyncResponse *rooms; + +/** + List of groups. + */ +@property (nonatomic) MXGroupsSyncResponse *groups; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/MXSyncResponse.m b/MatrixSDK/JSONModels/Sync/MXSyncResponse.m new file mode 100644 index 0000000000..cbd17ec757 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXSyncResponse.m @@ -0,0 +1,61 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXSyncResponse.h" + +#import "MXPresenceSyncResponse.h" +#import "MXToDeviceSyncResponse.h" +#import "MXDeviceListResponse.h" +#import "MXRoomsSyncResponse.h" +#import "MXGroupsSyncResponse.h" + +@implementation MXSyncResponse + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXSyncResponse *syncResponse = [[MXSyncResponse alloc] init]; + if (syncResponse) + { + MXJSONModelSetDictionary(syncResponse.accountData, JSONDictionary[@"account_data"]) + MXJSONModelSetString(syncResponse.nextBatch, JSONDictionary[@"next_batch"]); + MXJSONModelSetMXJSONModel(syncResponse.presence, MXPresenceSyncResponse, JSONDictionary[@"presence"]); + MXJSONModelSetMXJSONModel(syncResponse.toDevice, MXToDeviceSyncResponse, JSONDictionary[@"to_device"]); + MXJSONModelSetMXJSONModel(syncResponse.deviceLists, MXDeviceListResponse, JSONDictionary[@"device_lists"]); + MXJSONModelSetDictionary(syncResponse.deviceOneTimeKeysCount, JSONDictionary[@"device_one_time_keys_count"]) + MXJSONModelSetMXJSONModel(syncResponse.rooms, MXRoomsSyncResponse, JSONDictionary[@"rooms"]); + MXJSONModelSetMXJSONModel(syncResponse.groups, MXGroupsSyncResponse, JSONDictionary[@"groups"]); + } + + return syncResponse; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"account_data"] = self.accountData; + JSONDictionary[@"next_batch"] = self.nextBatch; + JSONDictionary[@"presence"] = self.presence.JSONDictionary; + JSONDictionary[@"to_device"] = self.toDevice.JSONDictionary; + JSONDictionary[@"device_lists"] = self.deviceLists.JSONDictionary; + JSONDictionary[@"device_one_time_keys_count"] = self.deviceOneTimeKeysCount; + JSONDictionary[@"rooms"] = self.rooms.JSONDictionary; + JSONDictionary[@"groups"] = self.groups.JSONDictionary; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.h b/MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.h new file mode 100644 index 0000000000..7b2be80036 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.h @@ -0,0 +1,35 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXEvent; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXToDeviceSyncResponse` represents the data directly sent to one of user's devices. + */ +@interface MXToDeviceSyncResponse : MXJSONModel + +/** + List of direct-to-device events. + */ +@property (nonatomic) NSArray *events; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.m b/MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.m new file mode 100644 index 0000000000..f06b6ee245 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.m @@ -0,0 +1,47 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXToDeviceSyncResponse.h" + +#import "MXEvent.h" + +@implementation MXToDeviceSyncResponse + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXToDeviceSyncResponse *toDeviceSyncResponse = [[MXToDeviceSyncResponse alloc] init]; + if (toDeviceSyncResponse) + { + MXJSONModelSetMXJSONModelArray(toDeviceSyncResponse.events, MXEvent, JSONDictionary[@"events"]); + } + return toDeviceSyncResponse; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; + for (MXEvent *event in self.events) + { + [jsonEvents addObject:event.JSONDictionary]; + } + JSONDictionary[@"events"] = jsonEvents; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSync.h b/MatrixSDK/JSONModels/Sync/Room/MXRoomSync.h new file mode 100644 index 0000000000..82cdb95753 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSync.h @@ -0,0 +1,65 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXRoomSyncState; +@class MXRoomSyncTimeline; +@class MXRoomSyncEphemeral; +@class MXRoomSyncAccountData; +@class MXRoomSyncUnreadNotifications; +@class MXRoomSyncSummary; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomSync` represents the response for a room during server sync. + */ +@interface MXRoomSync : MXJSONModel + +/** + The state updates for the room. + */ +@property (nonatomic) MXRoomSyncState *state; + +/** + The timeline of messages and state changes in the room. + */ +@property (nonatomic) MXRoomSyncTimeline *timeline; + +/** + The ephemeral events in the room that aren't recorded in the timeline or state of the room (e.g. typing, receipts). + */ +@property (nonatomic) MXRoomSyncEphemeral *ephemeral; + +/** + The account data events for the room (e.g. tags). + */ +@property (nonatomic) MXRoomSyncAccountData *accountData; + +/** + The notification counts for the room. + */ +@property (nonatomic) MXRoomSyncUnreadNotifications *unreadNotifications; + +/** + The room summary. Sent in case of lazy-loading of members. + */ +@property (nonatomic) MXRoomSyncSummary *summary; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSync.m b/MatrixSDK/JSONModels/Sync/Room/MXRoomSync.m new file mode 100644 index 0000000000..6867197724 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSync.m @@ -0,0 +1,57 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomSync.h" + +#import "MXRoomSyncState.h" +#import "MXRoomSyncTimeline.h" +#import "MXRoomSyncEphemeral.h" +#import "MXRoomSyncAccountData.h" +#import "MXRoomSyncUnreadNotifications.h" +#import "MXRoomSyncSummary.h" + +@implementation MXRoomSync + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomSync *roomSync = [[MXRoomSync alloc] init]; + if (roomSync) + { + MXJSONModelSetMXJSONModel(roomSync.state, MXRoomSyncState, JSONDictionary[@"state"]); + MXJSONModelSetMXJSONModel(roomSync.timeline, MXRoomSyncTimeline, JSONDictionary[@"timeline"]); + MXJSONModelSetMXJSONModel(roomSync.ephemeral, MXRoomSyncEphemeral, JSONDictionary[@"ephemeral"]); + MXJSONModelSetMXJSONModel(roomSync.accountData, MXRoomSyncAccountData, JSONDictionary[@"account_data"]); + MXJSONModelSetMXJSONModel(roomSync.unreadNotifications, MXRoomSyncUnreadNotifications, JSONDictionary[@"unread_notifications"]); + MXJSONModelSetMXJSONModel(roomSync.summary, MXRoomSyncSummary, JSONDictionary[@"summary"]); + } + return roomSync; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"state"] = self.state.JSONDictionary; + JSONDictionary[@"timeline"] = self.timeline.JSONDictionary; + JSONDictionary[@"ephemeral"] = self.ephemeral.JSONDictionary; + JSONDictionary[@"account_data"] = self.accountData.JSONDictionary; + JSONDictionary[@"unread_notifications"] = self.unreadNotifications.JSONDictionary; + JSONDictionary[@"summary"] = self.summary.JSONDictionary; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.h b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.h new file mode 100644 index 0000000000..552045669c --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.h @@ -0,0 +1,35 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXEvent; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomSyncAccountData` represents the account data events for a room. + */ +@interface MXRoomSyncAccountData : MXJSONModel + +/** + List of account data events (array of MXEvent). + */ +@property (nonatomic) NSArray *events; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.m b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.m new file mode 100644 index 0000000000..a98d8c6891 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.m @@ -0,0 +1,47 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomSyncAccountData.h" + +#import "MXEvent.h" + +@implementation MXRoomSyncAccountData + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomSyncAccountData *roomSyncAccountData = [[MXRoomSyncAccountData alloc] init]; + if (roomSyncAccountData) + { + MXJSONModelSetMXJSONModelArray(roomSyncAccountData.events, MXEvent, JSONDictionary[@"events"]); + } + return roomSyncAccountData; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; + for (MXEvent *event in self.events) + { + [jsonEvents addObject:event.JSONDictionary]; + } + JSONDictionary[@"events"] = jsonEvents; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.h b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.h new file mode 100644 index 0000000000..45d42f954c --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.h @@ -0,0 +1,35 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXEvent; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomSyncEphemeral` represents the ephemeral events in the room that aren't recorded in the timeline or state of the room (e.g. typing). + */ +@interface MXRoomSyncEphemeral : MXJSONModel + +/** + List of ephemeral events (array of MXEvent). + */ +@property (nonatomic) NSArray *events; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.m b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.m new file mode 100644 index 0000000000..d5fd7b38bf --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.m @@ -0,0 +1,47 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomSyncEphemeral.h" + +#import "MXEvent.h" + +@implementation MXRoomSyncEphemeral + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomSyncEphemeral *roomSyncEphemeral = [[MXRoomSyncEphemeral alloc] init]; + if (roomSyncEphemeral) + { + MXJSONModelSetMXJSONModelArray(roomSyncEphemeral.events, MXEvent, JSONDictionary[@"events"]); + } + return roomSyncEphemeral; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; + for (MXEvent *event in self.events) + { + [jsonEvents addObject:event.JSONDictionary]; + } + JSONDictionary[@"events"] = jsonEvents; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.h b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.h new file mode 100644 index 0000000000..13557656e8 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.h @@ -0,0 +1,35 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXEvent; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomSyncState` represents the state updates for a room during server sync. + */ +@interface MXRoomSyncState : MXJSONModel + +/** + List of state events (array of MXEvent). The resulting state corresponds to the *start* of the timeline. + */ +@property (nonatomic) NSArray *events; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.m b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.m new file mode 100644 index 0000000000..7d029d3c0b --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.m @@ -0,0 +1,47 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomSyncState.h" + +#import "MXEvent.h" + +@implementation MXRoomSyncState + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomSyncState *roomSyncState = [[MXRoomSyncState alloc] init]; + if (roomSyncState) + { + MXJSONModelSetMXJSONModelArray(roomSyncState.events, MXEvent, JSONDictionary[@"events"]); + } + return roomSyncState; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; + for (MXEvent *event in self.events) + { + [jsonEvents addObject:event.JSONDictionary]; + } + JSONDictionary[@"events"] = jsonEvents; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.h b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.h new file mode 100644 index 0000000000..bc464ca230 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.h @@ -0,0 +1,47 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomSyncSummary` represents the summary of a room. + */ +@interface MXRoomSyncSummary : MXJSONModel + +/** + Present only if the room has no m.room.name or m.room.canonical_alias. + Lists the mxids of the first 5 members in the room who are currently joined or + invited (ordered by stream ordering as seen on the server). + */ +@property (nonatomic) NSArray *heroes; + +/** + The number of m.room.members in state ‘joined’ (including the syncing user). + -1 means the information was not sent by the server. + */ +@property (nonatomic) NSUInteger joinedMemberCount; + +/** + The number of m.room.members in state ‘invited’. + -1 means the information was not sent by the server. + */ +@property (nonatomic) NSUInteger invitedMemberCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.m b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.m new file mode 100644 index 0000000000..efc511a932 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncSummary.m @@ -0,0 +1,60 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomSyncSummary.h" + +@implementation MXRoomSyncSummary + +- (instancetype)init +{ + self = [super init]; + if (self) + { + _joinedMemberCount = -1; + _invitedMemberCount = -1; + } + return self; +} + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomSyncSummary *roomSyncSummary; + + if (JSONDictionary.count) + { + roomSyncSummary = [MXRoomSyncSummary new]; + if (roomSyncSummary) + { + MXJSONModelSetArray(roomSyncSummary.heroes, JSONDictionary[@"m.heroes"]); + MXJSONModelSetUInteger(roomSyncSummary.joinedMemberCount, JSONDictionary[@"m.joined_member_count"]); + MXJSONModelSetUInteger(roomSyncSummary.invitedMemberCount, JSONDictionary[@"m.invited_member_count"]); + } + } + return roomSyncSummary; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"m.heroes"] = self.heroes; + JSONDictionary[@"m.joined_member_count"] = @(self.joinedMemberCount); + JSONDictionary[@"m.invited_member_count"] = @(self.invitedMemberCount); + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.h b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.h new file mode 100644 index 0000000000..6572c4217c --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.h @@ -0,0 +1,45 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +@class MXEvent; + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomSyncTimeline` represents the timeline of messages and state changes for a room during server sync. + */ +@interface MXRoomSyncTimeline : MXJSONModel + +/** + List of events (array of MXEvent). + */ +@property (nonatomic) NSArray *events; + +/** + Boolean which tells whether there are more events on the server + */ +@property (nonatomic) BOOL limited; + +/** + If the batch was limited then this is a token that can be supplied to the server to retrieve more events + */ +@property (nonatomic) NSString *prevBatch; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.m b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.m new file mode 100644 index 0000000000..074aeed6a9 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncTimeline.m @@ -0,0 +1,51 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomSyncTimeline.h" + +#import "MXEvent.h" + +@implementation MXRoomSyncTimeline + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomSyncTimeline *roomSyncTimeline = [[MXRoomSyncTimeline alloc] init]; + if (roomSyncTimeline) + { + MXJSONModelSetMXJSONModelArray(roomSyncTimeline.events, MXEvent, JSONDictionary[@"events"]); + MXJSONModelSetBoolean(roomSyncTimeline.limited , JSONDictionary[@"limited"]); + MXJSONModelSetString(roomSyncTimeline.prevBatch, JSONDictionary[@"prev_batch"]); + } + return roomSyncTimeline; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + NSMutableArray *jsonEvents = [NSMutableArray arrayWithCapacity:self.events.count]; + for (MXEvent *event in self.events) + { + [jsonEvents addObject:event.JSONDictionary]; + } + JSONDictionary[@"events"] = jsonEvents; + JSONDictionary[@"limited"] = @(self.limited); + JSONDictionary[@"prev_batch"] = self.prevBatch; + + return JSONDictionary; +} + +@end diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.h b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.h new file mode 100644 index 0000000000..4a830cbc89 --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.h @@ -0,0 +1,38 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + `MXRoomSyncUnreadNotifications` represents the unread counts for a room. + */ +@interface MXRoomSyncUnreadNotifications : MXJSONModel + +/** + The number of unread messages that match the push notification rules. + */ +@property (nonatomic) NSUInteger notificationCount; + +/** + The number of highlighted unread messages (subset of notifications). + */ +@property (nonatomic) NSUInteger highlightCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.m b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.m new file mode 100644 index 0000000000..27aa07e17d --- /dev/null +++ b/MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.m @@ -0,0 +1,42 @@ +// +// Copyright 2021 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "MXRoomSyncUnreadNotifications.h" + +@implementation MXRoomSyncUnreadNotifications + ++ (id)modelFromJSON:(NSDictionary *)JSONDictionary +{ + MXRoomSyncUnreadNotifications *roomSyncUnreadNotifications = [[MXRoomSyncUnreadNotifications alloc] init]; + if (roomSyncUnreadNotifications) + { + MXJSONModelSetUInteger(roomSyncUnreadNotifications.notificationCount, JSONDictionary[@"notification_count"]); + MXJSONModelSetUInteger(roomSyncUnreadNotifications.highlightCount, JSONDictionary[@"highlight_count"]); + } + return roomSyncUnreadNotifications; +} + +- (NSDictionary *)JSONDictionary +{ + NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; + + JSONDictionary[@"notification_count"] = @(self.notificationCount); + JSONDictionary[@"highlight_count"] = @(self.highlightCount); + + return JSONDictionary; +} + +@end From 33ec6fb9d82a4cf013651388833e65c074a94519 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 13:10:38 +0300 Subject: [PATCH 2/8] Add new headers to umbrella header --- MatrixSDK/MatrixSDK.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/MatrixSDK/MatrixSDK.h b/MatrixSDK/MatrixSDK.h index cdc745f47c..0dbc2449d7 100644 --- a/MatrixSDK/MatrixSDK.h +++ b/MatrixSDK/MatrixSDK.h @@ -143,3 +143,21 @@ FOUNDATION_EXPORT NSString *MatrixSDKVersion; #import "MXCachedSyncResponse.h" #import "MXBackgroundCryptoStore.h" +// Sync response models +#import "MXSyncResponse.h" +#import "MXPresenceSyncResponse.h" +#import "MXToDeviceSyncResponse.h" +#import "MXDeviceListResponse.h" +#import "MXRoomsSyncResponse.h" +#import "MXRoomSync.h" +#import "MXRoomSyncState.h" +#import "MXRoomSyncTimeline.h" +#import "MXRoomSyncEphemeral.h" +#import "MXRoomSyncAccountData.h" +#import "MXRoomSyncUnreadNotifications.h" +#import "MXRoomSyncSummary.h" +#import "MXInvitedRoomSync.h" +#import "MXRoomInviteState.h" +#import "MXGroupsSyncResponse.h" +#import "MXInvitedGroupSync.h" +#import "MXGroupSyncProfile.h" From 64c8ba12c1c301e64f6f52cb91c493cb71203980 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 13:11:30 +0300 Subject: [PATCH 3/8] Use forward declarations --- MatrixSDK/Data/MXRoomSummary.h | 3 +++ MatrixSDK/MXRestClient.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/MatrixSDK/Data/MXRoomSummary.h b/MatrixSDK/Data/MXRoomSummary.h index dbd88e3e0e..ff55cb886d 100644 --- a/MatrixSDK/Data/MXRoomSummary.h +++ b/MatrixSDK/Data/MXRoomSummary.h @@ -27,6 +27,9 @@ #import "MXRoomType.h" @class MXSession, MXRoom, MXRoomState, MXEvent; +@class MXRoomSync; +@class MXInvitedRoomSync; +@class MXRoomSyncSummary; @protocol MXStore; diff --git a/MatrixSDK/MXRestClient.h b/MatrixSDK/MXRestClient.h index 82155cf387..62dd25fd91 100644 --- a/MatrixSDK/MXRestClient.h +++ b/MatrixSDK/MXRestClient.h @@ -44,6 +44,8 @@ @class MXThirdpartyProtocolsResponse; @class MXThirdPartyUsersResponse; +@class MXSyncResponse; +@class MXDeviceListResponse; #pragma mark - Constants definitions /** From f3ee0c25ff95cb24ad1b32778376835b55157f88 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 14:12:25 +0300 Subject: [PATCH 4/8] Update nullable parameters --- .../Sync/Group/MXGroupsSyncResponse.h | 6 +- .../Sync/Group/MXGroupsSyncResponse.m | 32 ++++++--- .../JSONModels/Sync/MXDeviceListResponse.h | 4 +- .../JSONModels/Sync/MXDeviceListResponse.m | 10 ++- .../JSONModels/Sync/MXRoomsSyncResponse.h | 6 +- .../JSONModels/Sync/MXRoomsSyncResponse.m | 66 ++++++++++++------- MatrixSDK/JSONModels/Sync/MXSyncResponse.h | 14 ++-- MatrixSDK/JSONModels/Sync/MXSyncResponse.m | 37 ++++++++--- 8 files changed, 116 insertions(+), 59 deletions(-) diff --git a/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h index 9de642c47b..78cb2a1f06 100644 --- a/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h +++ b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.h @@ -28,17 +28,17 @@ NS_ASSUME_NONNULL_BEGIN /** Joined groups: An array of groups ids. */ -@property (nonatomic) NSArray *join; +@property (nonatomic, nullable) NSArray *join; /** Invitations. The groups that the user has been invited to: keys are groups ids. */ -@property (nonatomic) NSDictionary *invite; +@property (nonatomic, nullable) NSDictionary *invite; /** Left groups. An array of groups ids: the groups that the user has left or been banned from. */ -@property (nonatomic) NSArray *leave; +@property (nonatomic, nullable) NSArray *leave; @end diff --git a/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m index 92f59f3b48..069d034598 100644 --- a/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m +++ b/MatrixSDK/JSONModels/Sync/Group/MXGroupsSyncResponse.m @@ -31,12 +31,15 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary groupsSync.join = [NSArray arrayWithArray:((NSDictionary*)joinedGroups).allKeys]; } - NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; - for (NSString *groupId in JSONDictionary[@"invite"]) + if (JSONDictionary[@"invite"]) { - MXJSONModelSetMXJSONModel(mxInvite[groupId], MXInvitedGroupSync, JSONDictionary[@"invite"][groupId]); + NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; + for (NSString *groupId in JSONDictionary[@"invite"]) + { + MXJSONModelSetMXJSONModel(mxInvite[groupId], MXInvitedGroupSync, JSONDictionary[@"invite"][groupId]); + } + groupsSync.invite = mxInvite; } - groupsSync.invite = mxInvite; NSObject *leftGroups = JSONDictionary[@"leave"]; if ([leftGroups isKindOfClass:[NSDictionary class]]) @@ -52,16 +55,25 @@ - (NSDictionary *)JSONDictionary { NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - JSONDictionary[@"join"] = self.join; + if (self.join) + { + JSONDictionary[@"join"] = self.join; + } - NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; - for (NSString *key in self.invite) + if (self.invite) { - jsonInvite[key] = self.invite[key].JSONDictionary; + NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; + for (NSString *key in self.invite) + { + jsonInvite[key] = self.invite[key].JSONDictionary; + } + JSONDictionary[@"invite"] = jsonInvite; } - JSONDictionary[@"invite"] = jsonInvite; - JSONDictionary[@"leave"] = self.leave; + if (self.leave) + { + JSONDictionary[@"leave"] = self.leave; + } return JSONDictionary; } diff --git a/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h index e7723aec1c..76e98268cd 100644 --- a/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h +++ b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h @@ -26,12 +26,12 @@ NS_ASSUME_NONNULL_BEGIN /** List of user ids whose devices have changed (new, removed). */ -@property (nonatomic) NSArray *changed; +@property (nonatomic, nullable) NSArray *changed; /** List of user ids who are no more tracked. */ -@property (nonatomic) NSArray *left; +@property (nonatomic, nullable) NSArray *left; @end diff --git a/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m index 842adf6844..f51d267796 100644 --- a/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m +++ b/MatrixSDK/JSONModels/Sync/MXDeviceListResponse.m @@ -33,8 +33,14 @@ - (NSDictionary *)JSONDictionary { NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - JSONDictionary[@"changed"] = self.changed; - JSONDictionary[@"left"] = self.left; + if (self.changed) + { + JSONDictionary[@"changed"] = self.changed; + } + if (self.left) + { + JSONDictionary[@"left"] = self.left; + } return JSONDictionary; } diff --git a/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h index 0bfbbd99d3..55081ce410 100644 --- a/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h +++ b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.h @@ -29,17 +29,17 @@ NS_ASSUME_NONNULL_BEGIN /** Joined rooms: keys are rooms ids. */ -@property (nonatomic) NSDictionary *join; +@property (nonatomic, nullable) NSDictionary *join; /** Invitations. The rooms that the user has been invited to: keys are rooms ids. */ -@property (nonatomic) NSDictionary *invite; +@property (nonatomic, nullable) NSDictionary *invite; /** Left rooms. The rooms that the user has left or been banned from: keys are rooms ids. */ -@property (nonatomic) NSDictionary *leave; +@property (nonatomic, nullable) NSDictionary *leave; @end diff --git a/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m index 2c7f861e3d..b3f6bce27d 100644 --- a/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m +++ b/MatrixSDK/JSONModels/Sync/MXRoomsSyncResponse.m @@ -28,26 +28,35 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary MXRoomsSyncResponse *roomsSync = [[MXRoomsSyncResponse alloc] init]; if (roomsSync) { - NSMutableDictionary *mxJoin = [NSMutableDictionary dictionary]; - for (NSString *roomId in JSONDictionary[@"join"]) + if (JSONDictionary[@"join"]) { - MXJSONModelSetMXJSONModel(mxJoin[roomId], MXRoomSync, JSONDictionary[@"join"][roomId]); + NSMutableDictionary *mxJoin = [NSMutableDictionary dictionary]; + for (NSString *roomId in JSONDictionary[@"join"]) + { + MXJSONModelSetMXJSONModel(mxJoin[roomId], MXRoomSync, JSONDictionary[@"join"][roomId]); + } + roomsSync.join = mxJoin; } - roomsSync.join = mxJoin; - NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; - for (NSString *roomId in JSONDictionary[@"invite"]) + if (JSONDictionary[@"invite"]) { - MXJSONModelSetMXJSONModel(mxInvite[roomId], MXInvitedRoomSync, JSONDictionary[@"invite"][roomId]); + NSMutableDictionary *mxInvite = [NSMutableDictionary dictionary]; + for (NSString *roomId in JSONDictionary[@"invite"]) + { + MXJSONModelSetMXJSONModel(mxInvite[roomId], MXInvitedRoomSync, JSONDictionary[@"invite"][roomId]); + } + roomsSync.invite = mxInvite; } - roomsSync.invite = mxInvite; - NSMutableDictionary *mxLeave = [NSMutableDictionary dictionary]; - for (NSString *roomId in JSONDictionary[@"leave"]) + if (JSONDictionary[@"leave"]) { - MXJSONModelSetMXJSONModel(mxLeave[roomId], MXRoomSync, JSONDictionary[@"leave"][roomId]); + NSMutableDictionary *mxLeave = [NSMutableDictionary dictionary]; + for (NSString *roomId in JSONDictionary[@"leave"]) + { + MXJSONModelSetMXJSONModel(mxLeave[roomId], MXRoomSync, JSONDictionary[@"leave"][roomId]); + } + roomsSync.leave = mxLeave; } - roomsSync.leave = mxLeave; } return roomsSync; @@ -57,26 +66,35 @@ - (NSDictionary *)JSONDictionary { NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - NSMutableDictionary *jsonJoin = [NSMutableDictionary dictionaryWithCapacity:self.join.count]; - for (NSString *key in self.join) + if (self.join) { - jsonJoin[key] = self.join[key].JSONDictionary; + NSMutableDictionary *jsonJoin = [NSMutableDictionary dictionaryWithCapacity:self.join.count]; + for (NSString *key in self.join) + { + jsonJoin[key] = self.join[key].JSONDictionary; + } + JSONDictionary[@"join"] = jsonJoin; } - JSONDictionary[@"join"] = jsonJoin; - NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; - for (NSString *key in self.invite) + if (self.invite) { - jsonInvite[key] = self.invite[key].JSONDictionary; + NSMutableDictionary *jsonInvite = [NSMutableDictionary dictionaryWithCapacity:self.invite.count]; + for (NSString *key in self.invite) + { + jsonInvite[key] = self.invite[key].JSONDictionary; + } + JSONDictionary[@"invite"] = jsonInvite; } - JSONDictionary[@"invite"] = jsonInvite; - NSMutableDictionary *jsonLeave = [NSMutableDictionary dictionaryWithCapacity:self.leave.count]; - for (NSString *key in self.leave) + if (self.leave) { - jsonLeave[key] = self.leave[key].JSONDictionary; + NSMutableDictionary *jsonLeave = [NSMutableDictionary dictionaryWithCapacity:self.leave.count]; + for (NSString *key in self.leave) + { + jsonLeave[key] = self.leave[key].JSONDictionary; + } + JSONDictionary[@"leave"] = jsonLeave; } - JSONDictionary[@"leave"] = jsonLeave; return JSONDictionary; } diff --git a/MatrixSDK/JSONModels/Sync/MXSyncResponse.h b/MatrixSDK/JSONModels/Sync/MXSyncResponse.h index 36e3dd8f20..8f488707b9 100644 --- a/MatrixSDK/JSONModels/Sync/MXSyncResponse.h +++ b/MatrixSDK/JSONModels/Sync/MXSyncResponse.h @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN /** The user private data. */ -@property (nonatomic) NSDictionary *accountData; +@property (nonatomic, nullable) NSDictionary *accountData; /** The opaque token for the end. @@ -42,33 +42,33 @@ NS_ASSUME_NONNULL_BEGIN /** The updates to the presence status of other users. */ -@property (nonatomic) MXPresenceSyncResponse *presence; +@property (nonatomic, nullable) MXPresenceSyncResponse *presence; /** Data directly sent to one of user's devices. */ -@property (nonatomic) MXToDeviceSyncResponse *toDevice; +@property (nonatomic, nullable) MXToDeviceSyncResponse *toDevice; /** Devices list update. */ -@property (nonatomic) MXDeviceListResponse *deviceLists; +@property (nonatomic, nullable) MXDeviceListResponse *deviceLists; /** The number of one time keys the server has for our device. algorithm -> number of keys for that algorithm. */ -@property (nonatomic) NSDictionary *deviceOneTimeKeysCount; +@property (nonatomic, nullable) NSDictionary *deviceOneTimeKeysCount; /** List of rooms. */ -@property (nonatomic) MXRoomsSyncResponse *rooms; +@property (nonatomic, nullable) MXRoomsSyncResponse *rooms; /** List of groups. */ -@property (nonatomic) MXGroupsSyncResponse *groups; +@property (nonatomic, nullable) MXGroupsSyncResponse *groups; @end diff --git a/MatrixSDK/JSONModels/Sync/MXSyncResponse.m b/MatrixSDK/JSONModels/Sync/MXSyncResponse.m index cbd17ec757..d63e6797af 100644 --- a/MatrixSDK/JSONModels/Sync/MXSyncResponse.m +++ b/MatrixSDK/JSONModels/Sync/MXSyncResponse.m @@ -38,7 +38,7 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary MXJSONModelSetMXJSONModel(syncResponse.rooms, MXRoomsSyncResponse, JSONDictionary[@"rooms"]); MXJSONModelSetMXJSONModel(syncResponse.groups, MXGroupsSyncResponse, JSONDictionary[@"groups"]); } - + return syncResponse; } @@ -46,14 +46,35 @@ - (NSDictionary *)JSONDictionary { NSMutableDictionary *JSONDictionary = [NSMutableDictionary dictionary]; - JSONDictionary[@"account_data"] = self.accountData; + if (self.accountData) + { + JSONDictionary[@"account_data"] = self.accountData; + } JSONDictionary[@"next_batch"] = self.nextBatch; - JSONDictionary[@"presence"] = self.presence.JSONDictionary; - JSONDictionary[@"to_device"] = self.toDevice.JSONDictionary; - JSONDictionary[@"device_lists"] = self.deviceLists.JSONDictionary; - JSONDictionary[@"device_one_time_keys_count"] = self.deviceOneTimeKeysCount; - JSONDictionary[@"rooms"] = self.rooms.JSONDictionary; - JSONDictionary[@"groups"] = self.groups.JSONDictionary; + if (self.presence) + { + JSONDictionary[@"presence"] = self.presence.JSONDictionary; + } + if (self.toDevice) + { + JSONDictionary[@"to_device"] = self.toDevice.JSONDictionary; + } + if (self.deviceLists) + { + JSONDictionary[@"device_lists"] = self.deviceLists.JSONDictionary; + } + if (self.deviceOneTimeKeysCount) + { + JSONDictionary[@"device_one_time_keys_count"] = self.deviceOneTimeKeysCount; + } + if (self.rooms) + { + JSONDictionary[@"rooms"] = self.rooms.JSONDictionary; + } + if (self.groups) + { + JSONDictionary[@"groups"] = self.groups.JSONDictionary; + } return JSONDictionary; } From efd00baba5c1a04d38461d5b8e254e68ee26a772 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 14:26:12 +0300 Subject: [PATCH 5/8] Fix build --- .../Background/MXBackgroundSyncService.swift | 14 ++-- .../Store/MXSyncResponseStoreManager.swift | 73 ++++++++----------- .../Store/Model/MXCachedSyncResponse.m | 2 +- MatrixSDK/Crypto/MXCrypto.m | 2 + MatrixSDK/Data/MXEventTimeline.m | 2 + MatrixSDK/Data/MXRoom.m | 2 + MatrixSDK/Data/MXRoomSummary.m | 2 + .../MXBackgroundSyncServiceTests.swift | 8 +- MatrixSDKTests/MXSessionTests.m | 1 + 9 files changed, 54 insertions(+), 52 deletions(-) diff --git a/MatrixSDK/Background/MXBackgroundSyncService.swift b/MatrixSDK/Background/MXBackgroundSyncService.swift index 706d3a52f0..f67d30eb1f 100644 --- a/MatrixSDK/Background/MXBackgroundSyncService.swift +++ b/MatrixSDK/Background/MXBackgroundSyncService.swift @@ -488,19 +488,21 @@ public enum MXBackgroundSyncServiceError: Error { private func handleSyncResponse(_ syncResponse: MXSyncResponse, syncToken: String) { NSLog("[MXBackgroundSyncService] handleSyncResponse: Received %tu joined rooms, %tu invited rooms, %tu left rooms, %tu toDevice events.", - syncResponse.rooms.join.count, - syncResponse.rooms.invite.count, - syncResponse.rooms.leave.count, - syncResponse.toDevice.events?.count ?? 0) + syncResponse.rooms?.join?.count ?? 0, + syncResponse.rooms?.invite?.count ?? 0, + syncResponse.rooms?.leave?.count ?? 0, + syncResponse.toDevice?.events.count ?? 0) - pushRulesManager.handleAccountData(syncResponse.accountData) + if let accountData = syncResponse.accountData { + pushRulesManager.handleAccountData(accountData) + } syncResponseStoreManager.updateStore(with: syncResponse, syncToken: syncToken) for event in syncResponse.toDevice?.events ?? [] { handleToDeviceEvent(event) } - NSLog("[MXBackgroundSyncService] handleSyncResponse: Next sync token: \(syncResponse.nextBatch ?? "nil")") + NSLog("[MXBackgroundSyncService] handleSyncResponse: Next sync token: \(syncResponse.nextBatch)") } private func handleToDeviceEvent(_ event: MXEvent) { diff --git a/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift b/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift index 3925d99afa..fe9fb27bf0 100644 --- a/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift +++ b/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift @@ -93,34 +93,34 @@ public class MXSyncResponseStoreManager: NSObject { NSLog("[MXSyncResponseStoreManager] updateStore: Merge new sync response to the previous one") // handle new limited timelines - newSyncResponse.rooms.join.filter({ $1.timeline?.limited == true }).forEach { (roomId, _) in - if let joinedRoomSync = cachedSyncResponse.syncResponse.rooms.join[roomId] { + newSyncResponse.rooms?.join?.filter({ $1.timeline.limited == true }).forEach { (roomId, _) in + if let joinedRoomSync = cachedSyncResponse.syncResponse.rooms?.join?[roomId] { // remove old events - joinedRoomSync.timeline?.events = [] + joinedRoomSync.timeline.events = [] // mark old timeline as limited too - joinedRoomSync.timeline?.limited = true + joinedRoomSync.timeline.limited = true } } - newSyncResponse.rooms.leave.filter({ $1.timeline?.limited == true }).forEach { (roomId, _) in - if let leftRoomSync = cachedSyncResponse.syncResponse.rooms.leave[roomId] { + newSyncResponse.rooms?.leave?.filter({ $1.timeline.limited == true }).forEach { (roomId, _) in + if let leftRoomSync = cachedSyncResponse.syncResponse.rooms?.leave?[roomId] { // remove old events - leftRoomSync.timeline?.events = [] + leftRoomSync.timeline.events = [] // mark old timeline as limited too - leftRoomSync.timeline?.limited = true + leftRoomSync.timeline.limited = true } } // handle old limited timelines - cachedSyncResponse.syncResponse.rooms.join.filter({ $1.timeline?.limited == true }).forEach { (roomId, _) in - if let joinedRoomSync = newSyncResponse.rooms.join[roomId] { + cachedSyncResponse.syncResponse.rooms?.join?.filter({ $1.timeline.limited == true }).forEach { (roomId, _) in + if let joinedRoomSync = newSyncResponse.rooms?.join?[roomId] { // mark new timeline as limited too, to avoid losing value of limited - joinedRoomSync.timeline?.limited = true + joinedRoomSync.timeline.limited = true } } - cachedSyncResponse.syncResponse.rooms.leave.filter({ $1.timeline?.limited == true }).forEach { (roomId, _) in - if let leftRoomSync = newSyncResponse.rooms.leave[roomId] { + cachedSyncResponse.syncResponse.rooms?.leave?.filter({ $1.timeline.limited == true }).forEach { (roomId, _) in + if let leftRoomSync = newSyncResponse.rooms?.leave?[roomId] { // mark new timeline as limited too, to avoid losing value of limited - leftRoomSync.timeline?.limited = true + leftRoomSync.timeline.limited = true } } @@ -191,18 +191,18 @@ public class MXSyncResponseStoreManager: NSObject { private func event(withEventId eventId: String, inRoom roomId: String, inSyncResponse response: MXCachedSyncResponse) -> MXEvent? { var allEvents: [MXEvent] = [] - if let joinedRoomSync = response.syncResponse.rooms.join[roomId] { - allEvents.appendIfNotNil(contentsOf: joinedRoomSync.state?.events) - allEvents.appendIfNotNil(contentsOf: joinedRoomSync.timeline?.events) - allEvents.appendIfNotNil(contentsOf: joinedRoomSync.accountData?.events) + if let joinedRoomSync = response.syncResponse.rooms?.join?[roomId] { + allEvents.appendIfNotNil(contentsOf: joinedRoomSync.state.events) + allEvents.appendIfNotNil(contentsOf: joinedRoomSync.timeline.events) + allEvents.appendIfNotNil(contentsOf: joinedRoomSync.accountData.events) } - if let invitedRoomSync = response.syncResponse.rooms.invite[roomId] { - allEvents.appendIfNotNil(contentsOf: invitedRoomSync.inviteState?.events) + if let invitedRoomSync = response.syncResponse.rooms?.invite?[roomId] { + allEvents.appendIfNotNil(contentsOf: invitedRoomSync.inviteState.events) } - if let leftRoomSync = response.syncResponse.rooms.leave[roomId] { - allEvents.appendIfNotNil(contentsOf: leftRoomSync.state?.events) - allEvents.appendIfNotNil(contentsOf: leftRoomSync.timeline?.events) - allEvents.appendIfNotNil(contentsOf: leftRoomSync.accountData?.events) + if let leftRoomSync = response.syncResponse.rooms?.leave?[roomId] { + allEvents.appendIfNotNil(contentsOf: leftRoomSync.state.events) + allEvents.appendIfNotNil(contentsOf: leftRoomSync.timeline.events) + allEvents.appendIfNotNil(contentsOf: leftRoomSync.accountData.events) } let result = allEvents.first(where: { eventId == $0.eventId }) @@ -243,27 +243,18 @@ public class MXSyncResponseStoreManager: NSObject { private func roomSummary(forRoomId roomId: String, using summary: MXRoomSummary, inSyncResponse response: MXCachedSyncResponse) -> MXRoomSummary? { var eventsToProcess: [MXEvent] = [] - if let invitedRoomSync = response.syncResponse.rooms.invite[roomId], - let stateEvents = invitedRoomSync.inviteState?.events { - eventsToProcess.append(contentsOf: stateEvents) + if let invitedRoomSync = response.syncResponse.rooms?.invite?[roomId] { + eventsToProcess.append(contentsOf: invitedRoomSync.inviteState.events) } - if let joinedRoomSync = response.syncResponse.rooms.join[roomId] { - if let stateEvents = joinedRoomSync.state?.events { - eventsToProcess.append(contentsOf: stateEvents) - } - if let timelineEvents = joinedRoomSync.timeline?.events { - eventsToProcess.append(contentsOf: timelineEvents) - } + if let joinedRoomSync = response.syncResponse.rooms?.join?[roomId] { + eventsToProcess.append(contentsOf: joinedRoomSync.state.events) + eventsToProcess.append(contentsOf: joinedRoomSync.timeline.events) } - if let leftRoomSync = response.syncResponse.rooms.leave[roomId] { - if let stateEvents = leftRoomSync.state?.events { - eventsToProcess.append(contentsOf: stateEvents) - } - if let timelineEvents = leftRoomSync.timeline?.events { - eventsToProcess.append(contentsOf: timelineEvents) - } + if let leftRoomSync = response.syncResponse.rooms?.leave?[roomId] { + eventsToProcess.append(contentsOf: leftRoomSync.state.events) + eventsToProcess.append(contentsOf: leftRoomSync.timeline.events) } for event in eventsToProcess { diff --git a/MatrixSDK/Background/Store/Model/MXCachedSyncResponse.m b/MatrixSDK/Background/Store/Model/MXCachedSyncResponse.m index 27b1e7f0af..9071e332c1 100644 --- a/MatrixSDK/Background/Store/Model/MXCachedSyncResponse.m +++ b/MatrixSDK/Background/Store/Model/MXCachedSyncResponse.m @@ -15,7 +15,7 @@ // #import "MXCachedSyncResponse.h" -#import "MXJSONModels.h" +#import "MXSyncResponse.h" @implementation MXCachedSyncResponse diff --git a/MatrixSDK/Crypto/MXCrypto.m b/MatrixSDK/Crypto/MXCrypto.m index ffaf9f1d24..858bd076d3 100644 --- a/MatrixSDK/Crypto/MXCrypto.m +++ b/MatrixSDK/Crypto/MXCrypto.m @@ -49,6 +49,8 @@ #import "NSArray+MatrixSDK.h" +#import "MXDeviceListResponse.h" + /** The store to use for crypto. */ diff --git a/MatrixSDK/Data/MXEventTimeline.m b/MatrixSDK/Data/MXEventTimeline.m index dfd7d2ea10..9251a27bf3 100644 --- a/MatrixSDK/Data/MXEventTimeline.m +++ b/MatrixSDK/Data/MXEventTimeline.m @@ -29,6 +29,8 @@ #import "MXEventsEnumeratorOnArray.h" +#import "MXRoomSync.h" + NSString *const kMXRoomInviteStateEventIdPrefix = @"invite-"; @interface MXEventTimeline () diff --git a/MatrixSDK/Data/MXRoom.m b/MatrixSDK/Data/MXRoom.m index d3ecc33fb2..1e9f2c8738 100644 --- a/MatrixSDK/Data/MXRoom.m +++ b/MatrixSDK/Data/MXRoom.m @@ -33,6 +33,8 @@ #import "MXError.h" +#import "MXRoomSync.h" + NSString *const kMXRoomDidFlushDataNotification = @"kMXRoomDidFlushDataNotification"; NSString *const kMXRoomInitialSyncNotification = @"kMXRoomInitialSyncNotification"; diff --git a/MatrixSDK/Data/MXRoomSummary.m b/MatrixSDK/Data/MXRoomSummary.m index 6002fe2dc3..3f7443f9f1 100644 --- a/MatrixSDK/Data/MXRoomSummary.m +++ b/MatrixSDK/Data/MXRoomSummary.m @@ -27,6 +27,8 @@ #import "MXEventRelations.h" #import "MXEventReplace.h" +#import "MXRoomSync.h" + #import #import diff --git a/MatrixSDKTests/MXBackgroundSyncServiceTests.swift b/MatrixSDKTests/MXBackgroundSyncServiceTests.swift index 9579018298..3b4457de4a 100644 --- a/MatrixSDKTests/MXBackgroundSyncServiceTests.swift +++ b/MatrixSDKTests/MXBackgroundSyncServiceTests.swift @@ -463,7 +463,7 @@ class MXBackgroundSyncServiceTests: XCTestCase { var syncResponse = syncResponseStoreManager.lastSyncResponse()?.syncResponse XCTAssertNotNil(syncResponse, "Sync response should be present") - XCTAssertTrue(syncResponse!.rooms.join[roomId]!.timeline.limited, "Room timeline should be limited") + XCTAssertTrue(syncResponse!.rooms!.join![roomId]!.timeline.limited, "Room timeline should be limited") // then send a single message var localEcho: MXEvent? @@ -481,7 +481,7 @@ class MXBackgroundSyncServiceTests: XCTestCase { case .success: // read sync response again syncResponse = syncResponseStoreManager.lastSyncResponse()?.syncResponse - XCTAssertTrue(syncResponse!.rooms.join[roomId]!.timeline.limited, "Room timeline should still be limited") + XCTAssertTrue(syncResponse!.rooms!.join![roomId]!.timeline.limited, "Room timeline should still be limited") expectation?.fulfill() case .failure(let error): XCTFail("Cannot fetch the event from background sync service - error: \(error)") @@ -562,7 +562,7 @@ class MXBackgroundSyncServiceTests: XCTestCase { var syncResponse = syncResponseStoreManager.lastSyncResponse()?.syncResponse XCTAssertNotNil(syncResponse, "Sync response should be present") XCTAssertNotNil(syncResponseStoreManager.event(withEventId: eventId, inRoom: roomId), "Event should be present in sync response store") - XCTAssertFalse(syncResponse!.rooms.join[roomId]!.timeline.limited, "Room timeline should not be limited") + XCTAssertFalse(syncResponse!.rooms!.join![roomId]!.timeline.limited, "Room timeline should not be limited") // then send a lot of messages let messages = (1...Constants.numberOfMessagesForLimitedTest).map({ "\(Constants.messageText) - \($0)" }) @@ -588,7 +588,7 @@ class MXBackgroundSyncServiceTests: XCTestCase { // read sync response again syncResponse = syncResponseStoreManager.lastSyncResponse()?.syncResponse - XCTAssertTrue(syncResponse!.rooms.join[roomId]!.timeline.limited, "Room timeline should be limited") + XCTAssertTrue(syncResponse!.rooms!.join![roomId]!.timeline.limited, "Room timeline should be limited") expectation?.fulfill() diff --git a/MatrixSDKTests/MXSessionTests.m b/MatrixSDKTests/MXSessionTests.m index d0d8312d24..a95e548865 100644 --- a/MatrixSDKTests/MXSessionTests.m +++ b/MatrixSDKTests/MXSessionTests.m @@ -24,6 +24,7 @@ #import "MXMemoryStore.h" #import "MXFileStore.h" #import "MatrixSDKSwiftHeader.h" +#import "MXSyncResponse.h" // Do not bother with retain cycles warnings in tests #pragma clang diagnostic push From 7891e274a8f2aef38201ec65d0a43464416e493e Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 16:20:46 +0300 Subject: [PATCH 6/8] Add empty sync response test --- MatrixSDKTests/MXSessionTests.m | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/MatrixSDKTests/MXSessionTests.m b/MatrixSDKTests/MXSessionTests.m index a95e548865..fe30b271bf 100644 --- a/MatrixSDKTests/MXSessionTests.m +++ b/MatrixSDKTests/MXSessionTests.m @@ -736,6 +736,44 @@ - (void)testDidSyncNotification }]; } +// Check sync response does not contain empty objects. +// +// - Have Bob start a new session +// - Run initial sync on Bob's session +// - Run another sync on Bob's session +// -> Check latter sync response does not contain anything but the event stream token +- (void)testEmptySyncResponse +{ + [matrixSDKTestsData doMXSessionTestWithBob:self readyToTest:^(MXSession *mxSession2, XCTestExpectation *expectation) { + mxSession = mxSession2; + + __block BOOL isFirst = YES; + + observer = [[NSNotificationCenter defaultCenter] addObserverForName:kMXSessionDidSyncNotification object:mxSession queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { + + if (isFirst) + { + isFirst = NO; + // wait for another sync response, which should be completely empty + return; + } + MXSyncResponse *syncResponse = (MXSyncResponse*)notif.userInfo[kMXSessionNotificationSyncResponseKey]; + + XCTAssert([syncResponse isKindOfClass:MXSyncResponse.class]); + XCTAssertNil(syncResponse.accountData, @"Account data should be nil"); + XCTAssertNotNil(syncResponse.nextBatch, @"Event stream token must be provided"); + XCTAssertNil(syncResponse.presence, @"Presence should be nil"); + XCTAssertNil(syncResponse.toDevice, @"To device events should be nil"); + XCTAssertNil(syncResponse.deviceLists, @"Device lists should be nil"); + XCTAssertNil(syncResponse.deviceOneTimeKeysCount, @"Device one time keys count should be nil"); + XCTAssertNil(syncResponse.rooms, @"Rooms should be nil"); + XCTAssertNil(syncResponse.groups, @"Groups should be nil"); + + [expectation fulfill]; + }]; + }]; +} + - (void)testCreateRoomWithInvite { [matrixSDKTestsData doMXSessionTestWithBob:self readyToTest:^(MXSession *mxSession2, XCTestExpectation *expectation) { From aa45df0f82bfc2d44910c643b7c1f6dec6e42464 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 16:24:01 +0300 Subject: [PATCH 7/8] Update CHANGES.rst --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 931e3c2a7a..d6b357b177 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,7 @@ Changes to be released in next version * MXCrypto: eventDeviceInfo: Do not synchronise anymore the operation with the decryption queue. * MXRoomSummary: Improve reset resetLastMessage to avoid pagination loop and to limit number of decryptions. * MXSession: Limit the number of decryptions when processing an initial sync (vector-im/element-ios/issues/4307). + * Adapt sync response models to new sync API (vector-im/element-ios/issues/4309). 🐛 Bugfix * MXRoomSummary: Fix decryption of the last message when it is edited (vector-im/element-ios/issues/4322). From b86d158033f6412074d9bc00711a6da5c44eaa58 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 25 May 2021 22:11:44 +0300 Subject: [PATCH 8/8] Update MXGroupSyncProfile.h --- MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h b/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h index 767fed583a..9d1bf179a4 100644 --- a/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h +++ b/MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h @@ -24,12 +24,12 @@ NS_ASSUME_NONNULL_BEGIN @interface MXGroupSyncProfile : MXJSONModel /** - The name of the group, if any. May be nil. + The name of the group. */ @property (nonatomic) NSString *name; /** - The URL for the group's avatar. May be nil. + The URL for the group's avatar. */ @property (nonatomic) NSString *avatarUrl;