mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +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)
|
self.callback?(.presentFeedbackScreen)
|
||||||
case .presentSettingsScreen:
|
case .presentSettingsScreen:
|
||||||
self.callback?(.presentSettingsScreen)
|
self.callback?(.presentSettingsScreen)
|
||||||
case .presentInviteFriendsScreen:
|
|
||||||
self.presentInviteFriends()
|
|
||||||
case .presentSessionVerificationScreen:
|
case .presentSessionVerificationScreen:
|
||||||
self.callback?(.presentSessionVerificationScreen)
|
self.callback?(.presentSessionVerificationScreen)
|
||||||
case .signOut:
|
case .signOut:
|
||||||
@@ -82,10 +80,4 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
|
|||||||
func toPresentable() -> AnyView {
|
func toPresentable() -> AnyView {
|
||||||
AnyView(HomeScreen(context: viewModel.context))
|
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 presentRoom(roomIdentifier: String)
|
||||||
case presentSessionVerificationScreen
|
case presentSessionVerificationScreen
|
||||||
case presentSettingsScreen
|
case presentSettingsScreen
|
||||||
case presentInviteFriendsScreen
|
|
||||||
case presentFeedbackScreen
|
case presentFeedbackScreen
|
||||||
case presentStartChatScreen
|
case presentStartChatScreen
|
||||||
case signOut
|
case signOut
|
||||||
@@ -30,7 +29,6 @@ enum HomeScreenViewModelAction {
|
|||||||
|
|
||||||
enum HomeScreenViewUserMenuAction {
|
enum HomeScreenViewUserMenuAction {
|
||||||
case settings
|
case settings
|
||||||
case inviteFriends
|
|
||||||
case feedback
|
case feedback
|
||||||
case signOut
|
case signOut
|
||||||
}
|
}
|
||||||
@@ -59,7 +57,7 @@ enum HomeScreenRoomListMode: CustomStringConvertible {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct HomeScreenViewState: BindableState {
|
struct HomeScreenViewState: BindableState {
|
||||||
var userID: String
|
let userID: String
|
||||||
var userDisplayName: String?
|
var userDisplayName: String?
|
||||||
var userAvatarURL: URL?
|
var userAvatarURL: URL?
|
||||||
|
|
||||||
@@ -69,6 +67,9 @@ struct HomeScreenViewState: BindableState {
|
|||||||
|
|
||||||
var roomListMode: HomeScreenRoomListMode = .skeletons
|
var roomListMode: HomeScreenRoomListMode = .skeletons
|
||||||
|
|
||||||
|
/// The URL that will be shared when inviting friends to use the app.
|
||||||
|
let invitePermalink: URL?
|
||||||
|
|
||||||
var startChatFlowEnabled: Bool {
|
var startChatFlowEnabled: Bool {
|
||||||
ServiceLocator.shared.settings.startChatFlowEnabled
|
ServiceLocator.shared.settings.startChatFlowEnabled
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
visibleRoomsSummaryProvider = userSession.clientProxy.visibleRoomsSummaryProvider
|
visibleRoomsSummaryProvider = userSession.clientProxy.visibleRoomsSummaryProvider
|
||||||
allRoomsSummaryProvider = userSession.clientProxy.allRoomsSummaryProvider
|
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)
|
imageProvider: userSession.mediaProvider)
|
||||||
|
|
||||||
userSession.callbacks
|
userSession.callbacks
|
||||||
@@ -143,8 +144,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
callback?(.presentFeedbackScreen)
|
callback?(.presentFeedbackScreen)
|
||||||
case .settings:
|
case .settings:
|
||||||
callback?(.presentSettingsScreen)
|
callback?(.presentSettingsScreen)
|
||||||
case .inviteFriends:
|
|
||||||
callback?(.presentInviteFriendsScreen)
|
|
||||||
case .signOut:
|
case .signOut:
|
||||||
callback?(.signOut)
|
callback?(.signOut)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,11 +122,13 @@ struct HomeScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section {
|
Section {
|
||||||
Button(action: inviteFriends) {
|
if let permalink = context.viewState.invitePermalink {
|
||||||
Label(L10n.actionInvite, systemImage: "square.and.arrow.up")
|
ShareLink(item: permalink) {
|
||||||
|
Label(L10n.actionInvite, systemImage: "square.and.arrow.up")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Button(action: feedback) {
|
Button(action: feedback) {
|
||||||
Label(L10n.actionReportBug, systemImage: "questionmark.circle")
|
Label(L10n.commonReportABug, systemImage: "questionmark.circle")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section {
|
Section {
|
||||||
@@ -201,10 +203,6 @@ struct HomeScreen: View {
|
|||||||
context.send(viewAction: .userMenu(action: .settings))
|
context.send(viewAction: .userMenu(action: .settings))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func inviteFriends() {
|
|
||||||
context.send(viewAction: .userMenu(action: .inviteFriends))
|
|
||||||
}
|
|
||||||
|
|
||||||
private func startChat() {
|
private func startChat() {
|
||||||
context.send(viewAction: .startChat)
|
context.send(viewAction: .startChat)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright 2022 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 SwiftUI
|
|
||||||
|
|
||||||
class InviteFriendsCoordinator: CoordinatorProtocol {
|
|
||||||
let userId: String
|
|
||||||
|
|
||||||
init(userId: String) {
|
|
||||||
self.userId = userId
|
|
||||||
}
|
|
||||||
|
|
||||||
func toPresentable() -> AnyView {
|
|
||||||
guard let permalink = try? PermalinkBuilder.permalinkTo(userIdentifier: userId).absoluteString else {
|
|
||||||
return AnyView(EmptyView())
|
|
||||||
}
|
|
||||||
let shareText = L10n.inviteFriendsText(InfoPlistReader.main.bundleDisplayName, permalink)
|
|
||||||
|
|
||||||
return AnyView(UIActivityViewControllerWrapper(activityItems: [shareText])
|
|
||||||
.presentationDetents([.medium])
|
|
||||||
.ignoresSafeArea())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -56,7 +56,7 @@ struct NotificationItemProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var subtitle: String? {
|
var subtitle: String? {
|
||||||
L10n.notification
|
nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var isNoisy: Bool {
|
var isNoisy: Bool {
|
||||||
|
|||||||
@@ -73,8 +73,9 @@ extension NotificationItemProxy {
|
|||||||
// return nil
|
// return nil
|
||||||
// }
|
// }
|
||||||
// For now we can't solve the sender ID nor get the type of message that we are displaying
|
// For now we can't solve the sender ID nor get the type of message that we are displaying
|
||||||
// so we are just going to process all of them as common
|
// so we are just going to process all of them as a text notification saying "Notification"
|
||||||
try await processCommon(senderId: "undefined", roomId: roomId, mediaProvider: mediaProvider)
|
let content = TextMessageContent(body: L10n.notification, formatted: nil)
|
||||||
|
return try await processText(content: content, senderId: "undefined", roomId: roomId, mediaProvider: mediaProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|||||||
Reference in New Issue
Block a user