Skip to content

Commit

Permalink
Add TelemetryDeck
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Aug 14, 2024
1 parent 56869e3 commit 9d11814
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@
"version" : "0.3.0"
}
},
{
"identity" : "swiftsdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/TelemetryDeck/SwiftSDK",
"state" : {
"revision" : "13a26cf125b70d695913eb9bea9f9b9c29da5790",
"version" : "2.3.0"
}
},
{
"identity" : "swiftsoup",
"kind" : "remoteSourceControl",
Expand Down
2 changes: 2 additions & 0 deletions IceCubesApp/App/Main/IceCubesApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
try? AVAudioSession.sharedInstance().setCategory(.ambient, options: .mixWithOthers)
try? AVAudioSession.sharedInstance().setActive(true)
PushNotificationsService.shared.setAccounts(accounts: AppAccountsManager.shared.pushAccounts)
Telemetry.setup()
Telemetry.signal("app.launched")
return true
}

Expand Down
3 changes: 2 additions & 1 deletion IceCubesApp/App/Tabs/Settings/AccountSettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ struct AccountSettingsView: View {
await sub.deleteSubscription()
}
appAccountsManager.delete(account: appAccount)
Telemetry.signal("account.removed")
dismiss()
}
}
} label: {
Text("account.action.logout")
Label("account.action.logout", systemImage: "trash")
.frame(maxWidth: .infinity)
}
}
Expand Down
4 changes: 3 additions & 1 deletion IceCubesApp/App/Tabs/Timeline/TimelineTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,11 @@ struct TimelineTab: View {
Button {
withAnimation {
if let index {
pinnedFilters.remove(at: index)
let timeline = pinnedFilters.remove(at: index)
Telemetry.signal("timeline.pin.removed", parameters: ["timeline" : timeline.rawValue])
} else {
pinnedFilters.append(timeline)
Telemetry.signal("timeline.pin.added", parameters: ["timeline" : timeline.rawValue])
}
}
} label: {
Expand Down
2 changes: 2 additions & 0 deletions PRIVACY.MD
Original file line number Diff line number Diff line change
@@ -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.

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 TelemetryDeck’s [privacy policy](https://telemetrydeck.com/privacy)
2 changes: 2 additions & 0 deletions Packages/Env/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let package = Package(
.package(name: "Models", path: "../Models"),
.package(name: "Network", path: "../Network"),
.package(url: "https://github.com/evgenyneu/keychain-swift", branch: "master"),
.package(url: "https://github.com/TelemetryDeck/SwiftSDK", from: "2.3.0")
],
targets: [
.target(
Expand All @@ -28,6 +29,7 @@ let package = Package(
.product(name: "Models", package: "Models"),
.product(name: "Network", package: "Network"),
.product(name: "KeychainSwift", package: "keychain-swift"),
.product(name: "TelemetryDeck", package: "SwiftSDK")
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency"),
Expand Down
19 changes: 19 additions & 0 deletions Packages/Env/Sources/Env/Telemetry.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI
@Observable class TimelineViewModel {
var scrollToIndex: Int?
var statusesState: StatusesState = .loading
var timeline: TimelineFilter = .federated {
var timeline: TimelineFilter = .home {
willSet {
if timeline == .home, newValue != .resume {
saveMarker()
Expand All @@ -21,6 +21,9 @@ import SwiftUI
await handleLatestOrResume(oldValue)

if oldValue != timeline {
Telemetry.signal("timeline.filter.updated",
parameters: ["timeline": timeline.rawValue])

await reset()
pendingStatusesObserver.pendingStatuses = []
tag = nil
Expand Down

0 comments on commit 9d11814

Please sign in to comment.