diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index c14597906..576df0110 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -2208,6 +2208,7 @@ Tap the + to start adding people."; "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."; "voice_broadcast_already_in_progress_message" = "You are already recording a voice broadcast. Please end your current voice broadcast to start a new one."; "voice_broadcast_playback_loading_error" = "Unable to play this voice broadcast."; +"voice_broadcast_playback_lock_screen_placeholder" = "Voice broadcast"; "voice_broadcast_live" = "Live"; "voice_broadcast_tile" = "Voice broadcast"; "voice_broadcast_time_left" = "%@ left"; @@ -2217,7 +2218,8 @@ Tap the + to start adding people."; "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."; -"voice_broadcast_playback_lock_screen_placeholder" = "Voice broadcast"; +"voice_broadcast_connection_error_title" = "Connection error"; +"voice_broadcast_connection_error_message" = "Unfortunately we’re unable to start a recording right now. Please try again later."; // MARK: - Version check diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index c9bb71b43..6d5ef8e9a 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -9207,6 +9207,14 @@ public class VectorL10n: NSObject { public static var voiceBroadcastBuffering: String { return VectorL10n.tr("Vector", "voice_broadcast_buffering") } + /// Unfortunately we’re unable to start a recording right now. Please try again later. + public static var voiceBroadcastConnectionErrorMessage: String { + return VectorL10n.tr("Vector", "voice_broadcast_connection_error_message") + } + /// Connection error + public static var voiceBroadcastConnectionErrorTitle: String { + return VectorL10n.tr("Vector", "voice_broadcast_connection_error_title") + } /// Live public static var voiceBroadcastLive: String { return VectorL10n.tr("Vector", "voice_broadcast_live") diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 87b7e858f..a1a0b6b6c 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2454,13 +2454,19 @@ static CGSize kThreadListBarButtonItemImageSize; // Prevents listening a VB when recording a new one [VoiceBroadcastPlaybackProvider.shared pausePlaying]; + // Check connectivity + if ([AppDelegate theDelegate].isOffline) + { + [self showAlertWithTitle:[VectorL10n voiceBroadcastConnectionErrorTitle] message:[VectorL10n voiceBroadcastConnectionErrorMessage]]; + return; + } + // Request the voice broadcast service to start recording - No service is returned if someone else is already broadcasting in the room [session getOrCreateVoiceBroadcastServiceFor:self.roomDataSource.room completion:^(VoiceBroadcastService *voiceBroadcastService) { if (voiceBroadcastService) { - [voiceBroadcastService startVoiceBroadcastWithSuccess:^(NSString * _Nullable success) { - - } failure:^(NSError * _Nonnull error) { - + [voiceBroadcastService startVoiceBroadcastWithSuccess:^(NSString * _Nullable success) { } failure:^(NSError * _Nonnull error) { + [self showAlertWithTitle:[VectorL10n voiceBroadcastConnectionErrorTitle] message:[VectorL10n voiceBroadcastConnectionErrorMessage]]; + [session tearDownVoiceBroadcastService]; }]; } else diff --git a/Riot/Modules/VoiceBroadcast/VoiceBroadcastSDK/VoiceBroadcastService.swift b/Riot/Modules/VoiceBroadcast/VoiceBroadcastSDK/VoiceBroadcastService.swift index 8c707eab2..c41d5d37d 100644 --- a/Riot/Modules/VoiceBroadcast/VoiceBroadcastSDK/VoiceBroadcastService.swift +++ b/Riot/Modules/VoiceBroadcast/VoiceBroadcastSDK/VoiceBroadcastService.swift @@ -186,7 +186,7 @@ public class VoiceBroadcastService: NSObject { return } - self.room.sendStateEvent(.custom(VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType), + let httpOperation = self.room.sendStateEvent(.custom(VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType), content: stateEventContent, stateKey: stateKey) { [weak self] response in guard let self = self else { return } @@ -199,6 +199,9 @@ public class VoiceBroadcastService: NSObject { } taskCompleted() } + + // No retry to send the request + httpOperation.maxNumberOfTries = 0 } } } diff --git a/changelog.d/7234.change b/changelog.d/7234.change new file mode 100644 index 000000000..52af7685d --- /dev/null +++ b/changelog.d/7234.change @@ -0,0 +1 @@ +Handle a connection issue when we try to start a new voice broadcast.