Add share link in start chat flow (#926)

This commit is contained in:
Alfonso Grillo
2023-05-19 17:34:35 +02:00
committed by GitHub
parent 35d7f1f893
commit d15ed1f6a3
8 changed files with 60 additions and 25 deletions
@@ -28,6 +28,7 @@ enum StartChatScreenViewModelAction {
}
struct StartChatScreenViewState: BindableState {
let userID: String
var bindings = StartChatScreenViewStateBindings()
var usersSection: UserDiscoverySection = .init(type: .suggestions, users: [])
@@ -50,6 +51,5 @@ struct StartChatScreenViewStateBindings {
enum StartChatScreenViewAction {
case close
case createRoom
case inviteFriends
case selectUser(UserProfile)
}
@@ -34,7 +34,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
self.userSession = userSession
self.userIndicatorController = userIndicatorController
self.userDiscoveryService = userDiscoveryService
super.init(initialViewState: StartChatScreenViewState(), imageProvider: userSession.mediaProvider)
super.init(initialViewState: StartChatScreenViewState(userID: userSession.userID), imageProvider: userSession.mediaProvider)
setupBindings()
}
@@ -47,8 +47,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
actionsSubject.send(.close)
case .createRoom:
actionsSubject.send(.createRoom)
case .inviteFriends:
break
case .selectUser(let user):
showLoadingIndicator()
Task {
@@ -74,7 +74,7 @@ struct StartChatScreen: View {
private var inviteFriendsSection: some View {
Section {
Button(action: inviteFriends) {
MatrixUserShareLink(userID: context.viewState.userID) {
Label(L10n.actionInviteFriendsToApp(InfoPlistReader.main.bundleDisplayName), systemImage: "square.and.arrow.up")
}
.buttonStyle(FormButtonStyle())
@@ -121,10 +121,6 @@ struct StartChatScreen: View {
context.send(viewAction: .createRoom)
}
private func inviteFriends() {
context.send(viewAction: .inviteFriends)
}
private func close() {
context.send(viewAction: .close)
}