Skip to content

Commit

Permalink
pr suggestions and updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Feb 5, 2025
1 parent 70920f9 commit 662eeab
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct RoomMemberDetailsScreenViewStateBindings {

var ignoreUserAlert: IgnoreUserAlertItem?
var alertInfo: AlertInfo<RoomMemberDetailsScreenAlertType>?
var sheetItem: UserProfileProxy?
var inviteConfirmationUser: UserProfileProxy?

/// A media item that will be previewed with QuickLook.
var mediaPreviewItem: MediaPreviewItem?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro
if let roomID {
actionsSubject.send(.openDirectChat(roomID: roomID))
} else {
state.bindings.sheetItem = .init(userID: roomMemberProxy.userID, displayName: roomMemberProxy.displayName, avatarURL: roomMemberProxy.avatarURL)
state.bindings.inviteConfirmationUser = .init(userID: roomMemberProxy.userID, displayName: roomMemberProxy.displayName, avatarURL: roomMemberProxy.avatarURL)
}
case .failure:
state.bindings.alertInfo = .init(id: .failedOpeningDirectChat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct RoomMemberDetailsScreen: View {
.navigationTitle(L10n.screenRoomMemberDetailsTitle)
.alert(item: $context.ignoreUserAlert, actions: blockUserAlertActions, message: blockUserAlertMessage)
.alert(item: $context.alertInfo)
.sheet(item: $context.sheetItem) { user in
.sheet(item: $context.inviteConfirmationUser) { user in
SendInviteConfirmationView(userToInvite: user,
mediaProvider: context.mediaProvider) {
context.send(viewAction: .createDirectChat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct SendInviteConfirmationView: View {
@State private var sheetHeight: CGFloat = .zero
private let topPadding: CGFloat = 24

var subtitle: String {
private var subtitle: String {
if let displayName = userToInvite.displayName {
L10n.screenBottomSheetCreateDmMessage(displayName, userToInvite.userID)
} else {
Expand Down Expand Up @@ -89,7 +89,7 @@ struct SendInviteConfirmationView: View {

struct SendInviteConfirmationView_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
SendInviteConfirmationView(userToInvite: .mockAlice,
SendInviteConfirmationView(userToInvite: .mockBob,
mediaProvider: nil) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct UserProfileScreenViewState: BindableState {

struct UserProfileScreenViewStateBindings {
var alertInfo: AlertInfo<UserProfileScreenAlertType>?
var sheetItem: UserProfileProxy?
var inviteConfirmationUser: UserProfileProxy?

/// A media item that will be previewed with QuickLook.
var mediaPreviewItem: MediaPreviewItem?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr
if let roomID {
actionsSubject.send(.openDirectChat(roomID: roomID))
} else {
state.bindings.sheetItem = userProfile
state.bindings.inviteConfirmationUser = userProfile
}
case .failure:
state.bindings.alertInfo = .init(id: .failedOpeningDirectChat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct UserProfileScreen: View {
.navigationBarTitleDisplayMode(.inline)
.toolbar { toolbar }
.alert(item: $context.alertInfo)
.sheet(item: $context.sheetItem) { user in
.sheet(item: $context.inviteConfirmationUser) { user in
SendInviteConfirmationView(userToInvite: user,
mediaProvider: context.mediaProvider) {
context.send(viewAction: .createDirectChat)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 662eeab

Please sign in to comment.