mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Removed unused context menu + some unused code cleaning (#2487)
This commit is contained in:
@@ -333,8 +333,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
case (.pollForm, .dismissPollForm, .room):
|
||||
break
|
||||
|
||||
case (.roomDetails(let roomID, _), .presentPollsHistory, .pollsHistory):
|
||||
presentPollsHistory(roomID: roomID)
|
||||
case (.roomDetails, .presentPollsHistory, .pollsHistory):
|
||||
presentPollsHistory()
|
||||
case (.pollsHistory, .dismissPollsHistory, .roomDetails):
|
||||
break
|
||||
|
||||
@@ -880,7 +880,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
private func presentPollsHistory(roomID: String) {
|
||||
private func presentPollsHistory() {
|
||||
Task {
|
||||
await asyncPresentRoomPollsHistory()
|
||||
}
|
||||
|
||||
@@ -9,32 +9,32 @@ import Foundation
|
||||
|
||||
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
|
||||
// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces
|
||||
public enum UntranslatedL10n {
|
||||
internal enum UntranslatedL10n {
|
||||
/// Clear all data currently stored on this device?
|
||||
/// Sign in again to access your account data and messages.
|
||||
public static var softLogoutClearDataDialogContent: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_dialog_content") }
|
||||
internal static var softLogoutClearDataDialogContent: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_dialog_content") }
|
||||
/// Clear data
|
||||
public static var softLogoutClearDataDialogTitle: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_dialog_title") }
|
||||
internal static var softLogoutClearDataDialogTitle: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_dialog_title") }
|
||||
/// Warning: Your personal data (including encryption keys) is still stored on this device.
|
||||
///
|
||||
/// Clear it if you’re finished using this device, or want to sign in to another account.
|
||||
public static var softLogoutClearDataNotice: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_notice") }
|
||||
internal static var softLogoutClearDataNotice: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_notice") }
|
||||
/// Clear all data
|
||||
public static var softLogoutClearDataSubmit: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_submit") }
|
||||
internal static var softLogoutClearDataSubmit: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_submit") }
|
||||
/// Clear personal data
|
||||
public static var softLogoutClearDataTitle: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_title") }
|
||||
internal static var softLogoutClearDataTitle: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_clear_data_title") }
|
||||
/// Sign in to recover encryption keys stored exclusively on this device. You need them to read all of your secure messages on any device.
|
||||
public static var softLogoutSigninE2eWarningNotice: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_signin_e2e_warning_notice") }
|
||||
internal static var softLogoutSigninE2eWarningNotice: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_signin_e2e_warning_notice") }
|
||||
/// Your homeserver (%1$s) admin has signed you out of your account %2$s (%3$s).
|
||||
public static func softLogoutSigninNotice(_ p1: UnsafePointer<CChar>, _ p2: UnsafePointer<CChar>, _ p3: UnsafePointer<CChar>) -> String {
|
||||
internal static func softLogoutSigninNotice(_ p1: UnsafePointer<CChar>, _ p2: UnsafePointer<CChar>, _ p3: UnsafePointer<CChar>) -> String {
|
||||
return UntranslatedL10n.tr("Untranslated", "soft_logout_signin_notice", p1, p2, p3)
|
||||
}
|
||||
/// Sign in
|
||||
public static var softLogoutSigninTitle: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_signin_title") }
|
||||
internal static var softLogoutSigninTitle: String { return UntranslatedL10n.tr("Untranslated", "soft_logout_signin_title") }
|
||||
/// Untranslated
|
||||
public static var untranslated: String { return UntranslatedL10n.tr("Untranslated", "untranslated") }
|
||||
internal static var untranslated: String { return UntranslatedL10n.tr("Untranslated", "untranslated") }
|
||||
/// Plural format key: "%#@VARIABLE@"
|
||||
public static func untranslatedPlural(_ p1: Int) -> String {
|
||||
internal static func untranslatedPlural(_ p1: Int) -> String {
|
||||
return UntranslatedL10n.tr("Untranslated", "untranslated_plural", p1)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,27 +35,7 @@ extension Character {
|
||||
}
|
||||
|
||||
extension String {
|
||||
var isSingleEmoji: Bool {
|
||||
count == 1 && containsEmoji
|
||||
}
|
||||
|
||||
var containsEmoji: Bool {
|
||||
contains { $0.isEmoji }
|
||||
}
|
||||
|
||||
var containsOnlyEmoji: Bool {
|
||||
!isEmpty && !contains { !$0.isEmoji }
|
||||
}
|
||||
|
||||
var emojiString: String {
|
||||
emojis.map { String($0) }.reduce("", +)
|
||||
}
|
||||
|
||||
var emojis: [Character] {
|
||||
filter(\.isEmoji)
|
||||
}
|
||||
|
||||
var emojiScalars: [UnicodeScalar] {
|
||||
filter(\.isEmoji).flatMap(\.unicodeScalars)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import SwiftUI
|
||||
struct LocationMarkerView: View {
|
||||
private let pinColor: Color = .compound.iconOnSolidPrimary
|
||||
private let pinInsets = EdgeInsets(top: 13, leading: 12, bottom: 15, trailing: 12)
|
||||
private let buttonScale: Double = 28 / 52
|
||||
|
||||
var body: some View {
|
||||
CompoundIcon(\.locationPinSolid)
|
||||
|
||||
@@ -384,6 +384,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
#endif
|
||||
}
|
||||
|
||||
// periphery:ignore:parameters notification
|
||||
@objc private func hardwareKeyboardDidConnect(_ notification: Notification) {
|
||||
MXLog.info("Did connect hardware keyboard")
|
||||
state.bindings.composerFocused = true
|
||||
|
||||
@@ -32,17 +32,12 @@ enum HomeScreenViewModelAction {
|
||||
case logout
|
||||
}
|
||||
|
||||
enum HomeScreenViewUserMenuAction {
|
||||
case settings
|
||||
case logout
|
||||
}
|
||||
|
||||
enum HomeScreenViewAction {
|
||||
case selectRoom(roomIdentifier: String)
|
||||
case showRoomDetails(roomIdentifier: String)
|
||||
case leaveRoom(roomIdentifier: String)
|
||||
case confirmLeaveRoom(roomIdentifier: String)
|
||||
case userMenu(action: HomeScreenViewUserMenuAction)
|
||||
case showSettings
|
||||
case startChat
|
||||
case verifySession
|
||||
case confirmRecoveryKey
|
||||
|
||||
@@ -159,13 +159,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
startLeaveRoomProcess(roomId: roomIdentifier)
|
||||
case .confirmLeaveRoom(roomIdentifier: let roomIdentifier):
|
||||
leaveRoom(roomId: roomIdentifier)
|
||||
case .userMenu(let action):
|
||||
switch action {
|
||||
case .settings:
|
||||
actionsSubject.send(.presentSettingsScreen)
|
||||
case .logout:
|
||||
actionsSubject.send(.logout)
|
||||
}
|
||||
case .showSettings:
|
||||
actionsSubject.send(.presentSettingsScreen)
|
||||
case .verifySession:
|
||||
actionsSubject.send(.presentSessionVerificationScreen)
|
||||
case .confirmRecoveryKey:
|
||||
|
||||
@@ -140,7 +140,19 @@ struct HomeScreen: View {
|
||||
@ToolbarContentBuilder
|
||||
private var toolbar: some ToolbarContent {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
HomeScreenUserMenuButton(context: context)
|
||||
Button {
|
||||
context.send(viewAction: .showSettings)
|
||||
} label: {
|
||||
LoadableAvatarImage(url: context.viewState.userAvatarURL,
|
||||
name: context.viewState.userDisplayName,
|
||||
contentID: context.viewState.userID,
|
||||
avatarSize: .user(on: .home),
|
||||
imageProvider: context.imageProvider)
|
||||
.accessibilityIdentifier(A11yIdentifiers.homeScreen.userAvatar)
|
||||
.overlayBadge(10, isBadged: context.viewState.requiresExtraAccountSetup)
|
||||
.compositingGroup()
|
||||
}
|
||||
.accessibilityLabel(L10n.commonSettings)
|
||||
}
|
||||
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// Copyright 2023 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 Compound
|
||||
import SwiftUI
|
||||
|
||||
struct HomeScreenUserMenuButton: View {
|
||||
@ObservedObject var context: HomeScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
Menu {
|
||||
Section {
|
||||
Button {
|
||||
context.send(viewAction: .userMenu(action: .settings))
|
||||
} label: {
|
||||
Label {
|
||||
Text(L10n.commonSettings)
|
||||
} icon: {
|
||||
if context.viewState.requiresExtraAccountSetup {
|
||||
CompoundIcon(asset: Asset.Images.settingsIconWithBadge)
|
||||
} else {
|
||||
CompoundIcon(\.settings)
|
||||
}
|
||||
}
|
||||
}
|
||||
.accessibilityIdentifier(A11yIdentifiers.homeScreen.settings)
|
||||
Button(role: .destructive) {
|
||||
context.send(viewAction: .userMenu(action: .logout))
|
||||
} label: {
|
||||
Label(L10n.screenSignoutPreferenceItem, icon: \.signOut)
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
LoadableAvatarImage(url: context.viewState.userAvatarURL,
|
||||
name: context.viewState.userDisplayName,
|
||||
contentID: context.viewState.userID,
|
||||
avatarSize: .user(on: .home),
|
||||
imageProvider: context.imageProvider)
|
||||
.accessibilityIdentifier(A11yIdentifiers.homeScreen.userAvatar)
|
||||
.overlayBadge(10, isBadged: context.viewState.requiresExtraAccountSetup)
|
||||
.compositingGroup()
|
||||
}
|
||||
.accessibilityLabel(L10n.a11yUserMenu)
|
||||
}
|
||||
}
|
||||
@@ -410,16 +410,6 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func getIsFavourite() async -> Result<Bool, RoomProxyError> {
|
||||
do {
|
||||
let result = try await room.roomInfo().isFavourite
|
||||
return .success(result)
|
||||
} catch {
|
||||
MXLog.error("Failed retrieving isFavourite for room: \(id) with error: \(error)")
|
||||
return .failure(.failedRetrievingIsFavourite)
|
||||
}
|
||||
}
|
||||
|
||||
func flagAsFavourite(_ isFavourite: Bool) async -> Result<Void, RoomProxyError> {
|
||||
do {
|
||||
try await room.setIsFavourite(isFavourite: isFavourite, tagOrder: nil)
|
||||
|
||||
@@ -34,7 +34,6 @@ enum RoomProxyError: Error, Equatable {
|
||||
case failedFlaggingAsUnread
|
||||
case failedMarkingAsRead
|
||||
case failedSendingTypingNotice
|
||||
case failedRetrievingIsFavourite
|
||||
case failedFlaggingAsFavourite
|
||||
}
|
||||
|
||||
|
||||
@@ -42,9 +42,7 @@ enum SecureBackupControllerError: Error {
|
||||
|
||||
case failedGeneratingRecoveryKey
|
||||
case failedConfirmingRecoveryKey
|
||||
|
||||
case failedFetchingSessionState
|
||||
|
||||
|
||||
case failedUploadingForBackup
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ class UserSession: UserSessionProtocol {
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
private var checkSessionVerificationStateCancellable: AnyCancellable?
|
||||
private var retrieveSessionVerificationControllerTask: Task<Void, Never>?
|
||||
|
||||
private var authErrorCancellable: AnyCancellable?
|
||||
|
||||
Reference in New Issue
Block a user