Skip to content

Commit

Permalink
feat: Matomo
Browse files Browse the repository at this point in the history
  • Loading branch information
lebojo committed Jan 9, 2025
1 parent 9233cd9 commit 67441ca
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Mail/Views/Alerts/CustomScheduleAlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

import InfomaniakCoreCommonUI
import InfomaniakCoreSwiftUI
import InfomaniakDI
import MailCore
import MailCoreUI
import MailResources
import SwiftUI

struct CustomScheduleAlertView: View {
@LazyInjectService private var matomo: MatomoUtils

@State private var isShowingError = false
@State private var selectedDate: Date

Expand Down Expand Up @@ -78,5 +81,6 @@ struct CustomScheduleAlertView: View {
return
}
confirmAction(selectedDate)
matomo.track(eventWithCategory: .scheduleSend, name: "customSchedule")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import InfomaniakCoreCommonUI
import InfomaniakCoreSwiftUI
import InfomaniakDI
import MailCore
import MailCoreUI
import SwiftUI

struct ScheduleOptionView: View {
@LazyInjectService private var matomo: MatomoUtils

@Environment(\.dismiss) private var dismiss

let option: ScheduleSendOption
Expand All @@ -31,6 +36,7 @@ struct ScheduleOptionView: View {
var body: some View {
if let scheduleDate = option.date {
Button {
matomo.track(eventWithCategory: .scheduleSend, name: option.matomoName)
setScheduleAction(scheduleDate)
dismiss()
} label: {
Expand Down
21 changes: 21 additions & 0 deletions Mail/Views/New Message/Scheduled panel/ScheduleSendOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,27 @@ enum ScheduleSendOption: Identifiable, Equatable {
}
}

var matomoName: String {
switch self {
case .laterThisMorning:
"laterThisMorning"
case .thisAfternoon:
"thisAfternoon"
case .thisEvening:
"thisEvening"
case .tomorrowMorning:
"tomorrowMorning"
case .nextMonday:
"nextMonday"
case .nextMondayMorning:
"nextMondayMorning"
case .nextMondayAfternoon:
"nextMondayAfternoon"
case .lastSchedule(let value):
"lastSchedule"
}
}

static var allSimpleCases: [ScheduleSendOption] = [
.laterThisMorning,
.thisAfternoon,
Expand Down
4 changes: 3 additions & 1 deletion MailCore/Utils/Matomo+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public extension MatomoUtils.EventCategory {
static let promptAIEngine = MatomoUtils.EventCategory(displayName: "promptAiEngine")
static let replyBottomSheet = MatomoUtils.EventCategory(displayName: "replyBottomSheet")
static let restoreEmailsBottomSheet = MatomoUtils.EventCategory(displayName: "restoreEmailsBottomSheet")
static let scheduleSend = MatomoUtils.EventCategory(displayName: "scheduleSend")
static let search = MatomoUtils.EventCategory(displayName: "search")
static let setAsDefaultApp = MatomoUtils.EventCategory(displayName: "setAsDefaultApp")
static let snackbar = MatomoUtils.EventCategory(displayName: "snackbar")
Expand Down Expand Up @@ -94,6 +93,9 @@ public extension MatomoUtils.EventCategory {
static let settingsThreadMode = MatomoUtils.EventCategory(displayName: "settingsThreadMode")
static let settingsAutoAdvance = MatomoUtils.EventCategory(displayName: "settingsAutoAdvance")
static let settingsDataPrivacy = MatomoUtils.EventCategory(displayName: "settingsDataPrivacy")

// Schedule send
static let scheduleSend = MatomoUtils.EventCategory(displayName: "scheduleSend")
}

// MARK: - Helpers
Expand Down

0 comments on commit 67441ca

Please sign in to comment.