mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
A few small tweaks. (#774)
- Use ShareLink instead of InviteFriendsCoordinator. - Fix a string in the user menu - Show the word Notification as the notification's body. --------- Co-authored-by: Mauro <34335419+Velin92@users.noreply.github.com>
This commit is contained in:
@@ -57,8 +57,6 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
|
||||
self.callback?(.presentFeedbackScreen)
|
||||
case .presentSettingsScreen:
|
||||
self.callback?(.presentSettingsScreen)
|
||||
case .presentInviteFriendsScreen:
|
||||
self.presentInviteFriends()
|
||||
case .presentSessionVerificationScreen:
|
||||
self.callback?(.presentSessionVerificationScreen)
|
||||
case .signOut:
|
||||
@@ -82,10 +80,4 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
|
||||
func toPresentable() -> AnyView {
|
||||
AnyView(HomeScreen(context: viewModel.context))
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func presentInviteFriends() {
|
||||
parameters.navigationStackCoordinator.setSheetCoordinator(InviteFriendsCoordinator(userId: parameters.userSession.userID))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ enum HomeScreenViewModelAction {
|
||||
case presentRoom(roomIdentifier: String)
|
||||
case presentSessionVerificationScreen
|
||||
case presentSettingsScreen
|
||||
case presentInviteFriendsScreen
|
||||
case presentFeedbackScreen
|
||||
case presentStartChatScreen
|
||||
case signOut
|
||||
@@ -30,7 +29,6 @@ enum HomeScreenViewModelAction {
|
||||
|
||||
enum HomeScreenViewUserMenuAction {
|
||||
case settings
|
||||
case inviteFriends
|
||||
case feedback
|
||||
case signOut
|
||||
}
|
||||
@@ -59,7 +57,7 @@ enum HomeScreenRoomListMode: CustomStringConvertible {
|
||||
}
|
||||
|
||||
struct HomeScreenViewState: BindableState {
|
||||
var userID: String
|
||||
let userID: String
|
||||
var userDisplayName: String?
|
||||
var userAvatarURL: URL?
|
||||
|
||||
@@ -69,6 +67,9 @@ struct HomeScreenViewState: BindableState {
|
||||
|
||||
var roomListMode: HomeScreenRoomListMode = .skeletons
|
||||
|
||||
/// The URL that will be shared when inviting friends to use the app.
|
||||
let invitePermalink: URL?
|
||||
|
||||
var startChatFlowEnabled: Bool {
|
||||
ServiceLocator.shared.settings.startChatFlowEnabled
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
visibleRoomsSummaryProvider = userSession.clientProxy.visibleRoomsSummaryProvider
|
||||
allRoomsSummaryProvider = userSession.clientProxy.allRoomsSummaryProvider
|
||||
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID),
|
||||
let invitePermalink = try? PermalinkBuilder.permalinkTo(userIdentifier: userSession.userID)
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID, invitePermalink: invitePermalink),
|
||||
imageProvider: userSession.mediaProvider)
|
||||
|
||||
userSession.callbacks
|
||||
@@ -143,8 +144,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
callback?(.presentFeedbackScreen)
|
||||
case .settings:
|
||||
callback?(.presentSettingsScreen)
|
||||
case .inviteFriends:
|
||||
callback?(.presentInviteFriendsScreen)
|
||||
case .signOut:
|
||||
callback?(.signOut)
|
||||
}
|
||||
|
||||
@@ -122,11 +122,13 @@ struct HomeScreen: View {
|
||||
}
|
||||
}
|
||||
Section {
|
||||
Button(action: inviteFriends) {
|
||||
Label(L10n.actionInvite, systemImage: "square.and.arrow.up")
|
||||
if let permalink = context.viewState.invitePermalink {
|
||||
ShareLink(item: permalink) {
|
||||
Label(L10n.actionInvite, systemImage: "square.and.arrow.up")
|
||||
}
|
||||
}
|
||||
Button(action: feedback) {
|
||||
Label(L10n.actionReportBug, systemImage: "questionmark.circle")
|
||||
Label(L10n.commonReportABug, systemImage: "questionmark.circle")
|
||||
}
|
||||
}
|
||||
Section {
|
||||
@@ -201,10 +203,6 @@ struct HomeScreen: View {
|
||||
context.send(viewAction: .userMenu(action: .settings))
|
||||
}
|
||||
|
||||
private func inviteFriends() {
|
||||
context.send(viewAction: .userMenu(action: .inviteFriends))
|
||||
}
|
||||
|
||||
private func startChat() {
|
||||
context.send(viewAction: .startChat)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user