Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Mail/Views/Thread/Message/MessageBannerHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct MessageBannerHeaderView: View {
showBottomSeparator: showBottomSeparator
) {
Button(MailResourcesStrings.Localizable.alertBlockedImagesDisplayContent) {
trackBannerEvent(for: banner)
withAnimation {
$message.localSafeDisplay.wrappedValue = true
}
Expand All @@ -68,6 +69,7 @@ struct MessageBannerHeaderView: View {
actionTitle: spamType.buttonTitle,
showBottomSeparator: showBottomSeparator
) {
trackBannerEvent(for: banner)
await spamAction(spamType: spamType)
}
case .unsubscribeLink:
Expand Down Expand Up @@ -113,6 +115,7 @@ struct MessageBannerHeaderView: View {

private func unsubscribeAction() async {
@InjectService var snackbarPresenter: IKSnackBarPresentable
trackBannerEvent(for: .unsubscribeLink)
do {
try await mailboxManager.apiFetcher.unsubscribe(messageResource: message.resource)
snackbarPresenter.show(message: MailResourcesStrings.Localizable.snackbarUnsubscribeSuccess)
Expand All @@ -126,6 +129,7 @@ struct MessageBannerHeaderView: View {

private func acknowledgeAction() async {
@InjectService var snackbarPresenter: IKSnackBarPresentable
trackBannerEvent(for: .acknowledge)
do {
try await mailboxManager.apiFetcher.acknowledgeMessage(messageResource: message.resource)
try mailboxManager.transactionExecutor.writeTransaction { realm in
Expand All @@ -141,6 +145,11 @@ struct MessageBannerHeaderView: View {
snackbarPresenter.show(message: MailResourcesStrings.Localizable.snackbarAcknowledgementFailure)
}
}

private func trackBannerEvent(for banner: MessageBanner) {
@InjectService var matomo: MatomoUtils
matomo.track(eventWithCategory: .messageBanner, name: banner.matomoName)
}
}

#Preview {
Expand Down
3 changes: 3 additions & 0 deletions Mail/Views/Thread/Message/MessageEncryptionHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import DesignSystem
import InfomaniakCoreCommonUI
import InfomaniakDI
import MailCore
import MailCoreUI
Expand Down Expand Up @@ -59,6 +60,8 @@ struct MessageEncryptionHeaderView: View {
) {
if !message.autoEncryptDisabledRecipients.isEmpty {
Button(MailResourcesStrings.Localizable.encryptedButtonSeeConcernedRecipients) {
@InjectService var matomo: MatomoUtils
matomo.track(eventWithCategory: .messageBanner, name: MessageBanner.encrypted.matomoName)
isShowingRecipients = true
}
.tint(MailResourcesAsset.iconSovereignBlueColor.swiftUIColor)
Expand Down
8 changes: 8 additions & 0 deletions Mail/Views/Thread/Message/MessageScheduleHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import InfomaniakCoreCommonUI
import InfomaniakCoreSwiftUI
import InfomaniakDI
import MailCore
import MailResources
import SwiftModalPresentation
Expand Down Expand Up @@ -66,6 +68,12 @@ struct MessageScheduleHeaderView: View {
private func changeScheduleDate(_ selectedDate: Date?) {
guard let selectedDate else { return }

@InjectService var matomo: MatomoUtils
matomo.track(
eventWithCategory: .messageBanner,
name: MessageBanner.schedule(scheduleDate: scheduleDate, draftResource: draftResource).matomoName
)

Task {
await tryOrDisplayError {
try await mailboxManager.apiFetcher.changeDraftSchedule(
Expand Down
17 changes: 17 additions & 0 deletions MailCore/Models/MessageBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ public enum MessageBanner: Equatable, Identifiable, Hashable {
return hashValue
}

public var matomoName: String {
switch self {
case .schedule:
return "modifySchedule"
case .spam:
return "spam"
case .displayContent:
return "displayContent"
case .encrypted:
return "encryption"
case .unsubscribeLink:
return "unsubscribeLink"
case .acknowledge:
return "acknowledge"
}
}

case schedule(scheduleDate: Date, draftResource: String)
case spam(spamType: SpamHeaderType)
case displayContent
Expand Down
1 change: 1 addition & 0 deletions MailCore/Utils/Matomo+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public extension MatomoUtils.EventCategory {
static let mailPremiumUpgradeBottomSheet = MatomoUtils.EventCategory(displayName: "mailPremiumUpgradeBottomSheet")
static let menuDrawer = MatomoUtils.EventCategory(displayName: "menuDrawer")
static let message = MatomoUtils.EventCategory(displayName: "message")
static let messageBanner = MatomoUtils.EventCategory(displayName: "messageBanner")
static let multiSelection = MatomoUtils.EventCategory(displayName: "multiSelection")
static let myKSuite = MatomoUtils.EventCategory(displayName: "myKSuite")
static let myKSuiteUpgradeBottomSheet = MatomoUtils.EventCategory(displayName: "myKSuiteUpgradeBottomSheet")
Expand Down
Loading