Use SwiftPM AnalyticsEvents

This commit is contained in:
Andy Uhnak
2023-03-02 14:18:04 +00:00
parent 99b8e8de42
commit 7e41e16467
13 changed files with 33 additions and 60 deletions

View File

@@ -72,8 +72,6 @@ abstract_target 'RiotPods' do
# PostHog for analytics
pod 'PostHog', '~> 2.0.0'
pod 'Sentry', '~> 7.15.0'
pod 'AnalyticsEvents', :git => 'https://github.com/matrix-org/matrix-analytics-events.git', :branch => 'release/swift', :inhibit_warnings => false
# pod 'AnalyticsEvents', :path => '../matrix-analytics-events/AnalyticsEvents.podspec'
pod 'OLMKit'
pod 'zxcvbn-ios'

View File

@@ -14,7 +14,6 @@ PODS:
- AFNetworking/Serialization (4.0.1)
- AFNetworking/UIKit (4.0.1):
- AFNetworking/NSURLSession
- AnalyticsEvents (0.1.0)
- BlueCryptor (1.0.32)
- BlueECC (1.2.5)
- BlueRSA (1.0.200)
@@ -91,7 +90,6 @@ PODS:
- ZXingObjC/All (3.6.5)
DEPENDENCIES:
- AnalyticsEvents (from `https://github.com/matrix-org/matrix-analytics-events.git`, branch `release/swift`)
- Down (~> 0.11.0)
- DSBottomSheet (~> 0.3)
- DSWaveformImage (~> 6.1.1)
@@ -164,19 +162,8 @@ SPEC REPOS:
- zxcvbn-ios
- ZXingObjC
EXTERNAL SOURCES:
AnalyticsEvents:
:branch: release/swift
:git: https://github.com/matrix-org/matrix-analytics-events.git
CHECKOUT OPTIONS:
AnalyticsEvents:
:commit: 53ad46ba1ea1ee8f21139dda3c351890846a202f
:git: https://github.com/matrix-org/matrix-analytics-events.git
SPEC CHECKSUMS:
AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58
AnalyticsEvents: 0cc8cf52da2fd464a2f39b788a295988151116ce
BlueCryptor: b0aee3d9b8f367b49b30de11cda90e1735571c24
BlueECC: 0d18e93347d3ec6d41416de21c1ffa4d4cd3c2cc
BlueRSA: dfeef51db96bcc4edec654956c1581adbda4e6a3
@@ -217,6 +204,6 @@ SPEC CHECKSUMS:
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb
PODFILE CHECKSUM: a160b10da6c4728f70275f07b53ef1502c794d4e
PODFILE CHECKSUM: b95e7964fe3b77759768daa7d9e4988f80210056
COCOAPODS: 1.11.3

View File

@@ -36,6 +36,15 @@
"version" : "5.12.2"
}
},
{
"identity" : "matrix-analytics-events",
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-analytics-events",
"state" : {
"revision" : "2f5fa5f1e2f6c6ae1a47c33d953a3ce289167eb0",
"version" : "0.5.0"
}
},
{
"identity" : "matrix-wysiwyg-composer-swift",
"kind" : "remoteSourceControl",

View File

@@ -230,10 +230,10 @@ extension Analytics {
///
/// Only non-nil properties will be updated when calling this method.
func updateUserProperties(ftueUseCase: UserSessionProperties.UseCase? = nil, numFavouriteRooms: Int? = nil, numSpaces: Int? = nil, allChatsActiveFilter: UserSessionProperties.AllChatsActiveFilter? = nil) {
let userProperties = AnalyticsEvent.UserProperties(ftueUseCaseSelection: ftueUseCase?.analyticsName,
let userProperties = AnalyticsEvent.UserProperties(allChatsActiveFilter: allChatsActiveFilter?.analyticsName,
ftueUseCaseSelection: ftueUseCase?.analyticsName,
numFavouriteRooms: numFavouriteRooms,
numSpaces: numSpaces,
allChatsActiveFilter: allChatsActiveFilter?.analyticsName)
numSpaces: numSpaces)
client.updateUserProperties(userProperties)
}
@@ -281,7 +281,12 @@ extension Analytics {
/// - reason: The error that occurred.
/// - context: Additional context of the error that occured
func trackE2EEError(_ reason: DecryptionFailureReason, context: String) {
let event = AnalyticsEvent.Error(context: context, domain: .E2EE, name: reason.errorName)
let event = AnalyticsEvent.Error(
context: context,
cryptoModule: MXSDKOptions.sharedInstance().enableCryptoSDK ? .Rust : .Native,
domain: .E2EE,
name: reason.errorName
)
capture(event: event)
}
@@ -359,7 +364,7 @@ extension Analytics: MXAnalyticsDelegate {
func trackCallError(with reason: __MXCallHangupReason, video isVideo: Bool, numberOfParticipants: Int, incoming isIncoming: Bool) {
let callEvent = AnalyticsEvent.CallError(isVideo: isVideo, numParticipants: numberOfParticipants, placed: !isIncoming)
let event = AnalyticsEvent.Error(context: nil, domain: .VOIP, name: reason.errorName)
let event = AnalyticsEvent.Error(context: nil, cryptoModule: nil, domain: .VOIP, name: reason.errorName)
capture(event: callEvent)
capture(event: event)
}

View File

@@ -1,35 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import AnalyticsEvents
extension AnalyticsEvent.UserProperties {
// Initializer for Element. Strips all Web properties.
public init(ftueUseCaseSelection: FtueUseCaseSelection?, numFavouriteRooms: Int?, numSpaces: Int?, allChatsActiveFilter: AllChatsActiveFilter?) {
self.init(WebMetaSpaceFavouritesEnabled: nil,
WebMetaSpaceHomeAllRooms: nil,
WebMetaSpaceHomeEnabled: nil,
WebMetaSpaceOrphansEnabled: nil,
WebMetaSpacePeopleEnabled: nil,
allChatsActiveFilter: allChatsActiveFilter,
ftueUseCaseSelection: ftueUseCaseSelection,
numFavouriteRooms: numFavouriteRooms,
numSpaces: numSpaces)
}
}

View File

@@ -81,10 +81,10 @@ class PostHogAnalyticsClient: AnalyticsClientProtocol {
}
// Merge the updated user properties with the existing ones
self.pendingUserProperties = AnalyticsEvent.UserProperties(ftueUseCaseSelection: userProperties.ftueUseCaseSelection ?? pendingUserProperties.ftueUseCaseSelection,
self.pendingUserProperties = AnalyticsEvent.UserProperties(allChatsActiveFilter: userProperties.allChatsActiveFilter ?? pendingUserProperties.allChatsActiveFilter,
ftueUseCaseSelection: userProperties.ftueUseCaseSelection ?? pendingUserProperties.ftueUseCaseSelection,
numFavouriteRooms: userProperties.numFavouriteRooms ?? pendingUserProperties.numFavouriteRooms,
numSpaces: userProperties.numSpaces ?? pendingUserProperties.numSpaces,
allChatsActiveFilter: userProperties.allChatsActiveFilter ?? pendingUserProperties.allChatsActiveFilter)
numSpaces: userProperties.numSpaces ?? pendingUserProperties.numSpaces)
}
// MARK: - Private

View File

@@ -39,6 +39,7 @@ targets:
- target: RiotNSE
- target: DesignKit
- target: CommonKit
- package: AnalyticsEvents
- package: Mapbox
- package: OrderedCollections
- package: SwiftOGG

View File

@@ -32,6 +32,7 @@ targets:
type: app-extension
dependencies:
- package: AnalyticsEvents
- package: DeviceKit
- package: DTCoreText

View File

@@ -32,6 +32,7 @@ targets:
type: app-extension
dependencies:
- package: AnalyticsEvents
- package: DeviceKit
- package: DTCoreText

View File

@@ -35,6 +35,7 @@ targets:
dependencies:
- target: Riot
- package: AnalyticsEvents
configFiles:
Debug: Debug.xcconfig

View File

@@ -33,6 +33,7 @@ targets:
dependencies:
- sdk: Intents.framework
- package: AnalyticsEvents
- package: DeviceKit
- package: DTCoreText

View File

@@ -0,0 +1 @@
Analytics: Use SwiftPM for AnalyticsEvents instead of CocoaPods

View File

@@ -40,6 +40,9 @@ include:
- path: CommonKit/targetUnitTests.yml
packages:
AnalyticsEvents:
url: https://github.com/matrix-org/matrix-analytics-events
exactVersion: 0.5.0
Mapbox:
url: https://github.com/maplibre/maplibre-gl-native-distribution
minVersion: 5.12.2
@@ -59,4 +62,4 @@ packages:
majorVersion: 4.7.0
DTCoreText:
url: https://github.com/Cocoanetics/DTCoreText
version: 1.6.27
version: 1.6.27