mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
show alert when trying to accept invalid invites
This commit is contained in:
@@ -325,6 +325,7 @@
|
|||||||
"emoji_picker_category_people" = "Smileys & People";
|
"emoji_picker_category_people" = "Smileys & People";
|
||||||
"emoji_picker_category_places" = "Travel & Places";
|
"emoji_picker_category_places" = "Travel & Places";
|
||||||
"emoji_picker_category_symbols" = "Symbols";
|
"emoji_picker_category_symbols" = "Symbols";
|
||||||
|
"error_invalid_invite" = "The room no longer exists or the invite is no longer valid.";
|
||||||
"error_network_or_server_issue" = "This may be due to network or server issues.";
|
"error_network_or_server_issue" = "This may be due to network or server issues.";
|
||||||
"error_room_address_already_exists" = "This room address already exists. Please try editing the room address field or change the room name";
|
"error_room_address_already_exists" = "This room address already exists. Please try editing the room address field or change the room name";
|
||||||
"error_room_address_invalid_symbols" = "Some characters are not allowed. Only letters, digits and the following symbols are supported ! $ & ‘ ( ) * + / ; = ? @ [ ] - . _";
|
"error_room_address_invalid_symbols" = "Some characters are not allowed. Only letters, digits and the following symbols are supported ! $ & ‘ ( ) * + / ; = ? @ [ ] - . _";
|
||||||
@@ -359,7 +360,7 @@
|
|||||||
"notification_channel_noisy" = "Noisy notifications";
|
"notification_channel_noisy" = "Noisy notifications";
|
||||||
"notification_channel_ringing_calls" = "Ringing calls";
|
"notification_channel_ringing_calls" = "Ringing calls";
|
||||||
"notification_channel_silent" = "Silent notifications";
|
"notification_channel_silent" = "Silent notifications";
|
||||||
"notification_fallback_content" = "You have new message(s).";
|
"notification_fallback_content" = "You have new messages.";
|
||||||
"notification_incoming_call" = "📹 Incoming call";
|
"notification_incoming_call" = "📹 Incoming call";
|
||||||
"notification_inline_reply_failed" = "** Failed to send - please open room";
|
"notification_inline_reply_failed" = "** Failed to send - please open room";
|
||||||
"notification_invite_body" = "Invited you to chat";
|
"notification_invite_body" = "Invited you to chat";
|
||||||
|
|||||||
@@ -774,6 +774,8 @@ internal enum L10n {
|
|||||||
}
|
}
|
||||||
/// Failed to upload your voice message.
|
/// Failed to upload your voice message.
|
||||||
internal static var errorFailedUploadingVoiceMessage: String { return L10n.tr("Localizable", "error_failed_uploading_voice_message") }
|
internal static var errorFailedUploadingVoiceMessage: String { return L10n.tr("Localizable", "error_failed_uploading_voice_message") }
|
||||||
|
/// The room no longer exists or the invite is no longer valid.
|
||||||
|
internal static var errorInvalidInvite: String { return L10n.tr("Localizable", "error_invalid_invite") }
|
||||||
/// Message not found
|
/// Message not found
|
||||||
internal static var errorMessageNotFound: String { return L10n.tr("Localizable", "error_message_not_found") }
|
internal static var errorMessageNotFound: String { return L10n.tr("Localizable", "error_message_not_found") }
|
||||||
/// This may be due to network or server issues.
|
/// This may be due to network or server issues.
|
||||||
@@ -846,7 +848,7 @@ internal enum L10n {
|
|||||||
internal static func notificationCompatSummaryTitle(_ p1: Int) -> String {
|
internal static func notificationCompatSummaryTitle(_ p1: Int) -> String {
|
||||||
return L10n.tr("Localizable", "notification_compat_summary_title", p1)
|
return L10n.tr("Localizable", "notification_compat_summary_title", p1)
|
||||||
}
|
}
|
||||||
/// You have new message(s).
|
/// You have new messages.
|
||||||
internal static var notificationFallbackContent: String { return L10n.tr("Localizable", "notification_fallback_content") }
|
internal static var notificationFallbackContent: String { return L10n.tr("Localizable", "notification_fallback_content") }
|
||||||
/// 📹 Incoming call
|
/// 📹 Incoming call
|
||||||
internal static var notificationIncomingCall: String { return L10n.tr("Localizable", "notification_incoming_call") }
|
internal static var notificationIncomingCall: String { return L10n.tr("Localizable", "notification_incoming_call") }
|
||||||
|
|||||||
@@ -416,8 +416,13 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
isSpace: roomProxy.info.isSpace,
|
isSpace: roomProxy.info.isSpace,
|
||||||
activeMemberCount: UInt(roomProxy.info.activeMembersCount))
|
activeMemberCount: UInt(roomProxy.info.activeMembersCount))
|
||||||
appSettings.seenInvites.remove(roomID)
|
appSettings.seenInvites.remove(roomID)
|
||||||
case .failure:
|
case .failure(let error):
|
||||||
displayError()
|
switch error {
|
||||||
|
case .invalidInvite:
|
||||||
|
displayError(title: L10n.dialogTitleError, message: L10n.errorInvalidInvite)
|
||||||
|
default:
|
||||||
|
displayError()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,9 +479,9 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func displayError() {
|
private func displayError(title: String? = nil, message: String? = nil) {
|
||||||
state.bindings.alertInfo = .init(id: UUID(),
|
state.bindings.alertInfo = .init(id: UUID(),
|
||||||
title: L10n.commonError,
|
title: title ?? L10n.commonError,
|
||||||
message: L10n.errorUnknown)
|
message: message ?? L10n.errorUnknown)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ enum JoinRoomScreenAlertType {
|
|||||||
case declineInviteAndBlock
|
case declineInviteAndBlock
|
||||||
case cancelKnock
|
case cancelKnock
|
||||||
case loadingError
|
case loadingError
|
||||||
|
case invalidInvite
|
||||||
}
|
}
|
||||||
|
|
||||||
enum JoinRoomScreenViewAction {
|
enum JoinRoomScreenViewAction {
|
||||||
|
|||||||
@@ -246,10 +246,14 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
|||||||
appSettings.seenInvites.remove(roomID)
|
appSettings.seenInvites.remove(roomID)
|
||||||
actionsSubject.send(.joined)
|
actionsSubject.send(.joined)
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
if case .forbiddenAccess = error {
|
switch error {
|
||||||
|
case .forbiddenAccess:
|
||||||
MXLog.error("Failed joining room alias: \(alias) forbidden access")
|
MXLog.error("Failed joining room alias: \(alias) forbidden access")
|
||||||
state.mode = .forbidden
|
state.mode = .forbidden
|
||||||
} else {
|
case .invalidInvite:
|
||||||
|
MXLog.error("Failed joining room alias: \(alias) invalid invite")
|
||||||
|
state.bindings.alertInfo = .init(id: .invalidInvite, title: L10n.dialogTitleError, message: L10n.errorInvalidInvite)
|
||||||
|
default:
|
||||||
MXLog.error("Failed joining room alias: \(alias) with error: \(error)")
|
MXLog.error("Failed joining room alias: \(alias) with error: \(error)")
|
||||||
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
|
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
|
||||||
}
|
}
|
||||||
@@ -260,10 +264,14 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
|||||||
appSettings.seenInvites.remove(roomID)
|
appSettings.seenInvites.remove(roomID)
|
||||||
actionsSubject.send(.joined)
|
actionsSubject.send(.joined)
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
if case .forbiddenAccess = error {
|
switch error {
|
||||||
|
case .forbiddenAccess:
|
||||||
MXLog.error("Failed joining room id: \(roomID) forbidden access")
|
MXLog.error("Failed joining room id: \(roomID) forbidden access")
|
||||||
state.mode = .forbidden
|
state.mode = .forbidden
|
||||||
} else {
|
case .invalidInvite:
|
||||||
|
MXLog.error("Failed joining room id: \(roomID) invalid invite")
|
||||||
|
state.bindings.alertInfo = .init(id: .invalidInvite, title: L10n.dialogTitleError, message: L10n.errorInvalidInvite)
|
||||||
|
default:
|
||||||
MXLog.error("Failed joining room id: \(roomID) with error: \(error)")
|
MXLog.error("Failed joining room id: \(roomID) with error: \(error)")
|
||||||
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
|
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -467,8 +467,11 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
await waitForRoomToSync(roomID: roomID, timeout: .seconds(30))
|
await waitForRoomToSync(roomID: roomID, timeout: .seconds(30))
|
||||||
|
|
||||||
return .success(())
|
return .success(())
|
||||||
|
} catch ClientError.MatrixApi(kind: .unknown, _, _, _) {
|
||||||
|
MXLog.error("Failed joining roomID: \(roomID) invalid invite")
|
||||||
|
return .failure(.invalidInvite)
|
||||||
} catch ClientError.MatrixApi(.forbidden, _, _, _) {
|
} catch ClientError.MatrixApi(.forbidden, _, _, _) {
|
||||||
MXLog.error("Failed joining roomAlias: \(roomID) forbidden")
|
MXLog.error("Failed joining roomID: \(roomID) forbidden")
|
||||||
return .failure(.forbiddenAccess)
|
return .failure(.forbiddenAccess)
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("Failed joining roomID: \(roomID) with error: \(error)")
|
MXLog.error("Failed joining roomID: \(roomID) with error: \(error)")
|
||||||
@@ -483,6 +486,9 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
await waitForRoomToSync(roomID: room.id(), timeout: .seconds(30))
|
await waitForRoomToSync(roomID: room.id(), timeout: .seconds(30))
|
||||||
|
|
||||||
return .success(())
|
return .success(())
|
||||||
|
} catch ClientError.MatrixApi(kind: .unknown, _, _, _) {
|
||||||
|
MXLog.error("Failed joining roomAlias: \(roomAlias) invalid invite")
|
||||||
|
return .failure(.invalidInvite)
|
||||||
} catch ClientError.MatrixApi(.forbidden, _, _, _) {
|
} catch ClientError.MatrixApi(.forbidden, _, _, _) {
|
||||||
MXLog.error("Failed joining roomAlias: \(roomAlias) forbidden")
|
MXLog.error("Failed joining roomAlias: \(roomAlias) forbidden")
|
||||||
return .failure(.forbiddenAccess)
|
return .failure(.forbiddenAccess)
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ enum ClientProxyError: Error {
|
|||||||
case failedRetrievingUserIdentity
|
case failedRetrievingUserIdentity
|
||||||
case failedResolvingRoomAlias
|
case failedResolvingRoomAlias
|
||||||
case roomNotInLocalStore
|
case roomNotInLocalStore
|
||||||
|
case invalidInvite
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SlidingSyncConstants {
|
enum SlidingSyncConstants {
|
||||||
|
|||||||
Reference in New Issue
Block a user