diff --git a/Riot/Managers/Analytics/Analytics.h b/Riot/Managers/Analytics/Analytics.h index a57a7622c..03870bef7 100644 --- a/Riot/Managers/Analytics/Analytics.h +++ b/Riot/Managers/Analytics/Analytics.h @@ -18,6 +18,12 @@ #import + +// Metrics related to notifications +FOUNDATION_EXPORT NSString *const AnalyticsNoficationsCategory; +FOUNDATION_EXPORT NSString *const AnalyticsNoficationsTimeToDisplayContent; + + /** `Analytics` sends analytics to an analytics tool. */ diff --git a/Riot/Managers/Analytics/Analytics.m b/Riot/Managers/Analytics/Analytics.m index faa8ac674..2786f0964 100644 --- a/Riot/Managers/Analytics/Analytics.m +++ b/Riot/Managers/Analytics/Analytics.m @@ -19,6 +19,10 @@ #import "Riot-Swift.h" +NSString *const AnalyticsNoficationsCategory = @"notifications"; +NSString *const AnalyticsNoficationsTimeToDisplayContent = @"timelineDisplay"; + + // Duration data will be visible under the Piwik category called "Performance". // Other values will be visible in "Metrics". // Some Matomo screenshots are available at https://github.com/vector-im/element-ios/pull/3789. diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index c08206a8d..613b9aa03 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1109,6 +1109,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)pushNotificationService:(PushNotificationService *)pushNotificationService shouldNavigateToRoomWithId:(NSString *)roomId { + [MXSDKOptions.sharedInstance.profiler startMeasuringTaskWithName:AnalyticsNoficationsTimeToDisplayContent + category:AnalyticsNoficationsCategory]; + _lastNavigatedRoomIdFromPush = roomId; [self navigateToRoomById:roomId]; } diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index d63d9f0da..04a76afa6 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -204,6 +204,9 @@ // Formatted body parser for events FormattedBodyParser *formattedBodyParser; + + // Time to display notification content in the timeline + MXTaskProfile *notificationTaskProfile; } @property (nonatomic, weak) IBOutlet UIView *overlayContainerView; @@ -500,6 +503,9 @@ [self startActivityIndicator]; [self.roomDataSource reload]; [LegacyAppDelegate theDelegate].lastNavigatedRoomIdFromPush = nil; + + notificationTaskProfile = [MXSDKOptions.sharedInstance.profiler startMeasuringTaskWithName:AnalyticsNoficationsTimeToDisplayContent + category:AnalyticsNoficationsCategory]; } } @@ -842,6 +848,18 @@ self.updateRoomReadMarker = NO; } +- (void)stopActivityIndicator +{ + if (notificationTaskProfile) + { + // Consider here we have displayed the message corresponding to the notification + [MXSDKOptions.sharedInstance.profiler stopMeasuringTaskWithProfile:notificationTaskProfile]; + notificationTaskProfile = nil; + } + + [super stopActivityIndicator]; +} + - (void)displayRoom:(MXKRoomDataSource *)dataSource { // Remove potential preview Data