From 014d030f4a4567a86a79b505faafdf2b329b7cd3 Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 29 Jun 2018 07:50:06 +0200 Subject: [PATCH] Crypto: Add telemetry for events unable to decrypt (UTDs) Add a dispatch method --- Riot/Analytics/DecryptionFailureTracker.h | 5 +++++ Riot/Analytics/DecryptionFailureTracker.m | 5 +++++ Riot/AppDelegate.m | 1 + 3 files changed, 11 insertions(+) diff --git a/Riot/Analytics/DecryptionFailureTracker.h b/Riot/Analytics/DecryptionFailureTracker.h index 7ddc2482f..92c7587f1 100644 --- a/Riot/Analytics/DecryptionFailureTracker.h +++ b/Riot/Analytics/DecryptionFailureTracker.h @@ -46,6 +46,11 @@ */ - (void)reportUnableToDecryptErrorForEvent:(MXEvent*)event withRoomState:(MXRoomState*)roomState myUser:(NSString*)userId; +/** + Flush current data. + */ +- (void)dispatch; + @end /** diff --git a/Riot/Analytics/DecryptionFailureTracker.m b/Riot/Analytics/DecryptionFailureTracker.m index 424570186..240f0ecd2 100644 --- a/Riot/Analytics/DecryptionFailureTracker.m +++ b/Riot/Analytics/DecryptionFailureTracker.m @@ -99,6 +99,11 @@ reportedFailures[event.eventId] = decryptionFailure; } +- (void)dispatch +{ + [self checkFailures]; +} + #pragma mark - Private methods /** diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index 4d38c59c0..78db8a2c7 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -559,6 +559,7 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN _isAppForeground = NO; // Analytics: Force to send the pending actions + [[DecryptionFailureTracker sharedInstance] dispatch]; [[Analytics sharedInstance] dispatch]; }