RES-32 Ajouter la possibilité désactiver des traqueurs spécifiques
Some checks failed
gitea-openium/resgen.swift/pipeline/pr-master There was a failure building this commit

This commit is contained in:
2025-02-12 10:49:06 +01:00
parent 821af9ee08
commit ae69a63a6a
6 changed files with 205 additions and 59 deletions

View File

@@ -11,11 +11,12 @@ enum MatomoGenerator {
static var service: String {
[
Self.header,
Self.setup,
Self.logScreen,
Self.logEvent,
Self.footer
MatomoGenerator.header,
MatomoGenerator.setup,
MatomoGenerator.logScreen,
MatomoGenerator.logEvent,
MatomoGenerator.enable,
MatomoGenerator.footer
]
.joined(separator: "\n")
}
@@ -71,7 +72,6 @@ enum MatomoGenerator {
path: String,
params: [String: Any]?
) {
guard !tracker.isOptedOut else { return }
guard let trackerUrl = tracker.contentBase?.absoluteString else { return }
let urlString = URL(string: "\\(trackerUrl)" + "/" + "\\(path)" + "iOS")
@@ -92,8 +92,6 @@ enum MatomoGenerator {
category: String,
params: [String: Any]?
) {
guard !tracker.isOptedOut else { return }
tracker.track(
eventWithCategory: category,
action: action,
@@ -102,6 +100,15 @@ enum MatomoGenerator {
url: nil
)
}
"""
}
private static var enable: String {
"""
func setEnable(_ enable: Bool) {
tracker.isOptedOut = !enable
}
"""
}