Skip to content

Commit

Permalink
Fix UpNext settings
Browse files Browse the repository at this point in the history
  • Loading branch information
bjtitus committed Apr 10, 2024
1 parent 5768f88 commit ab00f17
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,29 @@ extension PodcastSettings {
}
}
set {
switch newValue {
case .addFirst:
addToUpNext = true
addToUpNextPosition = .top
case .addLast:
addToUpNext = true
addToUpNextPosition = .bottom
case .off:
addToUpNext = false
addToUpNext = newValue.enabled
if let position = newValue.position {
addToUpNextPosition = position
}
}
}
}

public extension AutoAddToUpNextSetting {
var enabled: Bool {
get {
return self != .off
}
}

var position: UpNextPosition? {
switch self {
case .addFirst:
return .top
case .addLast:
return .bottom
case .off:
return nil
}
}
}
5 changes: 4 additions & 1 deletion podcasts/DataManager+Import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ extension DataManager {
}

if let setting = AutoAddToUpNextSetting(rawValue: podcast.autoAddToUpNext) {
podcast.settings.autoUpNextSetting = setting
podcast.settings.addToUpNext = setting.enabled
if let position = setting.position {
podcast.settings.addToUpNextPosition = position
}
}

save(podcast: podcast, cache: idx == podcasts.endIndex)
Expand Down

0 comments on commit ab00f17

Please sign in to comment.