diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 04d0cd693..c1b97f791 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -1522,7 +1522,7 @@ Tap the + to start adding people."; "device_verification_cancelled_by_me" = "The verification has been cancelled. Reason: %@"; "device_verification_error_cannot_load_device" = "Cannot load session information."; -// Mark: Incoming +// MARK: Incoming "device_verification_incoming_title" = "Incoming Verification Request"; "device_verification_incoming_description_1" = "Verify this session to mark it as trusted. Trusting sessions of partners gives you extra peace of mind when using end-to-end encrypted messages."; "device_verification_incoming_description_2" = "Verifying this session will mark it as trusted, and also mark your session as trusted to the partner."; @@ -2011,12 +2011,12 @@ Tap the + to start adding people."; "share_invite_link_room_text" = "Hey, join this room on %@"; "share_invite_link_space_text" = "Hey, join this space on %@"; -// Mark: - Room avatar view +// MARK: - Room avatar view "room_avatar_view_accessibility_label" = "avatar"; "room_avatar_view_accessibility_hint" = "Change room avatar"; -// Mark: - Room creation introduction cell +// MARK: - Room creation introduction cell "room_intro_cell_add_participants_action" = "Add people"; @@ -2033,7 +2033,7 @@ Tap the + to start adding people."; "room_intro_cell_information_dm_sentence2" = "Only the two of you are in this conversation, no one else can join."; "room_intro_cell_information_multiple_dm_sentence2" = "Only you are in this conversation, unless any of you invites someone to join."; -// Mark: - Room invite +// MARK: - Room invite "room_invite_to_space_option_title" = "To %@"; "room_invite_to_space_option_detail" = "They can explore %@, but won’t be a member of %@."; @@ -2042,7 +2042,7 @@ Tap the + to start adding people."; "room_invite_not_enough_permission" = "You do not have permission to invite people to this room"; "space_invite_not_enough_permission" = "You do not have permission to invite people to this space"; -// Mark: - Spaces +// MARK: - Spaces "space_feature_unavailable_title" = "Spaces aren’t here yet"; "space_feature_unavailable_subtitle" = "Spaces aren't on iOS yet, but you can use them now on Web and Desktop"; @@ -2099,7 +2099,7 @@ Tap the + to start adding people."; "spaces_feature_not_available" = "This feature isn't available here. For now, you can do this with %@ on your computer."; -// Mark: - Space Creation +// MARK: - Space Creation "spaces_creation_hint" = "Spaces are a new way to group rooms and people."; "spaces_creation_visibility_title" = "What type of space do you want to create?"; @@ -2158,7 +2158,7 @@ Tap the + to start adding people."; "spaces_add_room_missing_permission_message" = "You do not have permissions to add rooms to this space."; -// Mark: Leave space +// MARK: Leave space "leave_space_action" = "Leave space"; "leave_space_and_one_room" = "Leave space and 1 room"; @@ -2171,17 +2171,17 @@ Tap the + to start adding people."; "room_event_action_reaction_more" = "%@ more"; -// Mark: Avatar +// MARK: Avatar "space_avatar_view_accessibility_label" = "avatar"; "space_avatar_view_accessibility_hint" = "Change space avatar"; -// Mark: - User avatar view +// MARK: - User avatar view "user_avatar_view_accessibility_label" = "avatar"; "user_avatar_view_accessibility_hint" = "Change user avatar"; -// Mark: - Side menu +// MARK: - Side menu "side_menu_reveal_action_accessibility_label" = "Left panel"; "side_menu_action_invite_friends" = "Invite friends"; @@ -2191,7 +2191,7 @@ Tap the + to start adding people."; "side_menu_app_version" = "Version %@"; "side_menu_coach_message" = "Swipe right or tap to see all rooms"; -// Mark: - Voice Messages +// MARK: - Voice Messages "voice_message_release_to_send" = "Hold to record, release to send"; "voice_message_remaining_recording_time" = "%@s left"; @@ -2200,7 +2200,7 @@ Tap the + to start adding people."; "voice_message_broadcast_in_progress_title" = "Can't start voice message"; "voice_message_broadcast_in_progress_message" = "You can't start a voice message as you are currently recording a live broadcast. Please end your live broadcast in order to start recording a voice message"; -// Mark: - Voice broadcast +// MARK: - Voice Broadcast "voice_broadcast_unauthorized_title" = "Can't start a new voice broadcast"; "voice_broadcast_permission_denied_message" = "You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions."; "voice_broadcast_blocked_by_someone_else_message" = "Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one."; @@ -2213,8 +2213,10 @@ Tap the + to start adding people."; "voice_broadcast_stop_alert_title" = "Stop live broadcasting?"; "voice_broadcast_stop_alert_description" = "Are you sure you want to stop your live broadcast? This will end the broadcast, and the full recording will be available in the room."; "voice_broadcast_stop_alert_agree_button" = "Yes, stop"; +"voice_broadcast_voip_cannot_start_title" = "Can’t start a call"; +"voice_broadcast_voip_cannot_start_description" = "You can’t start a call as you are currently recording a live broadcast. Please end your live broadcast in order to start a call."; -// Mark: - Version check +// MARK: - Version check "version_check_banner_title_supported" = "We’re ending support for iOS %@"; "version_check_banner_subtitle_supported" = "We will soon be ending support for %@ on iOS %@. To continue using %@ to its full potential, we advise you to upgrade your version of iOS."; @@ -2230,7 +2232,7 @@ Tap the + to start adding people."; "version_check_modal_subtitle_deprecated" = "We've been working on enhancing %@ for a faster and more polished experience. Unfortunately your current version of iOS is not compatible with some of those fixes and is no longer supported.\nWe're advising you to upgrade your operating system to use %@ to its full potential."; "version_check_modal_action_title_deprecated" = "Find out how"; -// Mark: - All Chats +// MARK: - All Chats "all_chats_title" = "All chats"; "all_chats_section_title" = "Chats"; @@ -2274,12 +2276,12 @@ Tap the + to start adding people."; "all_chats_onboarding_title" = "What's new"; "all_chats_onboarding_try_it" = "Try it out"; -// Mark: - Room invites +// MARK: - Room invites "room_invites_empty_view_title" = "Nothing new."; "room_invites_empty_view_information" = "This is where your invites appear."; -// Mark: - Space Selector +// MARK: - Space Selector "space_selector_title" = "My spaces"; "space_selector_empty_view_title" = "No spaces yet."; @@ -2289,7 +2291,7 @@ Tap the + to start adding people."; "space_detail_nav_title" = "Space detail"; "space_invite_nav_title" = "Space invite"; -// Mark: - Polls +// MARK: - Polls "poll_edit_form_create_poll" = "Create poll"; @@ -2538,7 +2540,7 @@ To enable access, tap Settings> Location and select Always"; "user_session_overview_session_details_button_title" = "Session details"; -// Mark: - WYSIWYG Composer +// MARK: - WYSIWYG Composer // Send Media Actions "wysiwyg_composer_start_action_media_picker" = "Photo Library"; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 1dde36ec4..5730a6305 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -9215,6 +9215,14 @@ public class VectorL10n: NSObject { public static var voiceBroadcastUnauthorizedTitle: String { return VectorL10n.tr("Vector", "voice_broadcast_unauthorized_title") } + /// You can’t start a call as you are currently recording a live broadcast. Please end your live broadcast in order to start a call. + public static var voiceBroadcastVoipCannotStartDescription: String { + return VectorL10n.tr("Vector", "voice_broadcast_voip_cannot_start_description") + } + /// Can’t start a call + public static var voiceBroadcastVoipCannotStartTitle: String { + return VectorL10n.tr("Vector", "voice_broadcast_voip_cannot_start_title") + } /// You can't start a voice message as you are currently recording a live broadcast. Please end your live broadcast in order to start recording a voice message public static var voiceMessageBroadcastInProgressMessage: String { return VectorL10n.tr("Vector", "voice_message_broadcast_in_progress_message") diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index ca6daf5e0..7e9873209 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -5187,7 +5187,14 @@ static CGSize kThreadListBarButtonItemImageSize; - (IBAction)onVoiceCallPressed:(id)sender { - if (self.isCallActive) + // Manage case of a Voice broadcast listening -> Pause Voice broadcast playback + [VoiceBroadcastPlaybackProvider.shared pausePlaying]; + + if (VoiceBroadcastRecorderProvider.shared.isVoiceBroadcastRecording) { + [[AppDelegate theDelegate] showAlertWithTitle:VectorL10n.voiceBroadcastVoipCannotStartTitle + message:VectorL10n.voiceBroadcastVoipCannotStartDescription]; + } + else if (self.isCallActive) { [self hangupCall]; } @@ -5199,7 +5206,15 @@ static CGSize kThreadListBarButtonItemImageSize; - (IBAction)onVideoCallPressed:(id)sender { - [self placeCallWithVideo:YES]; + // Manage case of a Voice broadcast listening -> Pause Voice broadcast playback + [VoiceBroadcastPlaybackProvider.shared pausePlaying]; + + if (VoiceBroadcastRecorderProvider.shared.isVoiceBroadcastRecording) { + [[AppDelegate theDelegate] showAlertWithTitle:VectorL10n.voiceBroadcastVoipCannotStartTitle + message:VectorL10n.voiceBroadcastVoipCannotStartDescription]; + } else { + [self placeCallWithVideo:YES]; + } } - (IBAction)onThreadListTapped:(id)sender diff --git a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderCoordinator.swift b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderCoordinator.swift index 2a9fe90b8..77d4c394a 100644 --- a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderCoordinator.swift +++ b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderCoordinator.swift @@ -68,6 +68,10 @@ final class VoiceBroadcastRecorderCoordinator: Coordinator, Presentable { func pauseRecording() { voiceBroadcastRecorderViewModel.context.send(viewAction: .pause) } + + func isVoiceBroadcastRecording() -> Bool { + return voiceBroadcastRecorderService.isRecording + } // MARK: - Private } diff --git a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderProvider.swift b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderProvider.swift index e7f998716..7b82429cb 100644 --- a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderProvider.swift +++ b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Coordinator/VoiceBroadcastRecorderProvider.swift @@ -85,6 +85,14 @@ import Foundation voiceBroadcastRecorderCoordinatorForCurrentEvent()?.pauseRecording() } + @objc public func isVoiceBroadcastRecording() -> Bool { + guard let coordinator = voiceBroadcastRecorderCoordinatorForCurrentEvent() else { + return false + } + + return coordinator.isVoiceBroadcastRecording() + } + // MARK: - Private /// Retrieve the voiceBroadcast recorder coordinator for the current event or nil if it hasn't been created yet diff --git a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/MatrixSDK/VoiceBroadcastRecorderService.swift b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/MatrixSDK/VoiceBroadcastRecorderService.swift index 437abbe3c..fd8fc664d 100644 --- a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/MatrixSDK/VoiceBroadcastRecorderService.swift +++ b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/MatrixSDK/VoiceBroadcastRecorderService.swift @@ -44,6 +44,9 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol { // MARK: Public weak var serviceDelegate: VoiceBroadcastRecorderServiceDelegate? + var isRecording: Bool { + return audioEngine.isRunning + } // MARK: - Setup diff --git a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/VoiceBroadcastRecorderServiceProtocol.swift b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/VoiceBroadcastRecorderServiceProtocol.swift index 9e48e2e9a..1b3e77878 100644 --- a/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/VoiceBroadcastRecorderServiceProtocol.swift +++ b/RiotSwiftUI/Modules/Room/VoiceBroadcastRecorder/Service/VoiceBroadcastRecorderServiceProtocol.swift @@ -25,6 +25,9 @@ protocol VoiceBroadcastRecorderServiceProtocol { /// Service delegate var serviceDelegate: VoiceBroadcastRecorderServiceDelegate? { get set } + /// Returns if a voice broadcast is currently recording. + var isRecording: Bool { get } + /// Start voice broadcast recording. func startRecordingVoiceBroadcast() diff --git a/changelog.d/pr-7225.change b/changelog.d/pr-7225.change new file mode 100644 index 000000000..df6cfd7a7 --- /dev/null +++ b/changelog.d/pr-7225.change @@ -0,0 +1 @@ +Labs: VoiceBroadcast: Handle VoIP buttons when VB is used