Skip to content

Commit

Permalink
Merge pull request #964 from tchapgouv/962-voip-proposer-un-rapport-d…
Browse files Browse the repository at this point in the history
…incident-dappel-dans-la-cellule-de-fin-dappel-voip-de-la-timeline

962 voip proposer un rapport dincident dappel dans la cellule de fin dappel voip de la timeline
  • Loading branch information
NicolasBuquet authored Feb 7, 2024
2 parents 152e2dd + c87abff commit a8d45f1
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Riot/Modules/BugReport/BugReportViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,11 @@
*/
@property (nonatomic) BOOL reportCrash;

// Tchap
/**
Option to report a VoIP incident.
The crash log will sent in the report.
*/
@property (nonatomic) BOOL reportVoIPIncident;

@end
28 changes: 26 additions & 2 deletions Riot/Modules/BugReport/BugReportViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#import "RageShakeManager.h"
#import "ThemeService.h"

// Tchap: use AFNetworkReachability connection state in VoIP RageShake
#import "AFNetworkReachabilityManager.h"

@interface BugReportViewController ()
{
MXBugReportRestClient *bugReportRestClient;
Expand Down Expand Up @@ -84,7 +87,13 @@ - (void)viewDidLoad
_bugReportDescriptionTextView.text = nil;
_bugReportDescriptionTextView.delegate = self;

if (_reportCrash)
// Tchap: add `reportVoIPIncident` configuration
if (_reportVoIPIncident)
{
_titleLabel.text = [TchapL10n voidReportIncidentTitle];
_descriptionLabel.text = [TchapL10n voidReportIncidentDescription];
}
else if (_reportCrash)
{
_titleLabel.text = [VectorL10n bugCrashReportTitle];
_descriptionLabel.text = [VectorL10n bugCrashReportDescription];
Expand Down Expand Up @@ -361,6 +370,21 @@ - (IBAction)onSendButtonPress:(id)sender
NSMutableDictionary<NSString *, NSString *> *customFields = NSMutableDictionary.dictionary;
customFields[@"email"] = mainAccount.linkedEmails.firstObject ?: @"undefined";

// Tchap : add "context: 'voip'" (if necessary) for support automation
if ( _reportVoIPIncident == YES ) {
customFields[@"context"] = @"voip";

if ( AFNetworkReachabilityManager.sharedManager.isReachableViaWiFi ) {
customFields[@"connection"] = @"wifi";
}
else if ( AFNetworkReachabilityManager.sharedManager.isReachableViaWWAN ) {
customFields[@"connection"] = @"mobile";
}
else {
customFields[@"connection"] = @"unknown";
}
}

bugReportRestClient.others = userInfo;

// Screenshot
Expand Down Expand Up @@ -388,7 +412,7 @@ - (IBAction)onSendButtonPress:(id)sender
sendCrashLog:_reportCrash
sendFiles:files
additionalLabels:nil
customFields:customFields // Tchap : add custom fields (fro email actually)
customFields:customFields // Tchap : add custom fields (for email actually)
progress:^(MXBugReportState state, NSProgress *progress) {

switch (state)
Expand Down
10 changes: 10 additions & 0 deletions Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3888,6 +3888,16 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac
MXCall *call = [self.mainSession.callManager callWithCallId:eventContent.callId];
[call hangup];
}
// Tchap: handle "rport VoIP incident" action
else if ([actionIdentifier isEqualToString:RoomDirectCallStatusCell.reportIncidentAction])
{
MXEvent *callInviteEvent = userInfo[kMXKRoomBubbleCellEventKey];
MXCallInviteEventContent *eventContent = [MXCallInviteEventContent modelFromJSON:callInviteEvent.content];

BugReportViewController *bugReportViewController = [BugReportViewController bugReportViewController];
bugReportViewController.reportVoIPIncident = YES;
[bugReportViewController showInViewController:self];
}
else if ([actionIdentifier isEqualToString:RoomGroupCallStatusCell.joinAction] ||
[actionIdentifier isEqualToString:RoomGroupCallStatusCell.answerAction])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<constraint firstAttribute="height" constant="16" id="OdD-1h-kkV"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Active call" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A3h-4o-nXF">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="1000" text="Active call" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A3h-4o-nXF">
<rect key="frame" x="22" y="0.0" width="62" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class HorizontalButtonsContainerView: UIView {
var result = stackView.intrinsicContentSize
result.width = self.frame.width
result.height += Constants.stackViewTopMargin + Constants.stackViewBottomMargin
// Tchap: set minimum height for buttons not to be vertically compressed when text above is multi-line.
result.height = max(result.height, 68.0)
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class RoomDirectCallStatusCell: RoomCallBaseCell {
return self.className + ".endCall"
}

// Tchap
/// Action identifier used when the user pressed "Report VoIP incident" button for an ended call.
/// The `userInfo` dictionary contains an `MXEvent` object under the `kMXKRoomBubbleCellEventKey` key, representing the invite event of the call.
static var reportIncidentAction: String {
return self.className + ".reportincident"
}

private var callDurationString: String = ""
private var isVideoCall: Bool = false
private var isIncoming: Bool = false
Expand Down Expand Up @@ -165,7 +172,18 @@ class RoomDirectCallStatusCell: RoomCallBaseCell {

return view
case .ended:
return nil
// Tchap: add "Report VoIP incident" button
// return nil
let view = HorizontalButtonsContainerView.loadFromNib()
view.secondButton.isHidden = true

view.firstButton.style = .positive
view.firstButton.setTitle(TchapL10n.eventFormatterReportIncident, for: .normal)
view.firstButton.setImage(callButtonIcon, for: .normal)
view.firstButton.removeTarget(nil, action: nil, for: .touchUpInside)
view.firstButton.addTarget(self, action: #selector(reportIncidentAction(_:)), for: .touchUpInside)

return view
case .failed:
let view = HorizontalButtonsContainerView.loadFromNib()
view.secondButton.isHidden = true
Expand Down Expand Up @@ -332,6 +350,14 @@ class RoomDirectCallStatusCell: RoomCallBaseCell {
userInfo: actionUserInfo)
}

// Tchap: report VoIP incident action
@objc
private func reportIncidentAction(_ sender: CallTileActionButton) {
self.delegate?.cell(self,
didRecognizeAction: Self.reportIncidentAction,
userInfo: actionUserInfo)
}

// MARK: - MXKCellRendering

override func render(_ cellData: MXKCellData!) {
Expand Down
6 changes: 6 additions & 0 deletions Tchap/Assets/Localizations/fr.lproj/Tchap.strings
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,9 @@
"security_cross_signing_reset_title" = "Êtes-vous sur ?";
"security_cross_signing_reset_message" = "Faites cette opération seulement si vous avez perdu tous vos autres appareils vérifiés.";
"security_cross_signing_reset_action_title" = "Réinitialiser";

////////////////////////////////////////////////////////////////////////////////
// MARK: VoIP
"event_formatter_report_incident" = "Signaler un problème";
"void_report_incident_title" = "Signaler un problème VoIP";
"void_report_incident_description" = "Vous avez rencontré un souci durant votre appel VoIP. Dites-nous ce qui s'est passé :";
1 change: 1 addition & 0 deletions changelog.d/962.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Proposer d'envoyer un rapport d'incident/de qualité à la fin d'un appel VoIP

0 comments on commit a8d45f1

Please sign in to comment.