Add TelemetryDeck

This commit is contained in:
Thomas Ricouard 2024-08-14 17:23:10 +02:00
parent 56869e3a2f
commit 9d11814e49
8 changed files with 43 additions and 3 deletions

View file

@ -117,6 +117,15 @@
"version" : "0.3.0" "version" : "0.3.0"
} }
}, },
{
"identity" : "swiftsdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/TelemetryDeck/SwiftSDK",
"state" : {
"revision" : "13a26cf125b70d695913eb9bea9f9b9c29da5790",
"version" : "2.3.0"
}
},
{ {
"identity" : "swiftsoup", "identity" : "swiftsoup",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",

View file

@ -87,6 +87,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
try? AVAudioSession.sharedInstance().setCategory(.ambient, options: .mixWithOthers) try? AVAudioSession.sharedInstance().setCategory(.ambient, options: .mixWithOthers)
try? AVAudioSession.sharedInstance().setActive(true) try? AVAudioSession.sharedInstance().setActive(true)
PushNotificationsService.shared.setAccounts(accounts: AppAccountsManager.shared.pushAccounts) PushNotificationsService.shared.setAccounts(accounts: AppAccountsManager.shared.pushAccounts)
Telemetry.setup()
Telemetry.signal("app.launched")
return true return true
} }

View file

@ -85,11 +85,12 @@ struct AccountSettingsView: View {
await sub.deleteSubscription() await sub.deleteSubscription()
} }
appAccountsManager.delete(account: appAccount) appAccountsManager.delete(account: appAccount)
Telemetry.signal("account.removed")
dismiss() dismiss()
} }
} }
} label: { } label: {
Text("account.action.logout") Label("account.action.logout", systemImage: "trash")
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
} }
} }

View file

@ -218,9 +218,11 @@ struct TimelineTab: View {
Button { Button {
withAnimation { withAnimation {
if let index { if let index {
pinnedFilters.remove(at: index) let timeline = pinnedFilters.remove(at: index)
Telemetry.signal("timeline.pin.removed", parameters: ["timeline" : timeline.rawValue])
} else { } else {
pinnedFilters.append(timeline) pinnedFilters.append(timeline)
Telemetry.signal("timeline.pin.added", parameters: ["timeline" : timeline.rawValue])
} }
} }
} label: { } label: {

View file

@ -1,3 +1,5 @@
IceCubesApp does not collect or process any personal information from its users. The app is used to connect to third-party Mastodon servers that may or may not collect personal information and are not covered by this privacy policy. Each third-party Mastodon server comes equipped with its own privacy policy that can be viewed through the app or through that server's website. IceCubesApp does not collect or process any personal information from its users. The app is used to connect to third-party Mastodon servers that may or may not collect personal information and are not covered by this privacy policy. Each third-party Mastodon server comes equipped with its own privacy policy that can be viewed through the app or through that server's website.
When you use the OpenAI feature in the composer, please be aware that your input will be sent to the OpenAI server in order to generate a response. Please refer to the [OpenAI Privacy Policy](https://openai.com/policies/privacy-policy) if you want to know more. Nothing is sent to OpenAI if you don't use this feature. You can also completely disable this button in the app settings. When you use the OpenAI feature in the composer, please be aware that your input will be sent to the OpenAI server in order to generate a response. Please refer to the [OpenAI Privacy Policy](https://openai.com/policies/privacy-policy) if you want to know more. Nothing is sent to OpenAI if you don't use this feature. You can also completely disable this button in the app settings.
Ice Cubes use TelemetryDeck to collect anonymized usage data. This helps us understand how our users are using our app and how we can improve it. TelemetryDeck does not collect any personally identifiable information. You can read more about TelemetryDecks [privacy policy](https://telemetrydeck.com/privacy)

View file

@ -20,6 +20,7 @@ let package = Package(
.package(name: "Models", path: "../Models"), .package(name: "Models", path: "../Models"),
.package(name: "Network", path: "../Network"), .package(name: "Network", path: "../Network"),
.package(url: "https://github.com/evgenyneu/keychain-swift", branch: "master"), .package(url: "https://github.com/evgenyneu/keychain-swift", branch: "master"),
.package(url: "https://github.com/TelemetryDeck/SwiftSDK", from: "2.3.0")
], ],
targets: [ targets: [
.target( .target(
@ -28,6 +29,7 @@ let package = Package(
.product(name: "Models", package: "Models"), .product(name: "Models", package: "Models"),
.product(name: "Network", package: "Network"), .product(name: "Network", package: "Network"),
.product(name: "KeychainSwift", package: "keychain-swift"), .product(name: "KeychainSwift", package: "keychain-swift"),
.product(name: "TelemetryDeck", package: "SwiftSDK")
], ],
swiftSettings: [ swiftSettings: [
.enableExperimentalFeature("StrictConcurrency"), .enableExperimentalFeature("StrictConcurrency"),

View file

@ -0,0 +1,19 @@
import TelemetryDeck
import SwiftUI
@MainActor
public class Telemetry {
static var userId: String? {
CurrentAccount.shared.account?.id
}
public static func setup() {
let config = TelemetryDeck.Config(appID: "F04175D2-599A-4504-867E-CE870B991EB7")
TelemetryDeck.initialize(config: config)
}
public static func signal(_ event: String, parameters: [String: String] = [:]) {
TelemetryDeck.signal(event, parameters: parameters, customUserID: userId)
}
}

View file

@ -9,7 +9,7 @@ import SwiftUI
@Observable class TimelineViewModel { @Observable class TimelineViewModel {
var scrollToIndex: Int? var scrollToIndex: Int?
var statusesState: StatusesState = .loading var statusesState: StatusesState = .loading
var timeline: TimelineFilter = .federated { var timeline: TimelineFilter = .home {
willSet { willSet {
if timeline == .home, newValue != .resume { if timeline == .home, newValue != .resume {
saveMarker() saveMarker()
@ -21,6 +21,9 @@ import SwiftUI
await handleLatestOrResume(oldValue) await handleLatestOrResume(oldValue)
if oldValue != timeline { if oldValue != timeline {
Telemetry.signal("timeline.filter.updated",
parameters: ["timeline": timeline.rawValue])
await reset() await reset()
pendingStatusesObserver.pendingStatuses = [] pendingStatusesObserver.pendingStatuses = []
tag = nil tag = nil