Skip to content

Commit

Permalink
Fire a pixel directly from PreferencesDuckPlayerView
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed May 9, 2024
1 parent 2e70915 commit fa0a381
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 0 additions & 10 deletions DuckDuckGo/Preferences/Model/DuckPlayerPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ final class DuckPlayerPreferences: ObservableObject {
var duckPlayerMode: DuckPlayerMode {
didSet {
persistor.duckPlayerModeBool = duckPlayerMode.boolValue
if oldValue != duckPlayerMode {
switch duckPlayerMode {
case .enabled:
PixelKit.fire(GeneralPixel.duckPlayerSettingAlwaysSettings)
case .alwaysAsk:
PixelKit.fire(GeneralPixel.duckPlayerSettingBackToDefault)
case .disabled:
PixelKit.fire(GeneralPixel.duckPlayerSettingNeverSettings)
}
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions DuckDuckGo/Preferences/View/PreferencesDuckPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import PreferencesViews
import PixelKit
import SwiftUI
import SwiftUIExtensions

Expand All @@ -30,6 +31,14 @@ extension Preferences {
model.duckPlayerMode
} set: { newValue in
model.duckPlayerMode = newValue
switch model.duckPlayerMode {
case .enabled:
PixelKit.fire(GeneralPixel.duckPlayerSettingAlwaysSettings)
case .alwaysAsk:
PixelKit.fire(GeneralPixel.duckPlayerSettingBackToDefault)
case .disabled:
PixelKit.fire(GeneralPixel.duckPlayerSettingNeverSettings)
}
}
}

Expand Down

0 comments on commit fa0a381

Please sign in to comment.