Skip to content

Commit

Permalink
Disable notifications for Crypto V2
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderas committed Dec 14, 2022
1 parent ea2dd9b commit 710d5db
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 32 deletions.
42 changes: 24 additions & 18 deletions MatrixSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
B14EF1E32397E90400758AF0 /* MXCall.m in Sources */ = {isa = PBXBuildFile; fileRef = 3245A74D1AF7B2930001D8A7 /* MXCall.m */; };
B14EF1E42397E90400758AF0 /* MXWellknownIntegrations.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */; };
B14EF1E52397E90400758AF0 /* MXLoginPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 3275FD9B21A6B60B00B9C13D /* MXLoginPolicy.m */; };
B14EF1E62397E90400758AF0 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
B14EF1E62397E90400758AF0 /* (null) in Sources */ = {isa = PBXBuildFile; };
B14EF1E72397E90400758AF0 /* MXRoomThirdPartyInvite.m in Sources */ = {isa = PBXBuildFile; fileRef = 327F8DB11C6112BA00581CA3 /* MXRoomThirdPartyInvite.m */; };
B14EF1E82397E90400758AF0 /* MXRoomPowerLevels.m in Sources */ = {isa = PBXBuildFile; fileRef = B17982F42119E4A2001FD722 /* MXRoomPowerLevels.m */; };
B14EF1E92397E90400758AF0 /* MXRealmMediaScanMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = B146D4DE21A5AEF100D8C2C6 /* MXRealmMediaScanMapper.m */; };
Expand Down Expand Up @@ -929,7 +929,7 @@
B14EF21D2397E90400758AF0 /* MXEncryptedContentKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 021AFBA12179E91800742B2C /* MXEncryptedContentKey.m */; };
B14EF21E2397E90400758AF0 /* MXEventDecryptionResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F634AA1FC5E3470054EF49 /* MXEventDecryptionResult.m */; };
B14EF21F2397E90400758AF0 /* MXMyUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 327137261A24D50A00DB6757 /* MXMyUser.m */; };
B14EF2202397E90400758AF0 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
B14EF2202397E90400758AF0 /* (null) in Sources */ = {isa = PBXBuildFile; };
B14EF2212397E90400758AF0 /* MX3PID.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F935831E5B3BE600FC34BF /* MX3PID.swift */; };
B14EF2222397E90400758AF0 /* MXMediaScan.m in Sources */ = {isa = PBXBuildFile; fileRef = B146D47621A5950800D8C2C6 /* MXMediaScan.m */; };
B14EF2232397E90400758AF0 /* MXEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F935861E5B3BE600FC34BF /* MXEvent.swift */; };
Expand All @@ -944,7 +944,7 @@
B14EF22C2397E90400758AF0 /* MXAccountData.m in Sources */ = {isa = PBXBuildFile; fileRef = 3264DB901CEC528D00B99881 /* MXAccountData.m */; };
B14EF22D2397E90400758AF0 /* MXRealmReactionCount.m in Sources */ = {isa = PBXBuildFile; fileRef = 32133018228B010C0070BA9B /* MXRealmReactionCount.m */; };
B14EF22E2397E90400758AF0 /* MXCryptoTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 3250E7C9220C913900736CB5 /* MXCryptoTools.m */; };
B14EF22F2397E90400758AF0 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
B14EF22F2397E90400758AF0 /* (null) in Sources */ = {isa = PBXBuildFile; };
B14EF2302397E90400758AF0 /* MXDeviceListOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 322691311E5EF77D00966A6E /* MXDeviceListOperation.m */; };
B14EF2312397E90400758AF0 /* MX3PidAddSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D2CBFF23422462002BD8CA /* MX3PidAddSession.m */; };
B14EF2322397E90400758AF0 /* MXBugReportRestClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3283F7771EAF30F700C1688C /* MXBugReportRestClient.m */; };
Expand Down Expand Up @@ -988,7 +988,7 @@
B14EF25B2397E90400758AF0 /* MXSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 320DFDD119DD99B60068622A /* MXSession.m */; };
B14EF25C2397E90400758AF0 /* MXRoomTombStoneContent.m in Sources */ = {isa = PBXBuildFile; fileRef = B17982EE2119E49F001FD722 /* MXRoomTombStoneContent.m */; };
B14EF25D2397E90400758AF0 /* MXImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C602B58D1F22A8D700B67D87 /* MXImage.swift */; };
B14EF25E2397E90400758AF0 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
B14EF25E2397E90400758AF0 /* (null) in Sources */ = {isa = PBXBuildFile; };
B14EF25F2397E90400758AF0 /* MXServerNoticeContent.m in Sources */ = {isa = PBXBuildFile; fileRef = 32954018216385F100E300FC /* MXServerNoticeContent.m */; };
B14EF2602397E90400758AF0 /* MXContentScanResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 02CAD434217DD12F0074700B /* MXContentScanResult.m */; };
B14EF2612397E90400758AF0 /* MXRealmAggregationsStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 32133014228AF4EF0070BA9B /* MXRealmAggregationsStore.m */; };
Expand Down Expand Up @@ -1026,7 +1026,7 @@
B14EF2822397E90400758AF0 /* MXDeviceList.m in Sources */ = {isa = PBXBuildFile; fileRef = 32637ED31E5B00400011E20D /* MXDeviceList.m */; };
B14EF2832397E90400758AF0 /* MXRoomCreateContent.m in Sources */ = {isa = PBXBuildFile; fileRef = B17982F22119E4A1001FD722 /* MXRoomCreateContent.m */; };
B14EF2842397E90400758AF0 /* MXUIKitBackgroundModeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 32A9E8231EF4026E0081358A /* MXUIKitBackgroundModeHandler.m */; };
B14EF2852397E90400758AF0 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
B14EF2852397E90400758AF0 /* (null) in Sources */ = {isa = PBXBuildFile; };
B14EF2862397E90400758AF0 /* MXRealmMediaScanStore.m in Sources */ = {isa = PBXBuildFile; fileRef = B146D4F521A5BB9F00D8C2C6 /* MXRealmMediaScanStore.m */; };
B14EF2872397E90400758AF0 /* MXPusherData.m in Sources */ = {isa = PBXBuildFile; fileRef = 32999DE222DCD1AD004FF987 /* MXPusherData.m */; };
B14EF2882397E90400758AF0 /* MXOlmDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 322A51C61D9BBD3C00C8536D /* MXOlmDevice.m */; };
Expand Down Expand Up @@ -1961,6 +1961,8 @@
ED8F1D352885B07500F897E7 /* MXCrossSigningInfoUnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED8F1D1628857FE600F897E7 /* MXCrossSigningInfoUnitTests.swift */; };
ED8F1D3B2885BB2D00F897E7 /* MXCryptoProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED8F1D3A2885BB2D00F897E7 /* MXCryptoProtocols.swift */; };
ED8F1D3C2885BB2D00F897E7 /* MXCryptoProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED8F1D3A2885BB2D00F897E7 /* MXCryptoProtocols.swift */; };
ED96F2BA294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED96F2B9294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift */; };
ED96F2BB294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED96F2B9294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift */; };
ED997856292E2877006B5248 /* MXSessionSyncProgressUnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED997855292E2877006B5248 /* MXSessionSyncProgressUnitTests.swift */; };
ED997857292E2877006B5248 /* MXSessionSyncProgressUnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED997855292E2877006B5248 /* MXSessionSyncProgressUnitTests.swift */; };
EDA2CDD628F5C4230088ACE7 /* MXQRCodeTransactionV2UnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDA2CDD528F5C4230088ACE7 /* MXQRCodeTransactionV2UnitTests.swift */; };
Expand All @@ -1969,10 +1971,10 @@
EDA69341290BA92E00223252 /* MXCryptoMachineUnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDA6933F290BA92E00223252 /* MXCryptoMachineUnitTests.swift */; };
EDAAC41928E2FCFE00DD89B5 /* MXCryptoSecretStoreV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDAAC41828E2FCFE00DD89B5 /* MXCryptoSecretStoreV2.swift */; };
EDAAC41A28E2FCFE00DD89B5 /* MXCryptoSecretStoreV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDAAC41828E2FCFE00DD89B5 /* MXCryptoSecretStoreV2.swift */; };
EDAAC41C28E30F3C00DD89B5 /* BuildFile in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Public, ); }; };
EDAAC41D28E30F3C00DD89B5 /* BuildFile in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Public, ); }; };
EDAAC41F28E30F4C00DD89B5 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
EDAAC42028E30F4C00DD89B5 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
EDAAC41C28E30F3C00DD89B5 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Public, ); }; };
EDAAC41D28E30F3C00DD89B5 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Public, ); }; };
EDAAC41F28E30F4C00DD89B5 /* (null) in Sources */ = {isa = PBXBuildFile; };
EDAAC42028E30F4C00DD89B5 /* (null) in Sources */ = {isa = PBXBuildFile; };
EDAAC42128E3174700DD89B5 /* MXCryptoSecretStore.h in Headers */ = {isa = PBXBuildFile; fileRef = EDAAC41228E2F86800DD89B5 /* MXCryptoSecretStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
EDAAC42228E3174700DD89B5 /* MXCryptoSecretStore.h in Headers */ = {isa = PBXBuildFile; fileRef = EDAAC41228E2F86800DD89B5 /* MXCryptoSecretStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
EDAAC42428E3177000DD89B5 /* MXRecoveryServiceDependencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDAAC42328E3177000DD89B5 /* MXRecoveryServiceDependencies.swift */; };
Expand Down Expand Up @@ -3099,6 +3101,7 @@
ED8F1D312885AC5700F897E7 /* Device+Stub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Device+Stub.swift"; sourceTree = "<group>"; };
ED8F1D332885ADE200F897E7 /* MXCryptoProtocolStubs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXCryptoProtocolStubs.swift; sourceTree = "<group>"; };
ED8F1D3A2885BB2D00F897E7 /* MXCryptoProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXCryptoProtocols.swift; sourceTree = "<group>"; };
ED96F2B9294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXDummyBackgroundCrypto.swift; sourceTree = "<group>"; };
ED997855292E2877006B5248 /* MXSessionSyncProgressUnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXSessionSyncProgressUnitTests.swift; sourceTree = "<group>"; };
EDA2CDD528F5C4230088ACE7 /* MXQRCodeTransactionV2UnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXQRCodeTransactionV2UnitTests.swift; sourceTree = "<group>"; };
EDA6933F290BA92E00223252 /* MXCryptoMachineUnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXCryptoMachineUnitTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5416,6 +5419,7 @@
ED4114E7292E496C00728459 /* MXBackgroundCrypto.swift */,
ED4114EA292E498100728459 /* MXBackgroundCryptoV2.swift */,
ED4114ED292E49C000728459 /* MXLegacyBackgroundCrypto.swift */,
ED96F2B9294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift */,
);
path = Crypto;
sourceTree = "<group>";
Expand Down Expand Up @@ -5764,7 +5768,7 @@
B146D47421A5945800D8C2C6 /* MXAntivirusScanStatus.h in Headers */,
322691361E5EFF8700966A6E /* MXDeviceListOperationsPool.h in Headers */,
3281E8B719E42DFE00976E1A /* MXJSONModel.h in Headers */,
EDAAC41C28E30F3C00DD89B5 /* BuildFile in Headers */,
EDAAC41C28E30F3C00DD89B5 /* (null) in Headers */,
B135066127E9CB6400BD3276 /* MXBeaconInfo.h in Headers */,
EC5C562827A36EDB0014CBE9 /* MXInReplyTo.h in Headers */,
EC8A539325B1BC77004E0802 /* MXCallSessionDescription.h in Headers */,
Expand Down Expand Up @@ -6388,7 +6392,7 @@
324AAC7E2399143400380A66 /* MXKeyVerificationCancel.h in Headers */,
ED01915528C64E0400ED3A69 /* MXRoomKeyEventContent.h in Headers */,
B14EF3372397E90400758AF0 /* MXRoomTombStoneContent.h in Headers */,
EDAAC41D28E30F3C00DD89B5 /* BuildFile in Headers */,
EDAAC41D28E30F3C00DD89B5 /* (null) in Headers */,
3274538B23FD918800438328 /* MXKeyVerificationByToDeviceRequest.h in Headers */,
B14EF3382397E90400758AF0 /* MXFilterObject.h in Headers */,
B14EF3392397E90400758AF0 /* MXRealmReactionCount.h in Headers */,
Expand Down Expand Up @@ -6997,6 +7001,7 @@
B19A30A0240424BD00FB6F35 /* MXQRCodeTransaction.m in Sources */,
C63E78B01F26588000AC692F /* MXRoomPowerLevels.swift in Sources */,
EC0B943F271DB68F00B4D440 /* MXVoidRoomSummaryStore.m in Sources */,
ED96F2BA294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift in Sources */,
EC383BA5253DE6C9002FBBE6 /* MXSyncResponseStore.swift in Sources */,
32CEEF4523AD2A6C0039BA98 /* MXCrossSigningKey.m in Sources */,
327E9AF02289C61100A98BC1 /* MXAggregations.m in Sources */,
Expand Down Expand Up @@ -7133,7 +7138,7 @@
324AAC73239913AD00380A66 /* MXKeyVerificationDone.m in Sources */,
ED6DABFC28C7542800ECDCB6 /* MXRoomKeyInfoFactory.swift in Sources */,
B11556EE230C45C600B2A2CF /* MXIdentityServerRestClient.swift in Sources */,
EDAAC41F28E30F4C00DD89B5 /* BuildFile in Sources */,
EDAAC41F28E30F4C00DD89B5 /* (null) in Sources */,
321CFDE722525A49004D31DF /* MXSASTransaction.m in Sources */,
EDDBA7F0293F353900AD1480 /* MXToDevicePayload.swift in Sources */,
32720D9D222EAA6F0086FFF5 /* MXDiscoveredClientConfig.m in Sources */,
Expand Down Expand Up @@ -7427,7 +7432,7 @@
EC1165B527107E330089FA56 /* MXStoreRoomListDataManager.swift in Sources */,
66836ABA27CFA17200515780 /* MXLiveEventListener.swift in Sources */,
B14EF1E52397E90400758AF0 /* MXLoginPolicy.m in Sources */,
B14EF1E62397E90400758AF0 /* BuildFile in Sources */,
B14EF1E62397E90400758AF0 /* (null) in Sources */,
B18D23F727ECF199004C4277 /* MXLocationService.swift in Sources */,
EC60EDB5265CFE6200B39A4E /* MXRoomSyncEphemeral.m in Sources */,
B14EF1E72397E90400758AF0 /* MXRoomThirdPartyInvite.m in Sources */,
Expand Down Expand Up @@ -7567,7 +7572,7 @@
B14EF21F2397E90400758AF0 /* MXMyUser.m in Sources */,
EDAAC42528E3177300DD89B5 /* MXRecoveryServiceDependencies.swift in Sources */,
EC60EDAB265CFE3B00B39A4E /* MXRoomSyncTimeline.m in Sources */,
B14EF2202397E90400758AF0 /* BuildFile in Sources */,
B14EF2202397E90400758AF0 /* (null) in Sources */,
ED647E3F292CE64400A47519 /* MXSessionSyncProgress.swift in Sources */,
B14EF2212397E90400758AF0 /* MX3PID.swift in Sources */,
18121F79273E6E4100B68ADF /* PollBuilder.swift in Sources */,
Expand Down Expand Up @@ -7605,7 +7610,7 @@
B18B0E6825FBDC3000E32151 /* MXSpace.swift in Sources */,
B14EF22D2397E90400758AF0 /* MXRealmReactionCount.m in Sources */,
B14EF22E2397E90400758AF0 /* MXCryptoTools.m in Sources */,
B14EF22F2397E90400758AF0 /* BuildFile in Sources */,
B14EF22F2397E90400758AF0 /* (null) in Sources */,
B14EF2302397E90400758AF0 /* MXDeviceListOperation.m in Sources */,
32C78B6B256CFC4D008130B1 /* MXCryptoMigration.m in Sources */,
ECDA763027B292B5000C48CF /* MXThreadModel.swift in Sources */,
Expand Down Expand Up @@ -7643,6 +7648,7 @@
EC8A539625B1BC77004E0802 /* MXUserModel.m in Sources */,
EC0B9440271DB68F00B4D440 /* MXVoidRoomSummaryStore.m in Sources */,
B14EF2402397E90400758AF0 /* MXSessionEventListener.m in Sources */,
ED96F2BB294A2E9A002DB8F6 /* MXDummyBackgroundCrypto.swift in Sources */,
EC8A53A625B1BC77004E0802 /* MXCallInviteEventContent.m in Sources */,
ECD2899226EB3B3400F268CF /* MXRoomListDataFetcher.swift in Sources */,
B18B0E5025FB783F00E32151 /* MXSpaceService.swift in Sources */,
Expand Down Expand Up @@ -7718,7 +7724,7 @@
B14EF25C2397E90400758AF0 /* MXRoomTombStoneContent.m in Sources */,
B1432B52282AB29A00737CA6 /* MXBeaconInfoSummaryAllRoomListener.swift in Sources */,
B14EF25D2397E90400758AF0 /* MXImage.swift in Sources */,
B14EF25E2397E90400758AF0 /* BuildFile in Sources */,
B14EF25E2397E90400758AF0 /* (null) in Sources */,
32B090E3261F709B002924AA /* MXAsyncTaskQueue.swift in Sources */,
B14EF25F2397E90400758AF0 /* MXServerNoticeContent.m in Sources */,
B1F04B112811E7B600103EBE /* MXBeaconInfoSummaryMemoryStore.swift in Sources */,
Expand Down Expand Up @@ -7779,7 +7785,7 @@
B14EF2772397E90400758AF0 /* MXDecryptionResult.m in Sources */,
ED6DABFD28C7542800ECDCB6 /* MXRoomKeyInfoFactory.swift in Sources */,
B14EF2782397E90400758AF0 /* MXTransactionCancelCode.m in Sources */,
EDAAC42028E30F4C00DD89B5 /* BuildFile in Sources */,
EDAAC42028E30F4C00DD89B5 /* (null) in Sources */,
B14EF2792397E90400758AF0 /* MXEventListener.m in Sources */,
EDDBA7F1293F353900AD1480 /* MXToDevicePayload.swift in Sources */,
B1710B202613D01400A9B429 /* MXSpaceChildrenRequestParameters.swift in Sources */,
Expand Down Expand Up @@ -7816,7 +7822,7 @@
EC60ED7E265CFCD100B39A4E /* MXDeviceListResponse.m in Sources */,
323F879025553D84009E9E67 /* MXTaskProfile.m in Sources */,
B14EF2842397E90400758AF0 /* MXUIKitBackgroundModeHandler.m in Sources */,
B14EF2852397E90400758AF0 /* BuildFile in Sources */,
B14EF2852397E90400758AF0 /* (null) in Sources */,
32A9F8E1244720B10069C65B /* MXThrottler.m in Sources */,
3274538D23FD918800438328 /* MXKeyVerificationByToDeviceRequest.m in Sources */,
32CEEF5223B0AB030039BA98 /* MXCrossSigning.m in Sources */,
Expand Down
44 changes: 44 additions & 0 deletions MatrixSDK/Background/Crypto/MXDummyBackgroundCrypto.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright 2022 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 Foundation

#if DEBUG

/// Dummy implementation of background crypto that does nothing and is unable
/// to decrypt notification.
///
/// Note: This is a temporary class to be used with foreground Crypto V2 which
/// is not currently multi-process safe and thus only one process can be
/// decrypting events.
class MXDummyBackgroundCrypto: MXBackgroundCrypto {
enum Error: Swift.Error {
case unableToDecrypt
}

func handleSyncResponse(_ syncResponse: MXSyncResponse) {
}

func canDecryptEvent(_ event: MXEvent) -> Bool {
false
}

func decryptEvent(_ event: MXEvent) throws {
throw Error.unableToDecrypt
}
}

#endif
22 changes: 9 additions & 13 deletions MatrixSDK/Background/MXBackgroundSyncService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,16 @@ public enum MXBackgroundSyncServiceError: Error {
// We can flush any crypto data if our sync response store is empty
let resetBackgroundCryptoStore = syncResponseStoreManager.syncToken() == nil

#if DEBUG
if MXSDKOptions.sharedInstance().enableCryptoV2 {
do {
crypto = try MXBackgroundCryptoV2(credentials: credentials, restClient: restClient)
} catch {
MXLog.failure("[MXBackgroundSyncService] init: Cannot initialize crypto v2", context: error)
crypto = MXLegacyBackgroundCrypto(credentials: credentials, resetBackgroundCryptoStore: resetBackgroundCryptoStore)
crypto = {
#if DEBUG
if MXSDKOptions.sharedInstance().enableCryptoV2 {
// Crypto V2 is currently unable to decrypt notifications due to single-process store,
// so it uses dummy background crypto that does not do anything.
return MXDummyBackgroundCrypto()
}
} else {
crypto = MXLegacyBackgroundCrypto(credentials: credentials, resetBackgroundCryptoStore: resetBackgroundCryptoStore)
}
#else
crypto = MXLegacyBackgroundCrypto(credentials: credentials, resetBackgroundCryptoStore: resetBackgroundCryptoStore)
#endif
#endif
return MXLegacyBackgroundCrypto(credentials: credentials, resetBackgroundCryptoStore: resetBackgroundCryptoStore)
}()

pushRulesManager = MXBackgroundPushRulesManager(withCredentials: credentials)
if let accountData = syncResponseStoreManager.syncResponseStore.accountData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ extension MXEventDecryptionResult {
senderCurve25519Key = event.senderCurve25519Key
claimedEd25519Key = event.claimedEd25519Key
forwardingCurve25519KeyChain = event.forwardingCurve25519Chain
isUntrusted = event.verificationState == VerificationState.untrusted

// `Untrusted` state from rust is currently ignored as it lacks "undecided" option,
// will be changed in a future PR into:
// isUntrusted = event.verificationState == VerificationState.untrusted
isUntrusted = false
}
}

Expand Down

0 comments on commit 710d5db

Please sign in to comment.