mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-11 13:59:13 +00:00
Remove Task.sleep from NotificationTests. (#1326)
- Add `weak` to mock variables called `delegate` - Delete `UserNotificationCenterSpy` and use `UserNotificationCenterMock` - Remove Task.sleep in favour of mock closures along with expectations/fulfillment.
This commit is contained in:
parent
dfdaee0563
commit
bf91e97c88
@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 51;
|
objectVersion = 54;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@ -26,7 +26,6 @@
|
|||||||
07240B7159A3990C4C2E8FFC /* LoginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D256FEE2F1AF1E51D39B622 /* LoginTests.swift */; };
|
07240B7159A3990C4C2E8FFC /* LoginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D256FEE2F1AF1E51D39B622 /* LoginTests.swift */; };
|
||||||
072BA9DBA932374CCA300125 /* MessageComposerTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6C10032A77AE7DC5AA4C50 /* MessageComposerTextField.swift */; };
|
072BA9DBA932374CCA300125 /* MessageComposerTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6C10032A77AE7DC5AA4C50 /* MessageComposerTextField.swift */; };
|
||||||
07756D532EFE33DD1FA258E5 /* GeoURITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A7ED2EF5BDBAD2A7DBC4636 /* GeoURITests.swift */; };
|
07756D532EFE33DD1FA258E5 /* GeoURITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A7ED2EF5BDBAD2A7DBC4636 /* GeoURITests.swift */; };
|
||||||
08248D02BACA75CDC3B39A96 /* UserNotificationCenterSpy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69219A908D7C22E6EE6689AE /* UserNotificationCenterSpy.swift */; };
|
|
||||||
095C0ACFC234E0550A6404C5 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FC803282F9268D49F4ABF14 /* AppCoordinator.swift */; };
|
095C0ACFC234E0550A6404C5 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FC803282F9268D49F4ABF14 /* AppCoordinator.swift */; };
|
||||||
095D3906CF2F940C2D2D17CC /* RoomFlowCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FCB2126C091EEF2454B4D56 /* RoomFlowCoordinatorTests.swift */; };
|
095D3906CF2F940C2D2D17CC /* RoomFlowCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FCB2126C091EEF2454B4D56 /* RoomFlowCoordinatorTests.swift */; };
|
||||||
09713669577CDA8D012EE380 /* MatrixRustSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 6647C55D93508C7CE9D954A5 /* MatrixRustSDK */; };
|
09713669577CDA8D012EE380 /* MatrixRustSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 6647C55D93508C7CE9D954A5 /* MatrixRustSDK */; };
|
||||||
@ -855,7 +854,7 @@
|
|||||||
127C8472672A5BA09EF1ACF8 /* CurrentValuePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentValuePublisher.swift; sourceTree = "<group>"; };
|
127C8472672A5BA09EF1ACF8 /* CurrentValuePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentValuePublisher.swift; sourceTree = "<group>"; };
|
||||||
12EDAFB64FA5F6812D54F39A /* MigrationScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationScreenViewModel.swift; sourceTree = "<group>"; };
|
12EDAFB64FA5F6812D54F39A /* MigrationScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationScreenViewModel.swift; sourceTree = "<group>"; };
|
||||||
12F1E7F9C2BE8BB751037826 /* WaitlistScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenCoordinator.swift; sourceTree = "<group>"; };
|
12F1E7F9C2BE8BB751037826 /* WaitlistScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||||
1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; path = IntegrationTests.xctestplan; sourceTree = "<group>"; };
|
1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = IntegrationTests.xctestplan; sourceTree = "<group>"; };
|
||||||
130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = "<group>"; };
|
130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = "<group>"; };
|
||||||
13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||||
1423AB065857FA546444DB15 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
|
1423AB065857FA546444DB15 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
|
||||||
@ -995,7 +994,7 @@
|
|||||||
47111410B6E659A697D472B5 /* RoomProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProxyProtocol.swift; sourceTree = "<group>"; };
|
47111410B6E659A697D472B5 /* RoomProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProxyProtocol.swift; sourceTree = "<group>"; };
|
||||||
471EB7D96AFEA8D787659686 /* EmoteRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineView.swift; sourceTree = "<group>"; };
|
471EB7D96AFEA8D787659686 /* EmoteRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineView.swift; sourceTree = "<group>"; };
|
||||||
47873756E45B46683D97DC32 /* LegalInformationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegalInformationScreenModels.swift; sourceTree = "<group>"; };
|
47873756E45B46683D97DC32 /* LegalInformationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegalInformationScreenModels.swift; sourceTree = "<group>"; };
|
||||||
478BE8591BD13E908EF70C0C /* DesignKit */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DesignKit; path = DesignKit; sourceTree = SOURCE_ROOT; };
|
478BE8591BD13E908EF70C0C /* DesignKit */ = {isa = PBXFileReference; lastKnownFileType = folder; path = DesignKit; sourceTree = SOURCE_ROOT; };
|
||||||
4798B3B7A1E8AE3901CEE8C6 /* FramePreferenceKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FramePreferenceKey.swift; sourceTree = "<group>"; };
|
4798B3B7A1E8AE3901CEE8C6 /* FramePreferenceKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FramePreferenceKey.swift; sourceTree = "<group>"; };
|
||||||
47EBB5D698CE9A25BB553A2D /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
|
47EBB5D698CE9A25BB553A2D /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
|
||||||
47F29139BC2A804CE5E0757E /* MediaUploadPreviewScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModel.swift; sourceTree = "<group>"; };
|
47F29139BC2A804CE5E0757E /* MediaUploadPreviewScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModel.swift; sourceTree = "<group>"; };
|
||||||
@ -1080,7 +1079,6 @@
|
|||||||
66F2402D738694F98729A441 /* RoomTimelineProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineProvider.swift; sourceTree = "<group>"; };
|
66F2402D738694F98729A441 /* RoomTimelineProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineProvider.swift; sourceTree = "<group>"; };
|
||||||
6861FE915C7B5466E6962BBA /* StartChatScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartChatScreen.swift; sourceTree = "<group>"; };
|
6861FE915C7B5466E6962BBA /* StartChatScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartChatScreen.swift; sourceTree = "<group>"; };
|
||||||
686BCFA37AC6C67FF973CE67 /* OnboardingBackgroundImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingBackgroundImage.swift; sourceTree = "<group>"; };
|
686BCFA37AC6C67FF973CE67 /* OnboardingBackgroundImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingBackgroundImage.swift; sourceTree = "<group>"; };
|
||||||
69219A908D7C22E6EE6689AE /* UserNotificationCenterSpy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserNotificationCenterSpy.swift; sourceTree = "<group>"; };
|
|
||||||
693E16574C6F7F9FA1015A8C /* Search.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Search.swift; sourceTree = "<group>"; };
|
693E16574C6F7F9FA1015A8C /* Search.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Search.swift; sourceTree = "<group>"; };
|
||||||
69B63F817FE305548DB4B512 /* RoomMembersListViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembersListViewModelTests.swift; sourceTree = "<group>"; };
|
69B63F817FE305548DB4B512 /* RoomMembersListViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembersListViewModelTests.swift; sourceTree = "<group>"; };
|
||||||
69CB8242D69B7E4D0B32E18D /* AggregatedReactionMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AggregatedReactionMock.swift; sourceTree = "<group>"; };
|
69CB8242D69B7E4D0B32E18D /* AggregatedReactionMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AggregatedReactionMock.swift; sourceTree = "<group>"; };
|
||||||
@ -1171,7 +1169,7 @@
|
|||||||
8D55702474F279D910D2D162 /* RoomStateEventStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateEventStringBuilder.swift; sourceTree = "<group>"; };
|
8D55702474F279D910D2D162 /* RoomStateEventStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateEventStringBuilder.swift; sourceTree = "<group>"; };
|
||||||
8D8169443E5AC5FF71BFB3DB /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = "<group>"; };
|
8D8169443E5AC5FF71BFB3DB /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
8DC2C9E0E15C79BBDA80F0A2 /* TimelineStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStyle.swift; sourceTree = "<group>"; };
|
8DC2C9E0E15C79BBDA80F0A2 /* TimelineStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStyle.swift; sourceTree = "<group>"; };
|
||||||
8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; path = UITests.xctestplan; sourceTree = "<group>"; };
|
8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = "<group>"; };
|
||||||
8E1BBA73B611EDEEA6E20E05 /* InvitesScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitesScreenModels.swift; sourceTree = "<group>"; };
|
8E1BBA73B611EDEEA6E20E05 /* InvitesScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitesScreenModels.swift; sourceTree = "<group>"; };
|
||||||
8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScreenUITests.swift; sourceTree = "<group>"; };
|
8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScreenUITests.swift; sourceTree = "<group>"; };
|
||||||
8F21ED7205048668BEB44A38 /* AppActivityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppActivityView.swift; sourceTree = "<group>"; };
|
8F21ED7205048668BEB44A38 /* AppActivityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppActivityView.swift; sourceTree = "<group>"; };
|
||||||
@ -1280,7 +1278,7 @@
|
|||||||
B4CFE236419E830E8946639C /* Analytics+SwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Analytics+SwiftUI.swift"; sourceTree = "<group>"; };
|
B4CFE236419E830E8946639C /* Analytics+SwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Analytics+SwiftUI.swift"; sourceTree = "<group>"; };
|
||||||
B590BD4507D4F0A377FDE01A /* LoadableAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableAvatarImage.swift; sourceTree = "<group>"; };
|
B590BD4507D4F0A377FDE01A /* LoadableAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableAvatarImage.swift; sourceTree = "<group>"; };
|
||||||
B5B243E7818E5E9F6A4EDC7A /* NoticeRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeRoomTimelineView.swift; sourceTree = "<group>"; };
|
B5B243E7818E5E9F6A4EDC7A /* NoticeRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeRoomTimelineView.swift; sourceTree = "<group>"; };
|
||||||
B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; path = ConfettiScene.scn; sourceTree = "<group>"; };
|
B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = ConfettiScene.scn; sourceTree = "<group>"; };
|
||||||
B6311F21F911E23BE4DF51B4 /* ReadMarkerRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadMarkerRoomTimelineView.swift; sourceTree = "<group>"; };
|
B6311F21F911E23BE4DF51B4 /* ReadMarkerRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadMarkerRoomTimelineView.swift; sourceTree = "<group>"; };
|
||||||
B697816AF93DA06EC58C5D70 /* WaitlistScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
B697816AF93DA06EC58C5D70 /* WaitlistScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||||
B6E89E530A8E92EC44301CA1 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
|
B6E89E530A8E92EC44301CA1 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
|
||||||
@ -1362,7 +1360,7 @@
|
|||||||
CD6B0C4639E066915B5E6463 /* target.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = target.yml; sourceTree = "<group>"; };
|
CD6B0C4639E066915B5E6463 /* target.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = target.yml; sourceTree = "<group>"; };
|
||||||
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = "<group>"; };
|
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = "<group>"; };
|
||||||
CEE0E6043EFCF6FD2A341861 /* TimelineReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineReplyView.swift; sourceTree = "<group>"; };
|
CEE0E6043EFCF6FD2A341861 /* TimelineReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineReplyView.swift; sourceTree = "<group>"; };
|
||||||
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = "<group>"; };
|
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = "<group>"; };
|
||||||
CF48AF076424DBC1615C74AD /* AuthenticationServiceProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationServiceProxy.swift; sourceTree = "<group>"; };
|
CF48AF076424DBC1615C74AD /* AuthenticationServiceProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationServiceProxy.swift; sourceTree = "<group>"; };
|
||||||
D0140615D2232612C813FD6C /* EncryptedHistoryRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptedHistoryRoomTimelineItem.swift; sourceTree = "<group>"; };
|
D0140615D2232612C813FD6C /* EncryptedHistoryRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptedHistoryRoomTimelineItem.swift; sourceTree = "<group>"; };
|
||||||
D071F86CD47582B9196C9D16 /* UserDiscoverySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDiscoverySection.swift; sourceTree = "<group>"; };
|
D071F86CD47582B9196C9D16 /* UserDiscoverySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDiscoverySection.swift; sourceTree = "<group>"; };
|
||||||
@ -1434,7 +1432,7 @@
|
|||||||
ECF79FB25E2D4BD6F50CE7C9 /* RoomMembersListScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembersListScreenViewModel.swift; sourceTree = "<group>"; };
|
ECF79FB25E2D4BD6F50CE7C9 /* RoomMembersListScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembersListScreenViewModel.swift; sourceTree = "<group>"; };
|
||||||
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = "<group>"; };
|
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = "<group>"; };
|
||||||
ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = "<group>"; };
|
ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = "<group>"; };
|
||||||
ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; path = message.caf; sourceTree = "<group>"; };
|
ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = message.caf; sourceTree = "<group>"; };
|
||||||
ED983D4DCA5AFA6E1ED96099 /* StateRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateRoomTimelineView.swift; sourceTree = "<group>"; };
|
ED983D4DCA5AFA6E1ED96099 /* StateRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateRoomTimelineView.swift; sourceTree = "<group>"; };
|
||||||
EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = "<group>"; };
|
EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = "<group>"; };
|
||||||
EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItemContent.swift; sourceTree = "<group>"; };
|
EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItemContent.swift; sourceTree = "<group>"; };
|
||||||
@ -2637,7 +2635,6 @@
|
|||||||
30ED584467DB380E3CEFB1DB /* NotificationManagerTests.swift */,
|
30ED584467DB380E3CEFB1DB /* NotificationManagerTests.swift */,
|
||||||
DC0AEA686E425F86F6BA0404 /* UNNotification+Creator.swift */,
|
DC0AEA686E425F86F6BA0404 /* UNNotification+Creator.swift */,
|
||||||
130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */,
|
130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */,
|
||||||
69219A908D7C22E6EE6689AE /* UserNotificationCenterSpy.swift */,
|
|
||||||
);
|
);
|
||||||
path = NotificationManager;
|
path = NotificationManager;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -4152,7 +4149,6 @@
|
|||||||
8D3E1FADD78E72504DE0E402 /* UserAgentBuilderTests.swift in Sources */,
|
8D3E1FADD78E72504DE0E402 /* UserAgentBuilderTests.swift in Sources */,
|
||||||
E313BDD2B8813144139B2E00 /* UserDiscoveryServiceTest.swift in Sources */,
|
E313BDD2B8813144139B2E00 /* UserDiscoveryServiceTest.swift in Sources */,
|
||||||
A1DF0E1E526A981ED6D5DF44 /* UserIndicatorControllerTests.swift in Sources */,
|
A1DF0E1E526A981ED6D5DF44 /* UserIndicatorControllerTests.swift in Sources */,
|
||||||
08248D02BACA75CDC3B39A96 /* UserNotificationCenterSpy.swift in Sources */,
|
|
||||||
04F17DE71A50206336749BAC /* UserPreferenceTests.swift in Sources */,
|
04F17DE71A50206336749BAC /* UserPreferenceTests.swift in Sources */,
|
||||||
81A7C020CB5F6232242A8414 /* UserSessionTests.swift in Sources */,
|
81A7C020CB5F6232242A8414 /* UserSessionTests.swift in Sources */,
|
||||||
99F8DA4CCC6772EE5FE68E24 /* ViewModelContext.swift in Sources */,
|
99F8DA4CCC6772EE5FE68E24 /* ViewModelContext.swift in Sources */,
|
||||||
|
@ -217,7 +217,7 @@ class NotificationCenterMock: NotificationCenterProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class NotificationManagerMock: NotificationManagerProtocol {
|
class NotificationManagerMock: NotificationManagerProtocol {
|
||||||
var delegate: NotificationManagerDelegate?
|
weak var delegate: NotificationManagerDelegate?
|
||||||
|
|
||||||
//MARK: - start
|
//MARK: - start
|
||||||
|
|
||||||
@ -1604,7 +1604,7 @@ class UserIndicatorControllerMock: UserIndicatorControllerProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class UserNotificationCenterMock: UserNotificationCenterProtocol {
|
class UserNotificationCenterMock: UserNotificationCenterProtocol {
|
||||||
var delegate: UNUserNotificationCenterDelegate?
|
weak var delegate: UNUserNotificationCenterDelegate?
|
||||||
|
|
||||||
//MARK: - add
|
//MARK: - add
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UserNotifications
|
import UserNotifications
|
||||||
|
|
||||||
// Sadly we can't mock this because the delegate needs to be weak
|
|
||||||
// Use UserNotificationCenterSpy
|
|
||||||
protocol UserNotificationCenterProtocol: AnyObject {
|
protocol UserNotificationCenterProtocol: AnyObject {
|
||||||
var delegate: UNUserNotificationCenterDelegate? { get set }
|
var delegate: UNUserNotificationCenterDelegate? { get set }
|
||||||
func add(_ request: UNNotificationRequest) async throws
|
func add(_ request: UNNotificationRequest) async throws
|
||||||
|
@ -117,7 +117,7 @@ import {{ import }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
{% macro mockOptionalVariable variable %}
|
{% macro mockOptionalVariable variable %}
|
||||||
{% call accessLevel variable.readAccess %}var {% call mockedVariableName variable %}: {{ variable.typeName }}
|
{% if variable.name == 'delegate' %}weak {% endif %}{% call accessLevel variable.readAccess %}var {% call mockedVariableName variable %}: {{ variable.typeName }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
{% macro mockNonOptionalArrayOrDictionaryVariable variable %}
|
{% macro mockNonOptionalArrayOrDictionaryVariable variable %}
|
||||||
{% call accessLevel variable.readAccess %}var {% call mockedVariableName variable %}: {{ variable.typeName }} = {% if variable.isArray %}[]{% elif variable.isDictionary %}[:]{% endif %}
|
{% call accessLevel variable.readAccess %}var {% call mockedVariableName variable %}: {{ variable.typeName }} = {% if variable.isArray %}[]{% elif variable.isDictionary %}[:]{% endif %}
|
||||||
|
@ -24,22 +24,28 @@ final class NotificationManagerTests: XCTestCase {
|
|||||||
var notificationManager: NotificationManager!
|
var notificationManager: NotificationManager!
|
||||||
private let clientProxy = MockClientProxy(userID: "@test:user.net")
|
private let clientProxy = MockClientProxy(userID: "@test:user.net")
|
||||||
private lazy var mockUserSession = MockUserSession(clientProxy: clientProxy, mediaProvider: MockMediaProvider())
|
private lazy var mockUserSession = MockUserSession(clientProxy: clientProxy, mediaProvider: MockMediaProvider())
|
||||||
private let notificationCenter = UserNotificationCenterSpy()
|
private var notificationCenter: UserNotificationCenterMock!
|
||||||
private var authorizationStatusWasGranted = false
|
private var authorizationStatusWasGranted = false
|
||||||
private var shouldDisplayInAppNotificationReturnValue = false
|
private var shouldDisplayInAppNotificationReturnValue = false
|
||||||
private var handleInlineReplyDelegateCalled = false
|
private var handleInlineReplyDelegateCalled = false
|
||||||
private var notificationTappedDelegateCalled = false
|
private var notificationTappedDelegateCalled = false
|
||||||
|
private var registerForRemoteNotificationsDelegateCalled: (() -> Void)?
|
||||||
|
|
||||||
private var appSettings: AppSettings { ServiceLocator.shared.settings }
|
private var appSettings: AppSettings { ServiceLocator.shared.settings }
|
||||||
|
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
AppSettings.reset()
|
AppSettings.reset()
|
||||||
|
notificationCenter = UserNotificationCenterMock()
|
||||||
notificationManager = NotificationManager(notificationCenter: notificationCenter, appSettings: appSettings)
|
notificationManager = NotificationManager(notificationCenter: notificationCenter, appSettings: appSettings)
|
||||||
notificationManager.start()
|
notificationManager.start()
|
||||||
notificationManager.setUserSession(mockUserSession)
|
notificationManager.setUserSession(mockUserSession)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func tearDown() {
|
||||||
|
notificationCenter = nil
|
||||||
|
notificationManager = nil
|
||||||
|
}
|
||||||
|
|
||||||
func test_whenRegistered_pusherIsCalled() async {
|
func test_whenRegistered_pusherIsCalled() async {
|
||||||
_ = await notificationManager.register(with: Data())
|
_ = await notificationManager.register(with: Data())
|
||||||
XCTAssertTrue(clientProxy.setPusherCalled)
|
XCTAssertTrue(clientProxy.setPusherCalled)
|
||||||
@ -96,7 +102,7 @@ final class NotificationManagerTests: XCTestCase {
|
|||||||
|
|
||||||
func test_whenShowLocalNotification_notificationRequestGetsAdded() async throws {
|
func test_whenShowLocalNotification_notificationRequestGetsAdded() async throws {
|
||||||
await notificationManager.showLocalNotification(with: "Title", subtitle: "Subtitle")
|
await notificationManager.showLocalNotification(with: "Title", subtitle: "Subtitle")
|
||||||
let request = try XCTUnwrap(notificationCenter.addRequest)
|
let request = try XCTUnwrap(notificationCenter.addReceivedRequest)
|
||||||
XCTAssertEqual(request.content.title, "Title")
|
XCTAssertEqual(request.content.title, "Title")
|
||||||
XCTAssertEqual(request.content.subtitle, "Subtitle")
|
XCTAssertEqual(request.content.subtitle, "Subtitle")
|
||||||
}
|
}
|
||||||
@ -113,7 +119,7 @@ final class NotificationManagerTests: XCTestCase {
|
|||||||
actions: [],
|
actions: [],
|
||||||
intentIdentifiers: [],
|
intentIdentifiers: [],
|
||||||
options: [])
|
options: [])
|
||||||
XCTAssertEqual(notificationCenter.notificationCategoriesValue, [messageCategory, inviteCategory])
|
XCTAssertEqual(notificationCenter.setNotificationCategoriesReceivedCategories, [messageCategory, inviteCategory])
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_whenStart_delegateIsSet() throws {
|
func test_whenStart_delegateIsSet() throws {
|
||||||
@ -122,18 +128,27 @@ final class NotificationManagerTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_whenStart_requestAuthorizationCalledWithCorrectParams() async throws {
|
func test_whenStart_requestAuthorizationCalledWithCorrectParams() async throws {
|
||||||
|
let expectation = expectation(description: "requestAuthorization should be called")
|
||||||
|
notificationCenter.requestAuthorizationOptionsClosure = { _ in
|
||||||
|
expectation.fulfill()
|
||||||
|
return true
|
||||||
|
}
|
||||||
notificationManager.requestAuthorization()
|
notificationManager.requestAuthorization()
|
||||||
try await Task.sleep(for: .milliseconds(100))
|
await fulfillment(of: [expectation])
|
||||||
XCTAssertEqual(notificationCenter.requestAuthorizationOptions, [.alert, .sound, .badge])
|
XCTAssertEqual(notificationCenter.requestAuthorizationOptionsReceivedOptions, [.alert, .sound, .badge])
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_whenStartAndAuthorizationGranted_delegateCalled() async throws {
|
func test_whenStartAndAuthorizationGranted_delegateCalled() async throws {
|
||||||
authorizationStatusWasGranted = false
|
authorizationStatusWasGranted = false
|
||||||
notificationCenter.requestAuthorizationGrantedReturnValue = true
|
notificationCenter.requestAuthorizationOptionsReturnValue = true
|
||||||
notificationManager.delegate = self
|
notificationManager.delegate = self
|
||||||
|
let expectation: XCTestExpectation = expectation(description: "registerForRemoteNotifications delegate function should be called")
|
||||||
|
expectation.assertForOverFulfill = false
|
||||||
|
registerForRemoteNotificationsDelegateCalled = {
|
||||||
|
expectation.fulfill()
|
||||||
|
}
|
||||||
notificationManager.requestAuthorization()
|
notificationManager.requestAuthorization()
|
||||||
try await Task.sleep(for: .milliseconds(100))
|
await fulfillment(of: [expectation])
|
||||||
XCTAssertTrue(authorizationStatusWasGranted)
|
XCTAssertTrue(authorizationStatusWasGranted)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,67 +194,51 @@ final class NotificationManagerTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_MessageNotificationsRemoval() async throws {
|
func test_MessageNotificationsRemoval() async throws {
|
||||||
let notificationPublisher = NotificationCenter.default.publisher(for: .roomMarkedAsRead).first()
|
notificationCenter.deliveredNotificationsClosure = {
|
||||||
var cancellables: Set<AnyCancellable> = .init()
|
XCTFail("deliveredNotifications should not be called if the object is nil or of the wrong type")
|
||||||
let expectation1 = expectation(description: #function)
|
return []
|
||||||
notificationPublisher
|
|
||||||
.sink { _ in
|
|
||||||
expectation1.fulfill()
|
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
|
||||||
|
|
||||||
// No interaction if the object is nil or of the wrong type
|
// No interaction if the object is nil or of the wrong type
|
||||||
NotificationCenter.default.post(name: .roomMarkedAsRead, object: nil)
|
NotificationCenter.default.post(name: .roomMarkedAsRead, object: nil)
|
||||||
await fulfillment(of: [expectation1])
|
|
||||||
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 0)
|
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 0)
|
||||||
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsCallsCount, 0)
|
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsWithIdentifiersCallsCount, 0)
|
||||||
|
|
||||||
let expectation2 = expectation(description: #function)
|
|
||||||
notificationPublisher
|
|
||||||
.sink { _ in
|
|
||||||
expectation2.fulfill()
|
|
||||||
}
|
|
||||||
.store(in: &cancellables)
|
|
||||||
|
|
||||||
NotificationCenter.default.post(name: .roomMarkedAsRead, object: 1)
|
NotificationCenter.default.post(name: .roomMarkedAsRead, object: 1)
|
||||||
await fulfillment(of: [expectation2])
|
|
||||||
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 0)
|
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 0)
|
||||||
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsCallsCount, 0)
|
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsWithIdentifiersCallsCount, 0)
|
||||||
|
|
||||||
let expectation3 = expectation(description: #function)
|
|
||||||
notificationPublisher
|
|
||||||
.sink { _ in
|
|
||||||
expectation3.fulfill()
|
|
||||||
}
|
|
||||||
.store(in: &cancellables)
|
|
||||||
|
|
||||||
// The center calls the delivered and the removal functions when an id is passed
|
// The center calls the delivered and the removal functions when an id is passed
|
||||||
NotificationCenter.default.post(name: .roomMarkedAsRead, object: "RoomID")
|
notificationCenter.deliveredNotificationsClosure = nil
|
||||||
await fulfillment(of: [expectation3])
|
notificationCenter.requestAuthorizationOptionsReturnValue = true
|
||||||
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 1)
|
notificationCenter.deliveredNotificationsReturnValue = []
|
||||||
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsCallsCount, 1)
|
let expectation = expectation(description: "Notification should be removed")
|
||||||
}
|
notificationCenter.removeDeliveredNotificationsWithIdentifiersClosure = { _ in
|
||||||
|
|
||||||
func test_InvitesNotificationsRemoval() async throws {
|
|
||||||
let notificationPublisher = NotificationCenter.default.publisher(for: .invitesScreenAppeared).first()
|
|
||||||
let expectation = expectation(description: #function)
|
|
||||||
var cancellables: Set<AnyCancellable> = .init()
|
|
||||||
notificationPublisher
|
|
||||||
.sink { _ in
|
|
||||||
expectation.fulfill()
|
expectation.fulfill()
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
NotificationCenter.default.post(name: .roomMarkedAsRead, object: "RoomID")
|
||||||
|
await fulfillment(of: [expectation])
|
||||||
|
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 1)
|
||||||
|
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsWithIdentifiersCallsCount, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func test_InvitesNotificationsRemoval() async {
|
||||||
|
let expectation = expectation(description: "Notification should be removed")
|
||||||
|
notificationCenter.requestAuthorizationOptionsReturnValue = true
|
||||||
|
notificationCenter.deliveredNotificationsReturnValue = []
|
||||||
|
notificationCenter.removeDeliveredNotificationsWithIdentifiersClosure = { _ in
|
||||||
|
expectation.fulfill()
|
||||||
|
}
|
||||||
NotificationCenter.default.post(name: .invitesScreenAppeared, object: nil)
|
NotificationCenter.default.post(name: .invitesScreenAppeared, object: nil)
|
||||||
await fulfillment(of: [expectation])
|
await fulfillment(of: [expectation])
|
||||||
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 1)
|
XCTAssertEqual(notificationCenter.deliveredNotificationsCallsCount, 1)
|
||||||
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsCallsCount, 1)
|
XCTAssertEqual(notificationCenter.removeDeliveredNotificationsWithIdentifiersCallsCount, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NotificationManagerTests: NotificationManagerDelegate {
|
extension NotificationManagerTests: NotificationManagerDelegate {
|
||||||
func registerForRemoteNotifications() {
|
func registerForRemoteNotifications() {
|
||||||
authorizationStatusWasGranted = true
|
authorizationStatusWasGranted = true
|
||||||
|
registerForRemoteNotificationsDelegateCalled?()
|
||||||
}
|
}
|
||||||
|
|
||||||
func unregisterForRemoteNotifications() {
|
func unregisterForRemoteNotifications() {
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright 2022 New Vector Ltd
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
@testable import ElementX
|
|
||||||
import Foundation
|
|
||||||
import UserNotifications
|
|
||||||
|
|
||||||
final class UserNotificationCenterSpy: UserNotificationCenterProtocol {
|
|
||||||
weak var delegate: UNUserNotificationCenterDelegate?
|
|
||||||
|
|
||||||
var deliveredNotificationsCallsCount = 0
|
|
||||||
func deliveredNotifications() async -> [UNNotification] {
|
|
||||||
deliveredNotificationsCallsCount += 1
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
var removeDeliveredNotificationsCallsCount = 0
|
|
||||||
func removeDeliveredNotifications(withIdentifiers identifiers: [String]) {
|
|
||||||
removeDeliveredNotificationsCallsCount += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
var addRequest: UNNotificationRequest?
|
|
||||||
func add(_ request: UNNotificationRequest) async throws {
|
|
||||||
addRequest = request
|
|
||||||
}
|
|
||||||
|
|
||||||
var requestAuthorizationOptions: UNAuthorizationOptions?
|
|
||||||
var requestAuthorizationGrantedReturnValue = false
|
|
||||||
func requestAuthorization(options: UNAuthorizationOptions) async throws -> Bool {
|
|
||||||
requestAuthorizationOptions = options
|
|
||||||
return requestAuthorizationGrantedReturnValue
|
|
||||||
}
|
|
||||||
|
|
||||||
var notificationCategoriesValue: Set<UNNotificationCategory>?
|
|
||||||
func setNotificationCategories(_ categories: Set<UNNotificationCategory>) {
|
|
||||||
notificationCategoriesValue = categories
|
|
||||||
}
|
|
||||||
|
|
||||||
var authorizationStatusValue: UNAuthorizationStatus?
|
|
||||||
func authorizationStatus() async -> UNAuthorizationStatus {
|
|
||||||
authorizationStatusValue ?? UNAuthorizationStatus.denied
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user