polish iOS study flow
This commit is contained in:
@@ -2,11 +2,14 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
struct HermesApp: App {
|
||||
@StateObject private var analytics = HermesAnalyticsClient()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
RootView()
|
||||
.preferredColorScheme(.dark)
|
||||
.tint(HermesTheme.accent)
|
||||
.environmentObject(analytics)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import SwiftUI
|
||||
|
||||
struct RootView: View {
|
||||
@StateObject private var localization = LocalizationStore()
|
||||
@EnvironmentObject private var analytics: HermesAnalyticsClient
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
@@ -20,6 +21,10 @@ struct RootView: View {
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
.environmentObject(localization)
|
||||
.onAppear {
|
||||
analytics.track("app_opened", attributes: ["screen_name": "home"])
|
||||
analytics.track("screen_viewed", attributes: ["screen_name": "home"])
|
||||
}
|
||||
}
|
||||
|
||||
private var header: some View {
|
||||
@@ -51,6 +56,7 @@ struct RootView: View {
|
||||
|
||||
return Button {
|
||||
localization.setLocale(localeCode)
|
||||
analytics.track("locale_changed", attributes: ["locale_code": localeCode])
|
||||
} label: {
|
||||
Text(title)
|
||||
.font(.caption.weight(.bold))
|
||||
|
||||
Reference in New Issue
Block a user