mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add share link in start chat flow (#926)
This commit is contained in:
@@ -71,9 +71,6 @@ struct HomeScreenViewState: BindableState {
|
||||
var rooms: [HomeScreenRoom] = []
|
||||
var roomListMode: HomeScreenRoomListMode = .skeletons
|
||||
|
||||
/// The URL that will be shared when inviting friends to use the app.
|
||||
let invitePermalink: URL?
|
||||
|
||||
var hasPendingInvitations = false
|
||||
var hasUnreadPendingInvitations = false
|
||||
|
||||
|
||||
@@ -40,8 +40,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
allRoomsSummaryProvider = userSession.clientProxy.allRoomsSummaryProvider
|
||||
invitesSummaryProvider = userSession.clientProxy.invitesSummaryProvider
|
||||
|
||||
let invitePermalink = try? PermalinkBuilder.permalinkTo(userIdentifier: userSession.userID)
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID, invitePermalink: invitePermalink),
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID),
|
||||
imageProvider: userSession.mediaProvider)
|
||||
|
||||
userSession.callbacks
|
||||
|
||||
@@ -139,10 +139,8 @@ struct HomeScreen: View {
|
||||
}
|
||||
}
|
||||
Section {
|
||||
if let permalink = context.viewState.invitePermalink {
|
||||
ShareLink(item: permalink) {
|
||||
Label(L10n.actionInvite, systemImage: "square.and.arrow.up")
|
||||
}
|
||||
MatrixUserShareLink(userID: context.viewState.userID) {
|
||||
Label(L10n.actionInvite, systemImage: "square.and.arrow.up")
|
||||
}
|
||||
Button(action: feedback) {
|
||||
Label(L10n.commonReportABug, systemImage: "questionmark.circle")
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user