mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-04 23:17:43 +02:00
Merge branch 'feature/6142_remove_jitsi' into 'develop'
MESSENGER-6142 remove jitsi, sentry, posthog and sublibraries See merge request bwmessenger/bundesmessenger/bundesmessenger-ios!380
This commit is contained in:
@@ -14,7 +14,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#if POSTHOG
|
||||
import PostHog
|
||||
#endif
|
||||
import AnalyticsEvents
|
||||
|
||||
/// A class responsible for managing a variety of analytics clients
|
||||
@@ -34,19 +36,28 @@ import AnalyticsEvents
|
||||
/// The singleton instance to be used within the Riot target.
|
||||
static let shared = Analytics()
|
||||
|
||||
#if POSTHOG
|
||||
/// The analytics client to send events with.
|
||||
private var client: AnalyticsClientProtocol = PostHogAnalyticsClient.shared
|
||||
#endif
|
||||
|
||||
#if SENTRY
|
||||
/// The monitoring client to track crashes, issues and performance
|
||||
private var monitoringClient = SentryMonitoringClient()
|
||||
|
||||
#endif
|
||||
/// The service used to interact with account data settings.
|
||||
private var service: AnalyticsService?
|
||||
|
||||
private var viewRoomActiveSpace: AnalyticsViewRoomActiveSpace = .home
|
||||
|
||||
/// Whether or not the object is enabled and sending events to the server.
|
||||
var isRunning: Bool { client.isRunning }
|
||||
var isRunning: Bool {
|
||||
#if POSTHOG
|
||||
client.isRunning
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Whether to show the user the analytics opt in prompt.
|
||||
var shouldShowAnalyticsPrompt: Bool {
|
||||
@@ -103,8 +114,12 @@ import AnalyticsEvents
|
||||
|
||||
// The order is important here. PostHog ignores the reset if stopped.
|
||||
reset()
|
||||
#if POSTHOG
|
||||
client.stop()
|
||||
#endif
|
||||
#if SENTRY
|
||||
monitoringClient.stop()
|
||||
#endif
|
||||
|
||||
MXLog.debug("[Analytics] Stopped.")
|
||||
}
|
||||
@@ -113,11 +128,18 @@ import AnalyticsEvents
|
||||
func startIfEnabled() {
|
||||
guard RiotSettings.shared.enableAnalytics, !isRunning else { return }
|
||||
|
||||
#if POSTHOG
|
||||
client.start()
|
||||
#endif
|
||||
#if SENTRY
|
||||
monitoringClient.start()
|
||||
|
||||
#endif
|
||||
// Sanity check in case something went wrong.
|
||||
#if POSTHOG
|
||||
guard client.isRunning else { return }
|
||||
#else
|
||||
return
|
||||
#endif
|
||||
|
||||
MXLog.debug("[Analytics] Started.")
|
||||
|
||||
@@ -162,8 +184,12 @@ import AnalyticsEvents
|
||||
/// account used isn't associated with the previous one.
|
||||
/// Note: **MUST** be called before stopping PostHog or the reset is ignored.
|
||||
func reset() {
|
||||
#if POSTHOG
|
||||
client.reset()
|
||||
#endif
|
||||
#if SENTRY
|
||||
monitoringClient.reset()
|
||||
#endif
|
||||
MXLog.debug("[Analytics] Reset.")
|
||||
RiotSettings.shared.isIdentifiedForAnalytics = false
|
||||
|
||||
@@ -175,7 +201,9 @@ import AnalyticsEvents
|
||||
/// Normally events are sent in batches. Call this method when you need an event
|
||||
/// to be sent immediately.
|
||||
func forceUpload() {
|
||||
#if POSTHOG
|
||||
client.flush()
|
||||
#endif
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
@@ -187,8 +215,10 @@ import AnalyticsEvents
|
||||
MXLog.error("[Analytics] identify(with:) called before an ID has been generated.")
|
||||
return
|
||||
}
|
||||
|
||||
#if POSTHOG
|
||||
client.identify(id: id)
|
||||
#endif
|
||||
|
||||
MXLog.debug("[Analytics] Identified.")
|
||||
RiotSettings.shared.isIdentifiedForAnalytics = true
|
||||
}
|
||||
@@ -196,7 +226,9 @@ import AnalyticsEvents
|
||||
/// Capture an event in the `client`.
|
||||
/// - Parameter event: The event to capture.
|
||||
private func capture(event: AnalyticsEventProtocol) {
|
||||
#if POSTHOG
|
||||
client.capture(event)
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Update `viewRoomActiveSpace` property according to the current value of `exploringSpace` and `activeSpace` properties.
|
||||
@@ -244,7 +276,9 @@ extension Analytics {
|
||||
ftueUseCaseSelection: ftueUseCase?.analyticsName,
|
||||
numFavouriteRooms: numFavouriteRooms,
|
||||
numSpaces: numSpaces)
|
||||
#if POSTHOG
|
||||
client.updateUserProperties(userProperties)
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Track the registration of a new user.
|
||||
@@ -260,7 +294,9 @@ extension Analytics {
|
||||
/// - milliseconds: An optional value representing how long the screen was shown for in milliseconds.
|
||||
func trackScreen(_ screen: AnalyticsScreen, duration milliseconds: Int?) {
|
||||
let event = AnalyticsEvent.MobileScreen(durationMs: milliseconds, screenName: screen.screenName)
|
||||
#if POSTHOG
|
||||
client.screen(event)
|
||||
#endif
|
||||
}
|
||||
|
||||
/// The the presentation of a screen without including a duration
|
||||
@@ -276,7 +312,9 @@ extension Analytics {
|
||||
/// - index: The index of the element, if it's in a list of elements
|
||||
func trackInteraction(_ uiElement: AnalyticsUIElement, interactionType: AnalyticsEvent.Interaction.InteractionType, index: Int?) {
|
||||
let event = AnalyticsEvent.Interaction(index: index, interactionType: interactionType, name: uiElement.name)
|
||||
#if POSTHOG
|
||||
client.capture(event)
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Track an element that has been tapped without including an index
|
||||
@@ -296,7 +334,9 @@ extension Analytics {
|
||||
func trackAuthUnauthenticatedError(softLogout: Bool, refreshTokenAuth: Bool, errorCode: String, errorReason: String) {
|
||||
let errorCode = AnalyticsEvent.UnauthenticatedError.ErrorCode(rawValue: errorCode) ?? .M_UNKNOWN
|
||||
let event = AnalyticsEvent.UnauthenticatedError(errorCode: errorCode, errorReason: errorReason, refreshTokenAuth: refreshTokenAuth, softLogout: softLogout)
|
||||
#if POSTHOG
|
||||
client.capture(event)
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Track whether the user accepted or declined the terms to an identity server.
|
||||
@@ -346,7 +386,12 @@ extension Analytics: MXAnalyticsDelegate {
|
||||
}
|
||||
|
||||
func startDurationTracking(forName name: String, operation: String) -> StopDurationTracking {
|
||||
|
||||
#if SENTRY
|
||||
return monitoringClient.startPerformanceTracking(name: name, operation: operation)
|
||||
#else
|
||||
return {}
|
||||
#endif
|
||||
}
|
||||
|
||||
func trackCallStarted(withVideo isVideo: Bool, numberOfParticipants: Int, incoming isIncoming: Bool) {
|
||||
@@ -399,7 +444,9 @@ extension Analytics: MXAnalyticsDelegate {
|
||||
}
|
||||
|
||||
func trackNonFatalIssue(_ issue: String, details: [String: Any]?) {
|
||||
monitoringClient.trackNonFatalIssue(issue, details: details)
|
||||
#if SENTRY
|
||||
monitoringClient?.trackNonFatalIssue(issue, details: details)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#if POSTHOG
|
||||
import PostHog
|
||||
|
||||
extension PHGPostHogConfiguration {
|
||||
@@ -27,3 +28,4 @@ extension PHGPostHogConfiguration {
|
||||
return postHogConfiguration
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#if POSTHOG
|
||||
import PostHog
|
||||
import AnalyticsEvents
|
||||
|
||||
@@ -110,3 +111,4 @@ extension PostHogAnalyticsClient: RemoteFeaturesClientProtocol {
|
||||
postHog?.isFeatureEnabled(feature) == true
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#if SENTRY
|
||||
import Foundation
|
||||
import Sentry
|
||||
import MatrixSDK
|
||||
@@ -83,3 +84,4 @@ struct SentryMonitoringClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
#import "MatrixKit.h"
|
||||
|
||||
#import "MasterTabBarController.h"
|
||||
|
||||
#ifdef CALL_STACK_JINGLE
|
||||
#import "JitsiViewController.h"
|
||||
#endif
|
||||
|
||||
#import "RageShakeManager.h"
|
||||
|
||||
|
||||
@@ -85,7 +85,11 @@ NSString *const AppDelegateDidValidateEmailNotificationClientSecretKey = @"AppDe
|
||||
|
||||
NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUniversalLinkDidChangeNotification";
|
||||
|
||||
@interface LegacyAppDelegate () <GDPRConsentViewControllerDelegate, KeyVerificationCoordinatorBridgePresenterDelegate, PushNotificationServiceDelegate, SetPinCoordinatorBridgePresenterDelegate, CallPresenterDelegate, SpaceDetailPresenterDelegate, SecureBackupSetupCoordinatorBridgePresenterDelegate>
|
||||
@interface LegacyAppDelegate () <GDPRConsentViewControllerDelegate, KeyVerificationCoordinatorBridgePresenterDelegate, PushNotificationServiceDelegate, SetPinCoordinatorBridgePresenterDelegate,
|
||||
#ifdef CALL_STACK_JINGLE
|
||||
CallPresenterDelegate,
|
||||
#endif
|
||||
SpaceDetailPresenterDelegate, SecureBackupSetupCoordinatorBridgePresenterDelegate>
|
||||
{
|
||||
/**
|
||||
Reachability observer
|
||||
|
||||
@@ -52,7 +52,9 @@
|
||||
|
||||
#import "ReadReceiptsViewController.h"
|
||||
|
||||
#ifdef CALL_STACK_JINGLE
|
||||
#import "JitsiViewController.h"
|
||||
#endif
|
||||
|
||||
#import "RoomEmptyBubbleCell.h"
|
||||
#import "RoomMembershipExpandedBubbleCell.h"
|
||||
@@ -2917,7 +2919,11 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
|
||||
- (BOOL)isRoomHavingAJitsiCallForWidgetId:(NSString*)widgetId
|
||||
{
|
||||
#ifdef CALL_STACK_JINGLE
|
||||
return [[AppDelegate theDelegate].callPresenter.jitsiVC.widget.roomId isEqualToString:widgetId];
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
#pragma mark - Dialpad
|
||||
@@ -3991,10 +3997,12 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}
|
||||
}];
|
||||
|
||||
#ifdef CALL_STACK_JINGLE
|
||||
MXEvent *widgetEvent = userInfo[kMXKRoomBubbleCellEventKey];
|
||||
Widget *widget = [[Widget alloc] initWithWidgetEvent:widgetEvent
|
||||
inMatrixSession:self.customizedRoomDataSource.mxSession];
|
||||
[[JitsiService shared] resetDeclineForWidgetWithId:widget.widgetId];
|
||||
#endif
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:RoomGroupCallStatusCell.leaveAction])
|
||||
{
|
||||
@@ -4003,11 +4011,13 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:RoomGroupCallStatusCell.declineAction])
|
||||
{
|
||||
#ifdef CALL_STACK_JINGLE
|
||||
MXEvent *widgetEvent = userInfo[kMXKRoomBubbleCellEventKey];
|
||||
Widget *widget = [[Widget alloc] initWithWidgetEvent:widgetEvent
|
||||
inMatrixSession:self.customizedRoomDataSource.mxSession];
|
||||
[[JitsiService shared] declineWidgetWithId:widget.widgetId];
|
||||
[self reloadBubblesTable:YES];
|
||||
#endif
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:RoomCreationIntroCell.tapOnAvatarView])
|
||||
{
|
||||
|
||||
@@ -90,8 +90,12 @@ class RoomGroupCallStatusCell: RoomCallBaseCell {
|
||||
}
|
||||
|
||||
private var isJoined: Bool {
|
||||
#if canImport(JitsiMeetSDK)
|
||||
return widgetId != nil &&
|
||||
AppDelegate.theDelegate().callPresenter.jitsiVC?.widget.widgetId == widgetId
|
||||
AppDelegate.theDelegate().callPresenter.jitsiVC?.widget.widgetId == widgetId
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
private var actionUserInfo: [AnyHashable: Any]? {
|
||||
@@ -236,6 +240,7 @@ class RoomGroupCallStatusCell: RoomCallBaseCell {
|
||||
if isIncoming && !isJoined &&
|
||||
TimeInterval(widgetEvent.age)/MSEC_PER_SEC < Constants.secondsToDisplayAnswerDeclineOptions {
|
||||
|
||||
#if canImport(JitsiMeetSDK)
|
||||
if JitsiService.shared.isWidgetDeclined(withId: widgetId) {
|
||||
innerContentView.callerNameLabel.text = room.summary.displayName
|
||||
room.summary.setRoomAvatarImageIn(innerContentView.avatarImageView)
|
||||
@@ -256,6 +261,7 @@ class RoomGroupCallStatusCell: RoomCallBaseCell {
|
||||
viewState = .ringing
|
||||
statusText = nil
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
innerContentView.callerNameLabel.text = room.summary.displayName
|
||||
|
||||
@@ -296,6 +302,7 @@ class RoomGroupCallStatusCell: RoomCallBaseCell {
|
||||
} else if !self.isJoined &&
|
||||
TimeInterval(widgetEvent.age)/MSEC_PER_SEC < Constants.secondsToDisplayAnswerDeclineOptions {
|
||||
|
||||
#if canImport(JitsiMeetSDK)
|
||||
if JitsiService.shared.isWidgetDeclined(withId: widgetId) {
|
||||
self.viewState = .declined
|
||||
self.statusText = VectorL10n.eventFormatterCallYouDeclined
|
||||
@@ -303,6 +310,7 @@ class RoomGroupCallStatusCell: RoomCallBaseCell {
|
||||
self.viewState = .ringing
|
||||
self.statusText = nil
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
self.viewState = .active
|
||||
self.statusText = VectorL10n.eventFormatterCallActiveVideo
|
||||
|
||||
Reference in New Issue
Block a user