From f02a5c7ac022e7c7ac289e50e5a36bdf524417a6 Mon Sep 17 00:00:00 2001 From: Mauro <34335419+Velin92@users.noreply.github.com> Date: Thu, 6 Apr 2023 18:40:27 +0200 Subject: [PATCH] Removing the about section title + Fix notification tap crash (#778) * Removing the about section title updated tests * fixed a bug that made the app crash when tapping a notification in an unhandled state * missing screenshots --- .../Sources/Application/AppCoordinator.swift | 2 +- .../Application/Navigation/AppRouter.swift | 21 ++++++++++ .../RoomDetails/View/RoomDetailsScreen.swift | 40 +++++++++---------- .../UserSessionFlowCoordinator.swift | 13 +++++- ...-iPad-9th-generation.roomDetailsScreen.png | 4 +- ...ration.roomDetailsScreenWithRoomAvatar.png | 4 +- .../en-GB-iPhone-14.roomDetailsScreen.png | 4 +- ...B-iPhone-14.roomDetailsScreenDmDetails.png | 4 +- ...one-14.roomDetailsScreenWithRoomAvatar.png | 4 +- ...-iPad-9th-generation.roomDetailsScreen.png | 4 +- ...ration.roomDetailsScreenWithRoomAvatar.png | 4 +- .../pseudo-iPhone-14.roomDetailsScreen.png | 4 +- ...o-iPhone-14.roomDetailsScreenDmDetails.png | 4 +- ...one-14.roomDetailsScreenWithRoomAvatar.png | 4 +- changelog.d/777.change | 1 + changelog.d/779.bugfix | 1 + 16 files changed, 74 insertions(+), 44 deletions(-) create mode 100644 ElementX/Sources/Application/Navigation/AppRouter.swift create mode 100644 changelog.d/777.change create mode 100644 changelog.d/779.bugfix diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 27ace8f30..53b5f6bb5 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -476,7 +476,7 @@ extension AppCoordinator: NotificationManagerDelegate { return } - userSessionFlowCoordinator?.tryDisplayingRoomScreen(roomId: content.threadIdentifier) + userSessionFlowCoordinator?.handleAppRoute(.room(roomID: content.threadIdentifier)) } func handleInlineReply(_ service: NotificationManagerProtocol, content: UNNotificationContent, replyText: String) async { diff --git a/ElementX/Sources/Application/Navigation/AppRouter.swift b/ElementX/Sources/Application/Navigation/AppRouter.swift new file mode 100644 index 000000000..56aa256c5 --- /dev/null +++ b/ElementX/Sources/Application/Navigation/AppRouter.swift @@ -0,0 +1,21 @@ +// +// Copyright 2023 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. +// + +import Foundation + +enum AppRoute { + case room(roomID: String) +} diff --git a/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift b/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift index c754870d8..ec4ba2508 100644 --- a/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomDetails/View/RoomDetailsScreen.swift @@ -33,9 +33,7 @@ struct RoomDetailsScreen: View { aboutSection } - if context.viewState.isEncrypted { - securitySection - } + securitySection if let recipient = context.viewState.dmRecipient { ignoreUserSection(user: recipient) @@ -134,31 +132,31 @@ struct RoomDetailsScreen: View { .foregroundColor(.element.primaryContent) .accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.people) .disabled(context.viewState.isLoadingMembers) - } header: { - Text(L10n.commonAbout) - .formSectionHeader() } .formSectionStyle() } - + + @ViewBuilder private var securitySection: some View { - Section { - Label { - VStack(alignment: .leading, spacing: 2) { - Text(L10n.screenRoomDetailsEncryptionEnabledTitle) - Text(L10n.screenRoomDetailsEncryptionEnabledSubtitle) - .foregroundColor(.element.secondaryContent) - .font(.element.footnote) + if context.viewState.isEncrypted { + Section { + Label { + VStack(alignment: .leading, spacing: 2) { + Text(L10n.screenRoomDetailsEncryptionEnabledTitle) + Text(L10n.screenRoomDetailsEncryptionEnabledSubtitle) + .foregroundColor(.element.secondaryContent) + .font(.element.footnote) + } + } icon: { + Image(systemName: "lock.shield") } - } icon: { - Image(systemName: "lock.shield") + .labelStyle(FormRowLabelStyle(alignment: .top)) + } header: { + Text(L10n.commonSecurity) + .formSectionHeader() } - .labelStyle(FormRowLabelStyle(alignment: .top)) - } header: { - Text(L10n.commonSecurity) - .formSectionHeader() + .formSectionStyle() } - .formSectionStyle() } private var leaveRoomSection: some View { diff --git a/ElementX/Sources/Services/UserSession/UserSessionFlowCoordinator.swift b/ElementX/Sources/Services/UserSession/UserSessionFlowCoordinator.swift index 9cfab4c17..5c9e216df 100644 --- a/ElementX/Sources/Services/UserSession/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/Services/UserSession/UserSessionFlowCoordinator.swift @@ -62,8 +62,17 @@ class UserSessionFlowCoordinator: CoordinatorProtocol { stateMachine.isDisplayingRoomScreen(withRoomId: roomId) } - func tryDisplayingRoomScreen(roomId: String) { - stateMachine.processEvent(.selectRoom(roomId: roomId)) + func handleAppRoute(_ appRoute: AppRoute) { + switch stateMachine.state { + case .feedbackScreen, .sessionVerificationScreen, .settingsScreen, .startChatScreen: + navigationSplitCoordinator.setSheetCoordinator(nil) + case .roomList, .initial: + break + } + switch appRoute { + case .room(let roomID): + stateMachine.processEvent(.selectRoom(roomId: roomID)) + } } // MARK: - Private diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreen.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreen.png index d20ca35d6..88c4768cc 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreen.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreen.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d5f9d688c774c2679d1983fd8037dc7debaa0bbd28f7f650b1514217c260716e -size 93293 +oid sha256:d8dc5290ca66f80d4dc4dd29a710900436d22d2769bbbee627edac08f6ec2fe7 +size 91846 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png index aafadd918..41bb4a84d 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b75ac39d2873f3f3fe9bda9a9a3633a560362ee80033d096b729e45016e27c92 -size 118161 +oid sha256:dc13ff8cd8e0c43adab1851d2f1949cfb2f28c9f677c184bd9b95781b211a800 +size 112715 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreen.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreen.png index 1224fa66f..6ea34656d 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreen.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreen.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:033280d48071d0b5a854644014137a00214e2bfe485c036f0fe4447176523224 -size 115555 +oid sha256:ebb283b4d6ec4b1e30c7bc01c5739c2e8e9b953df11f3896e3da1cb37b58cfad +size 112688 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenDmDetails.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenDmDetails.png index 2bedb62d4..98a21540b 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenDmDetails.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenDmDetails.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b5d36a079c35934f91cfa81e1f2a567571cd0c66ff32babb3f83d8aa15ff3afb -size 122338 +oid sha256:99f9a46a131e99939687a82a67933d27e28aa6a2f0cbf43a7b445e132e914bf2 +size 124688 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenWithRoomAvatar.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenWithRoomAvatar.png index c3130802c..0529a563d 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenWithRoomAvatar.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.roomDetailsScreenWithRoomAvatar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c3177c3e71c57b6ae7fc1d7e9cc8605e56c57d975d5d4005d3f11332388e93a -size 150100 +oid sha256:9d5446fdae425126ded77944453319630d024392c885ada9f1666aa770f5a707 +size 143708 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreen.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreen.png index 90971d343..374b810b8 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreen.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreen.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d16839e452b90d87b40115a9a544c83c90f50c18d5ea35e0f281f25dc8f8c34b -size 107317 +oid sha256:b92f9049ce37ca4ce10886b2ce4a81716c392fca7cfcd63df9669b3f94c2a7af +size 104736 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png index 8ac1fc106..3ec01d003 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.roomDetailsScreenWithRoomAvatar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ffdfd356bf1aac98e8e8d7954c408708863ff0baf1735b5e5f2601666f89064 -size 133654 +oid sha256:db16ea2b9d9be2e6da949a7a96bbecd15a861498c6cea8463a45356edbd691bd +size 126070 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreen.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreen.png index 83237afe0..576c79acb 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreen.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreen.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a495a6a59176c4bf9899c5f681b80d01896e01bdb362669a1395bf9c5e610133 -size 144412 +oid sha256:13abe117809fd725937f78aeb7ccd706cd548e3f4887606c7e1b76872f3a98cd +size 142700 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenDmDetails.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenDmDetails.png index 79c050084..3c885bb5f 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenDmDetails.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenDmDetails.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb47ad82f2952d130e17fe3c99871e83782bc573f01317fcd55cf1ffbf53f0f0 -size 154477 +oid sha256:6ac11000d5f7b037570a6040e5d46a15aa7050ef7f18e6ea57ceb57b0989ae66 +size 330389 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenWithRoomAvatar.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenWithRoomAvatar.png index a2a964049..ecc9407f9 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenWithRoomAvatar.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.roomDetailsScreenWithRoomAvatar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39ab4130f4662ba11b3bdc5efb0a257b5f30ae73047c86201dffd78473a7618b -size 183006 +oid sha256:08a7d1ff7eaef9577afad4e51032d853ff2ec6f316d77fb710a7e4e10a269554 +size 173343 diff --git a/changelog.d/777.change b/changelog.d/777.change new file mode 100644 index 000000000..3dd21a63f --- /dev/null +++ b/changelog.d/777.change @@ -0,0 +1 @@ +Removed the about title copy from the people section. diff --git a/changelog.d/779.bugfix b/changelog.d/779.bugfix new file mode 100644 index 000000000..16d1b0c2b --- /dev/null +++ b/changelog.d/779.bugfix @@ -0,0 +1 @@ +Fixed a bug that crashed the app when tapping on push notifications while the app was in some specific unhandled screens. \ No newline at end of file