before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
guard let self = self else { return }
self.updateNavigationButtons()
}
}
private func loadBannerAd() {
if FeatureFlag.bannerAdPodcasts.enabled && !SubscriptionHelper.hasActiveSubscription() {
bannerTask?.cancel()
DiscoverServerHandler.shared.blaz... | The only thing I wonder if whether `bannerTask?.cancel()` should be added here or moved outside of the `if FeatureFlag.bannerAdPodcasts.enabled && !SubscriptionHelper.hasActiveSubscription() {` block.
I'm not sure it really matters much but I could see a theoretical case where the task is running and flag or subscri... | guard let self = self else { return }
self.updateNavigationButtons()
}
}
private func loadBannerAd() {
bannerTask?.cancel()
if FeatureFlag.bannerAdPodcasts.enabled && !SubscriptionHelper.hasActiveSubscription() {
DiscoverServerHandler.shared.blazePr... | @@ -177,6 +177,17 @@ class PodcastListViewController: PCViewController, UIGestureRecognizerDelegate,
self.setupBannerAd(promotion: promotion, shouldAnimate: false)
}
}
+ } else {
+ if bannerAdModel != nil { | podcasts/PodcastListViewController.swift | 26 | Swift | 0.786 | refactor | 363 | 51 | 51 | false | [Hotfix] Remove banner when the view will appear if necessary | 3,511 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | danielebogo |
// If we're already the now playing episode, then just seek to the bookmark time
if isNowPlayingEpisode(episodeUuid: bookmark.episodeUuid) {
seekTo(time: bookmark.time, startPlaybackAfterSeek: true)
return
}
#if !os(watchOS)
// Save the playback time bef... | Can this be a guard and return early? |
// If we're already the now playing episode, then just seek to the bookmark time
if isNowPlayingEpisode(episodeUuid: bookmark.episodeUuid) {
seekTo(time: bookmark.time, startPlaybackAfterSeek: true)
return
}
#if !os(watchOS)
// Save the playback time bef... | @@ -2347,4 +2347,28 @@ extension PlaybackManager {
}
}
+// MARK: - SearchResults
+extension PlaybackManager {
+
+ func playEpisodeSearchResult(_ searchEpisode: EpisodeSearchResult, firstTry: Bool = true) {
+ let dataManager = DataManager.sharedManager
+
+ // Get the bookmark's BaseEpisode so we... | podcasts/PlaybackManager.swift | 26 | Swift | 0.071 | question | 37 | 43 | 42 | false | [Search Improvements] Add direct play button | 3,518 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let type = try container.decode(String.self, forKey: .type)
switch type {
case "term":
let value = try container.decode(String.self, forKey: .value)
... | Should this be `"autocomplete/search")`?
```suggestion
var components = URLComponents(string: ServerConstants.Urls.search + "autocomplete/search")
``` | public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let type = try container.decode(String.self, forKey: .type)
switch type {
case "term":
let value = try container.decode(String.self, forKey: .value)
... | @@ -0,0 +1,67 @@
+import Foundation
+
+struct PredictiveSearchEnvelope: Decodable {
+ public let results: [PredictiveSearchResult]
+}
+
+public struct PredictivePodcastSearchResult: Codable, Hashable {
+ let uuid: String
+ let title: String
+ let author: String
+}
+
+public enum PredictiveSearchResultType: ... | Modules/Server/Sources/PocketCastsServer/Public/Search/PredictiveSearchTask.swift | 26 | Swift | 0.786 | suggestion | 160 | 42 | 42 | false | [Search Improvements] Predictive search | 3,525 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
// MARK: - Up Next
func inUpNext(episode: BaseEpisode?) -> Bool {
#if APPCLIP
return false
#else
guard let episode = episode else { return false }
return queue.contains(episode: episode)
#endif
}
func addToUpNext(episode: BaseEpisode, ignoringQueueLimit... | @bjtitus I agree about not adding the FF. Maybe add a log for when this happens? Wdyt? |
// MARK: - Up Next
func inUpNext(episode: BaseEpisode?) -> Bool {
#if APPCLIP
return false
#else
guard let episode = episode else { return false }
return queue.contains(episode: episode)
#endif
}
func addToUpNext(episode: BaseEpisode, ignoringQueueLimit... | @@ -547,6 +547,12 @@ class PlaybackManager: ServerPlaybackDelegate {
AnalyticsEpisodeHelper.shared.episodeAddedToUpNext(episode: episode, toTop: toTop)
}
+ // If we don't have a current episode, reload the persisted queue to updated our cache just in case
+ // We're getting reports... | podcasts/PlaybackManager.swift | 26 | Swift | 0.214 | question | 87 | 51 | 51 | false | Up Next clearing | 3,548 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | bjtitus |
extension Color {
static let endOfYear2025Background = Color(hex: "28486A")
}
struct IntroStory2025: StoryView {
let identifier: String = "cover"
let backgroundColor = Color.endOfYear2025Background
let backgroundTextColor = Color.white
@State private var opacity = CGFloat(0)
@State private va... | Question: would it make sense to observe the animation progress or frame and start the animation based on it, rather than using a delay? If for some reason the animation gets stuck for a sec but the delay doesn't, what happens? | extension Color {
static let endOfYear2025Background = Color(hex: "28486A")
}
struct IntroStory2025: StoryView {
let identifier: String = "cover"
let backgroundColor = Color.endOfYear2025Background
let backgroundTextColor = Color.white
@State private var opacity = CGFloat(0)
@State private va... | @@ -0,0 +1,61 @@
+import SwiftUI
+import Lottie
+
+extension Color {
+ static let endOfYear2025Background = Color(hex: "28486A")
+}
+
+struct IntroStory2025: StoryView {
+ let identifier: String = "cover"
+
+ let backgroundColor = Color.endOfYear2025Background
+ let backgroundTextColor = Color.white
+
+ ... | podcasts/End of Year/Stories/2025/IntroStory2025.swift | 26 | Swift | 0.429 | question | 227 | 51 | 51 | false | [Playback 2025] Intro Story | 3,571 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
var placeholderText = L10n.searchLabel {
didSet {
if isViewLoaded {
updatePlaceholderColor()
}
}
}
var backgroundColorOverride: UIColor?
var startWithToolbarHidden = true
weak var searchDelegate: PCSearchBarDelegate?
private var isVisi... | I believe there's a Trailing Whitespace here |
var placeholderText = L10n.searchLabel {
didSet {
if isViewLoaded {
updatePlaceholderColor()
}
}
}
var backgroundColorOverride: UIColor?
var startWithToolbarHidden = true
weak var searchDelegate: PCSearchBarDelegate?
private var isVisi... | @@ -68,7 +68,7 @@ class PCSearchBarController: UIViewController {
}
override func viewDidAppear(_ animated: Bool) {
- super.viewDidAppear(animated)
+ super.viewDidAppear(animated) | podcasts/PCSearchBarController.swift | 26 | Swift | 0.071 | nitpick | 44 | 51 | 51 | false | [Search improvements] Local predictive search | 3,587 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
import SwiftUI
import PocketCastsUtils
import PocketCastsServer
struct PredictiveList: View {
@EnvironmentObject var theme: Theme
@EnvironmentObject var searchAnalyticsHelper: SearchAnalyticsHelper
@EnvironmentObject var searchResults: SearchResultsModel
@EnvironmentObject var searchHistory: SearchHis... | Maybe just return false directly with no else?
```suggestion
}
return false
``` | import SwiftUI
import PocketCastsUtils
import PocketCastsServer
struct PredictiveList: View {
@EnvironmentObject var theme: Theme
@EnvironmentObject var searchAnalyticsHelper: SearchAnalyticsHelper
@EnvironmentObject var searchResults: SearchResultsModel
@EnvironmentObject var searchHistory: SearchHis... | @@ -9,33 +9,74 @@ struct PredictiveList: View {
@EnvironmentObject var searchResults: SearchResultsModel
@EnvironmentObject var searchHistory: SearchHistoryModel
- var body: some View {
- ForEach(searchResults.predictive, id: \.self) { predictiveSearch in
- switch predictiveSearch.type ... | podcasts/New Search/Views/Results/PredictiveList.swift | 18 | Swift | 0.714 | suggestion | 107 | 43 | 43 | false | [Search improvements] Local predictive search | 3,587 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
case .episode:
queryString =
"""
\(manualCTE)
SELECT episode.*
\(manualJoin)
\(shouldShowArchived ? "" : "WHERE episode.archived = 0")
"""
case .episodeCount:
... | @bjtitus mentioning this one here as well: do we need the WHERE here? | case .episode:
queryString =
"""
\(manualCTE)
SELECT episode.*
\(manualJoin)
\(shouldShowArchived ? "" : "WHERE episode.archived = 0")
"""
case .episodeCount:
... | @@ -95,7 +95,7 @@ public class PlaylistQueryBuilder {
"""
case .podcast:
let select = manualSelect(clause: clause, for: playlist)
- queryString = "\(select) WHERE episode.archived = 0"
+ queryString = "\(select) WHERE" | Modules/DataModel/Sources/PocketCastsDataModel/Public/PlaylistQueryBuilder.swift | 26 | Swift | 0.214 | question | 69 | 51 | 51 | false | [Playlists] Unavailable Episodes | 3,598 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | bjtitus |
.foregroundStyle(theme.primaryText02)
Text(episode.title ?? "")
.font(size: 15.0, style: .body, weight: .medium)
.foregroundStyle(theme.primaryText01)
HStack {
if episode.archived {
... | @bjtitus I think there are missing parts here. Have a look at the same file ins [this commit](https://github.com/Automattic/pocket-casts-ios/commit/f84191c0080bd979f7f1f85ff5da03d181353451#diff-1dc5bd41a77242427dc22f40d36906b2a7229717a0360c360f119fe67204ec38) | .frame(height: 1)
.if(hideSeparator) {
$0.hidden()
}
}
HStack(spacing: 11.0) {
PlaylistEpisodeImageViewWrapper(
episode: episode,
size: .list
... | @@ -49,16 +49,27 @@ struct PlaylistEpisodePreviewRowView: View {
.foregroundColor(theme.primaryText02)
.frame(width: 12, height: 12)
}
- Text(subtitle)
- .font(size: 12.0, style: ... | podcasts/New Creation/New Preview/Rules/Episode Preview/PlaylistEpisodePreviewRowView.swift | 26 | Swift | 0.571 | suggestion | 259 | 51 | 51 | false | [Playlists] Unavailable Episodes | 3,598 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | bjtitus |
HStack(spacing: 12) {
(model.episode?.podcastUuid ?? model.podcastFolder?.uuid).map {
SearchEntryImage(uuid: $0, kind: model.podcastFolder?.kind)
}
VStack(alignment: .leading, spacing: 2) {
if le... | @bjtitus Can we wrap these in computed properties based on the episode state? | return nil
case .archived:
return L10n.podcastArchived
case .unavailable:
return L10n.podcastUnavailable
}
}
var body: some View {
ZStack {
Button(action: {
if let action {
action()
... | @@ -57,10 +57,24 @@ struct SearchResultCell: View {
.font(style: .subheadline, weight: .medium)
.foregroundColor(AppTheme.color(for: .primaryText01, theme: theme))
.lineLimit(2)
- Text(TimeForma... | podcasts/New Search/Views/Results/SearchResultCell.swift | 26 | Swift | 0.214 | question | 78 | 51 | 51 | false | [Playlists] Unavailable Episodes | 3,598 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | bjtitus |
import CoreServices
import Foundation
import JLRoutes
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
extension AppDelegate {
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
... | The new route is enabled only for TF builds | // if we're subscribed to the podcast, we'll likely have this episode, just open it
if podcast.isSubscribed() {
openEpisode(episodeUuid, from: podcast, timestamp: timestamp)
} else { // if we're not subscribed, than it's possible our local copy is out of date, so we'l... | @@ -533,4 +534,30 @@ extension AppDelegate {
}
})
}
+
+ private func setupTestFlightIAPRoutes() {
+ if BuildEnvironment.current != .testFlight { | podcasts/AppDelegate+UrlHandling.swift | 26 | Swift | 0.071 | suggestion | 43 | 537 | 51 | false | [TF] Register new route to test IAP in TF builds | 3,599 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | danielebogo |
private var productIdentifiers: [IAPProductID] {
[.monthly, .yearly, .patronMonthly, .patronYearly, .yearlyReferral]
}
private var productsArray = [SKProduct]()
private var requestedPurchase: String!
private var productsRequest: SKProductsRequest?
/// Whether or not the user is eligibl... | I converted this into a computed property to don't have to restart the app each time |
private var productIdentifiers: [IAPProductID] {
[.monthly, .yearly, .patronMonthly, .patronYearly, .yearlyReferral]
}
private var productsArray = [SKProduct]()
private var requestedPurchase: String!
private var productsRequest: SKProductsRequest?
/// Whether or not the user is eligibl... | @@ -24,7 +24,14 @@ class IAPHelper: NSObject {
private var isRequestingProducts = false
/// Whether purchasing is allowed in the current environment or not
- private(set) var canMakePurchases = BuildEnvironment.current != .testFlight
+ var canMakePurchases: Bool {
+ switch BuildEnvironment.curr... | podcasts/IAPHelper.swift | 26 | Swift | 0.214 | suggestion | 84 | 51 | 51 | false | [TF] Register new route to test IAP in TF builds | 3,599 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | danielebogo |
// MARK: - New Filter Tip
static var shouldShowNewFilterTip: Bool {
get {
UserDefaults.standard.value(forKey: Constants.UserDefaults.newFilterTip) as? Bool ?? true
}
set {
UserDefaults.standard.setValue(newValue, forKey: Constants.UserDefaults.newFilterTip)
... | For safety reasons, I decided to don't store the value in `UserDefaults`. This var will always be false at every app startup. Wdyt? |
// MARK: - New Filter Tip
static var shouldShowNewFilterTip: Bool {
get {
UserDefaults.standard.value(forKey: Constants.UserDefaults.newFilterTip) as? Bool ?? true
}
set {
UserDefaults.standard.setValue(newValue, forKey: Constants.UserDefaults.newFilterTip)
... | @@ -1516,6 +1516,10 @@ class Settings: NSObject {
}
}
+ // MARK: - New Filter Tip
+
+ static var shouldEnableIAPInTestFlightBuilds: Bool = false | podcasts/Settings.swift | 26 | Swift | 0.571 | question | 131 | 51 | 51 | false | [TF] Register new route to test IAP in TF builds | 3,599 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | danielebogo |
guard
let vc = FeatureFlag.playlistsRebranding.enabled ? smartPlaylistsTip() : filtersTip()
else {
return
}
newFilterTip = vc
Analytics.track(.filterTooltipShown)
present(vc, animated: true) {
Settings.shouldShowNewFilterTip = false
... | Should this code stay commented? or deleted | guard
let vc = FeatureFlag.playlistsRebranding.enabled ? smartPlaylistsTip() : filtersTip()
else {
return
}
newFilterTip = vc
Analytics.track(.filterTooltipShown)
present(vc, animated: true) {
Settings.shouldShowNewFilterTip = false
... | @@ -152,18 +152,22 @@ extension PlaylistsViewController {
}
private func dismissTipView() {
- dismiss(animated: true, completion: nil)
+ dismiss(animated: true) { [weak self] in
+ self?.newFilterTip = nil
+ }
Analytics.track(.filterTooltipClosed)
}
- func s... | podcasts/PlaylistsViewController+Table.swift | 26 | Swift | 0.143 | suggestion | 43 | 51 | 51 | false | [Playlists] Present new tip | 3,602 | Automattic/pocket-casts-ios | 1,136 | Swift | SergioEstevao | danielebogo |
newSelectedPlaylists = initialSelectedPlaylists
}
private func addCloseButton() {
let closeButton = createStandardCloseButton(imageName: "cancel")
closeButton.addTarget(self, action: #selector(closeTapped(_:)), for: .touchUpInside)
let backButtonItem = UIBarButtonItem(customVie... | We should use a `ToastTheme` to inject and set the left icon
<img width="523" height="105" alt="Screenshot 2025-10-30 at 09 40 46" src="https://github.com/user-attachments/assets/807fb39e-8bc2-42af-9d88-37fae549e4e9" />
| newSelectedPlaylists = initialSelectedPlaylists
}
private func addCloseButton() {
let closeButton = createStandardCloseButton(imageName: "cancel")
closeButton.addTarget(self, action: #selector(closeTapped(_:)), for: .touchUpInside)
let backButtonItem = UIBarButtonItem(customVie... | @@ -152,7 +152,11 @@ class ManualPlaylistsChooserViewController: PCViewController {
manualPlaylists.forEach { playlist in
if added.contains(playlist.uuid) {
- dataManager.add(episodes: [episode], to: playlist)
+ let didAdd = dataManager.add(episodes: [episode], to: ... | podcasts/New Detail/Episode Add/ManualPlaylistsChooserViewController.swift | 26 | Swift | 0.786 | suggestion | 222 | 51 | 51 | false | [Playlists] Add manual playlist episodes events | 3,629 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | bjtitus |
import SwiftUI
import PocketCastsServer
struct StoryHeader2025: View {
let title: String?
let description: String?
let subscriptionTier: SubscriptionTier?
let addTopPadding: Bool
init(title: String? = nil, description: String? = nil, subscriptionTier: SubscriptionTier? = nil, addTopPadding: Bool =... | It looks like this is always true... do we actually need it, or can we just always add the padding? | import SwiftUI
import PocketCastsServer
struct StoryHeader2025: View {
let title: String?
let description: String?
let subscriptionTier: SubscriptionTier?
init(title: String? = nil, description: String? = nil, subscriptionTier: SubscriptionTier? = nil) {
self.title = title
self.descrip... | @@ -2,34 +2,39 @@ import SwiftUI
import PocketCastsServer
struct StoryHeader2025: View {
- let title: String
+ let title: String?
let description: String?
let subscriptionTier: SubscriptionTier?
+ let addTopPadding: Bool | podcasts/End of Year/Stories/2025/StoryHeader2025.swift | 8 | Swift | 0.214 | question | 99 | 33 | 33 | false | [Playback 25] Top 5 Podcasts | 3,653 | Automattic/pocket-casts-ios | 1,136 | Swift | joshheald | danielebogo |
import SwiftUI
import PocketCastsServer
struct StoryHeader2025: View {
let title: String?
let description: String?
let subscriptionTier: SubscriptionTier?
let addTopPadding: Bool
init(title: String? = nil, description: String? = nil, subscriptionTier: SubscriptionTier? = nil, addTopPadding: Bool =... | Center is the default, perhaps we can leave this out? | import SwiftUI
import PocketCastsServer
struct StoryHeader2025: View {
let title: String?
let description: String?
let subscriptionTier: SubscriptionTier?
init(title: String? = nil, description: String? = nil, subscriptionTier: SubscriptionTier? = nil) {
self.title = title
self.descrip... | @@ -2,34 +2,39 @@ import SwiftUI
import PocketCastsServer
struct StoryHeader2025: View {
- let title: String
+ let title: String?
let description: String?
let subscriptionTier: SubscriptionTier?
+ let addTopPadding: Bool
- init(title: String, description: String? = nil, subscriptionTier: Sub... | podcasts/End of Year/Stories/2025/StoryHeader2025.swift | 18 | Swift | 0.214 | question | 53 | 41 | 37 | false | [Playback 25] Top 5 Podcasts | 3,653 | Automattic/pocket-casts-ios | 1,136 | Swift | joshheald | danielebogo |
closeButton.addTarget(self, action: #selector(closeTapped(_:)), for: .touchUpInside)
let backButtonItem = UIBarButtonItem(customView: closeButton)
navigationItem.leftBarButtonItem = backButtonItem
}
@objc private func closeTapped(_ sender: Any) {
dismiss(animated: true, complet... | I don't think it's necessary here as the data manager here calls the `PlaylistDataManager` and the method `func deleteEpisodes(_ episodeUuids: [String], from playlist: EpisodeFilter, dbQueue: PCDBQueue)` already set the playlist as not synced:
```
playlist.syncStatus = SyncStatus.notSynced.rawValue
t... | closeButton.addTarget(self, action: #selector(closeTapped(_:)), for: .touchUpInside)
let backButtonItem = UIBarButtonItem(customView: closeButton)
navigationItem.leftBarButtonItem = backButtonItem
}
@objc private func closeTapped(_ sender: Any) {
dismiss(animated: true, complet... | @@ -158,15 +158,24 @@ class ManualPlaylistsChooserViewController: PCViewController {
FileLog.shared.console("Added \(added), removed \(removed)")
+ var changedPlaylists: Set<EpisodeFilter> = []
+
manualPlaylists.forEach { playlist in
if added.contains(playlist.uuid) {
... | podcasts/New Detail/Episode Add/ManualPlaylistsChooserViewController.swift | 26 | Swift | 0.786 | suggestion | 468 | 51 | 51 | false | Playlists: ensure changed playlists are marked to sync | 3,660 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | leandroalonso |
@objc private func closeTapped(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
@objc private func doneTapped() {
let added = newSelectedPlaylists.subtracting(initialSelectedPlaylists)
let removed = initialSelectedPlaylists.subtracting(newSelectedPlaylists)
FileL... | You can use `dataManager` instead of `DataManager.sharedManager` | @objc private func closeTapped(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
@objc private func doneTapped() {
let added = newSelectedPlaylists.subtracting(initialSelectedPlaylists)
let removed = initialSelectedPlaylists.subtracting(newSelectedPlaylists)
FileL... | @@ -158,15 +158,24 @@ class ManualPlaylistsChooserViewController: PCViewController {
FileLog.shared.console("Added \(added), removed \(removed)")
+ var changedPlaylists: Set<EpisodeFilter> = []
+
manualPlaylists.forEach { playlist in
if added.contains(playlist.uuid) {
... | podcasts/New Detail/Episode Add/ManualPlaylistsChooserViewController.swift | 26 | Swift | 0.429 | suggestion | 64 | 51 | 51 | false | Playlists: ensure changed playlists are marked to sync | 3,660 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | leandroalonso |
}
private func addCloseButton() {
let closeButton = createStandardCloseButton(imageName: "cancel")
closeButton.addTarget(self, action: #selector(closeTapped(_:)), for: .touchUpInside)
let backButtonItem = UIBarButtonItem(customView: closeButton)
navigationItem.leftBarButtonItem... | As the delete method below, would it make sense to save the playlist each time a batch of episodes is added? Wdyt? | }
private func addCloseButton() {
let closeButton = createStandardCloseButton(imageName: "cancel")
closeButton.addTarget(self, action: #selector(closeTapped(_:)), for: .touchUpInside)
let backButtonItem = UIBarButtonItem(customView: closeButton)
navigationItem.leftBarButtonItem... | @@ -158,15 +158,24 @@ class ManualPlaylistsChooserViewController: PCViewController {
FileLog.shared.console("Added \(added), removed \(removed)")
+ var changedPlaylists: Set<EpisodeFilter> = []
+
manualPlaylists.forEach { playlist in
if added.contains(playlist.uuid) {
... | podcasts/New Detail/Episode Add/ManualPlaylistsChooserViewController.swift | 26 | Swift | 0.357 | performance | 114 | 51 | 51 | false | Playlists: ensure changed playlists are marked to sync | 3,660 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | leandroalonso |
dbQueue.write { db in
do {
let inClause = DataHelper.convertArrayToInString(episodeUuids)
try db.executeUpdate("DELETE FROM \(DataManager.playlistEpisodeTableName) WHERE playlist_uuid = ? AND episodeUuid IN (\(inClause))", values: [playlist.uuid])
let ... | This is ugly as hell.
But for this user case we don't want to mark playlist as unsynced and do all the work the other method does. We just want to delete this playlist.
Changing the current method is not a good choice so I'm just going with this one for now. | dbQueue.write { db in
do {
let inClause = DataHelper.convertArrayToInString(episodeUuids)
try db.executeUpdate("DELETE FROM \(DataManager.playlistEpisodeTableName) WHERE playlist_uuid = ? AND episodeUuid IN (\(inClause))", values: [playlist.uuid])
let ... | @@ -288,6 +288,19 @@ class PlaylistDataManager {
}
}
+ /// Just delete episodes from a playlist and nothing more
+ func rawDeleteEpisodes(_ episodeUuids: [String], from playlist: EpisodeFilter, dbQueue: PCDBQueue) { | Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/PlaylistDataManager.swift | 26 | Swift | 0.5 | suggestion | 260 | 51 | 51 | false | Playlists: handle episode deletion in incremental sync | 3,661 | Automattic/pocket-casts-ios | 1,136 | Swift | leandroalonso | leandroalonso |
import SwiftUI
import AVKit
import PocketCastsServer
import PocketCastsUtils
struct CustomVideoPlayerView: UIViewControllerRepresentable {
let player: AVPlayer
func makeUIViewController(context: Context) -> AVPlayerViewController {
let controller = AVPlayerViewController()
controller.player = ... | @SergioEstevao is it possible to also have the preview for Patron as well? Just a copy with the different tier and add the label to the previews/ | let item = AVPlayerItem(url: videoURL)
self.looper = AVPlayerLooper(player: player, templateItem: item)
player.play()
} else {
self.looper = nil
}
self.backgroundColor = backgroundColor
}
func makeUIViewController(context: Context) -> AVPl... | @@ -0,0 +1,95 @@
+import SwiftUI
+import AVKit
+import PocketCastsServer
+import PocketCastsUtils
+
+struct CustomVideoPlayerView: UIViewControllerRepresentable {
+ let player: AVPlayer
+
+ func makeUIViewController(context: Context) -> AVPlayerViewController {
+ let controller = AVPlayerViewController()
+... | podcasts/End of Year/Stories/2025/PaidStoryWallView2025.swift | 26 | Swift | 0.357 | suggestion | 145 | 96 | 32 | false | [Playback 25] Paywall Story | 3,669 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
.frame(width: geometry.size.width)
.background() {
GeometryReader { geometry in
HStack {
Spacer()
CustomVideoPlayerView(urlString: "playback_2025_plus")
... | The padding between text and button is bigger than(24). Considering the footer has 4 on each part in a vertical padding, we should add 20 here
```suggestion
.padding(.top, 20)
.padding(.bottom, 6)
``` | .frame(width: geometry.size.width)
.background() {
GeometryReader { geometry in
HStack {
Spacer()
CustomVideoPlayerView(urlString: "playback_2025_plus")
... | @@ -0,0 +1,104 @@
+import SwiftUI
+import AVKit
+import PocketCastsServer
+import PocketCastsUtils
+
+struct PaidStoryWallView2025: View {
+ let identifier = "plus_interstitial"
+
+ @StateObject private var model = PlusPricingInfoModel()
+
+ let subscriptionTier: SubscriptionTier
+
+ private let foregroundC... | podcasts/End of Year/Stories/2025/PaidStoryWallView2025.swift | 26 | Swift | 0.857 | suggestion | 236 | 51 | 51 | false | [Playback 25] Paywall Story | 3,669 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
var indices: [Int] {
let indices = (0..<itemsCount).map { (stepCounter.counter + $0) % podcasts.endIndex }
return indices
}
func calculateDimensions(for index: Int) -> (CGFloat, CGFloat, Double, CGFloat) {
let shift: CGFloat = CGFloat(index - 3)
let direction: CGFloat = shif... | Nit: maybe a computed property to be reused in both values |
var indices: [Int] {
let indices = (0..<itemsCount).map { (stepCounter.counter + $0) % podcasts.endIndex }
return indices
}
func calculateDimensions(for index: Int) -> (CGFloat, CGFloat, Double, CGFloat) {
let shift: CGFloat = CGFloat(index - 3)
let direction: CGFloat = shi... | @@ -94,12 +99,13 @@ struct NumberListened2025: ShareableStory {
ForEach(Array(zip(indices.indices, indices)), id: \.0) { (index, pos) in
let result = calculateDimensions(for: index)
podcastCover(pos, shadow: true)
- .frame(width: result.0 + (20.0 * resul... | podcasts/End of Year/Stories/2025/NumberListened2025.swift | 26 | Swift | 0.286 | nitpick | 58 | 51 | 51 | false | [Playback 2025 ]Fix animation for covers | 3,694 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
case .concurrentDatabaseReads:
true
case .limitPlaybackPositionChanges:
true
case .newOnboardingAccountCreation:
true
case .shareTranscripts:
true
case .doNotSwitchToDownloadedFile:
true
case .newOnboardingUpgrad... | @SergioEstevao do we need to enable it now? | case .concurrentDatabaseReads:
true
case .limitPlaybackPositionChanges:
true
case .newOnboardingAccountCreation:
true
case .shareTranscripts:
true
case .doNotSwitchToDownloadedFile:
true
case .newOnboardingUpgrad... | @@ -408,7 +408,7 @@ public enum FeatureFlag: String, CaseIterable {
case .enableLocalizationHeaders:
true
case .endOfYear2025:
- false
+ true | Modules/Utils/Sources/PocketCastsUtils/Feature Flags/FeatureFlag.swift | 26 | Swift | 0.071 | question | 43 | 51 | 51 | false | [Playback 2025] Fix sync issues on listening animation | 3,712 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
Section {
ForEach(model.historyEntries) { entry in
Button(action: {
selectedEntry = entry
presentingEntry = true
}, label: {
Text("\(entry.date.formatted()): \(entry.episodeCount)... | Should this be limited so it isn't shown to all users? I think it could be valuable for users or our own testing. |
Section {
ForEach(model.historyEntries) { entry in
Button(action: {
selectedEntry = entry
presentingEntry = true
}, label: {
Text("\(entry.date.formatted()): \(entry.episodeCount)... | @@ -39,6 +39,14 @@ struct UpNextHistoryView: View {
model.loadEntries()
}
.navigationTitle(L10n.upNextHistory)
+ .toolbar(content: {
+ ToolbarItem(placement: .topBarTrailing) {
+ Button("Create snapshot", systemImage: "plus") { | podcasts/Up Next History/UpNextHistoryView.swift | 26 | Swift | 0.429 | suggestion | 113 | 46 | 46 | false | [Playlists] Up Next History snapshot fix | 3,718 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | bjtitus |
var body: some View {
VStack(spacing: 8) {
if let subscriptionTier {
SubscriptionBadge2025(subscriptionTier: subscriptionTier)
.padding(.bottom, 8)
}
if let title {
Text(title)
.font(size: 25, style:... | Can we use a static value from the Header? In case this will change |
var body: some View {
VStack(spacing: 8) {
if let subscriptionTier {
SubscriptionBadge2025(subscriptionTier: subscriptionTier)
.padding(.bottom, 8)
}
if let title {
Text(title)
.font(size: 25, style:... | @@ -33,7 +35,19 @@ struct StoryHeader2025: View {
}
}
.padding(.horizontal, 24)
- .padding(.top, topPadding ?? (UIScreen.isSmallScreen ? 70 : 110))
+ .padding(.top, topPadding ?? defaultTopPadding)
+ }
+
+ var defaultTopPadding: CGFloat {
+ if renderForSharing {... | podcasts/End of Year/Stories/2025/StoryHeader2025.swift | 26 | Swift | 0.286 | question | 67 | 49 | 49 | false | [Playback 2025] Fix padding in shareable story views | 3,719 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | bjtitus |
if let title {
Text(title)
.font(size: 25, style: .title, weight: .semibold)
.multilineTextAlignment(.center)
}
if let description {
Text(description)
.font(.system(size: 16, weight: .medium))... | can we just return omitting the `else`? | if let title {
Text(title)
.font(size: 25, style: .title, weight: .semibold)
.multilineTextAlignment(.center)
}
if let description {
Text(description)
.font(.system(size: 16, weight: .medium))... | @@ -33,7 +35,19 @@ struct StoryHeader2025: View {
}
}
.padding(.horizontal, 24)
- .padding(.top, topPadding ?? (UIScreen.isSmallScreen ? 70 : 110))
+ .padding(.top, topPadding ?? defaultTopPadding)
+ }
+
+ var defaultTopPadding: CGFloat {
+ if renderForSharing {... | podcasts/End of Year/Stories/2025/StoryHeader2025.swift | 26 | Swift | 0.214 | question | 39 | 42 | 42 | false | [Playback 2025] Fix padding in shareable story views | 3,719 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | bjtitus |
@ViewBuilder var headerView: some View {
let timeString = episode.playedUpTo.storyTimeDescriptionForSharing
StoryHeader2025(
title: L10n.playback2025LongestEpisodeTitle(timeString),
description: L10n.playback2025LongestEpisodeMessage
)
}
@ViewBuilder var foot... | I think this can be removed
```suggestion
``` | @ViewBuilder var headerView: some View {
let timeString = episode.playedUpTo.storyTimeDescriptionForSharing
StoryHeader2025(
title: L10n.playback2025LongestEpisodeTitle(timeString),
description: L10n.playback2025LongestEpisodeMessage
)
}
@ViewBuilder var foot... | @@ -76,21 +77,15 @@ struct LongestEpisode2025Story: ShareableStory {
}
@ViewBuilder func background(size: CGSize) -> some View {
- VStack(alignment: .center, spacing: 0) {
- Spacer()
- ZStack {
- LottieView(animation: .named("2025_longest_episode"))
- ... | podcasts/End of Year/Stories/2025/LongestEpisode2025Story.swift | 26 | Swift | 0.5 | suggestion | 46 | 51 | 51 | false | [Playback 2025] Fix layout on large text longest episode | 3,758 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
static let shared = PodcastExistsHelper()
private var checkedUuidsThatExist: [String] = []
private var lock = NSLock()
func exists(uuid: String) -> Bool {
lock.lock()
defer { lock.unlock() }
if checkedUuidsThatExist.contains(uuid) {
return true
}
... | ❤️ Thanks for making this change. This should help us in future years 🤞 | static let shared = PodcastExistsHelper()
private var checkedUuidsThatExist: [String] = []
private var lock = NSLock()
func exists(uuid: String) -> Bool {
lock.lock()
defer { lock.unlock() }
if checkedUuidsThatExist.contains(uuid) {
return true
}
... | @@ -190,9 +190,9 @@ class PodcastExistsHelper {
}
public class YearListeningHistory {
- public static func sync() -> Bool {
+ public static func sync(_ year: Int) -> Bool { | Modules/Server/Sources/PocketCastsServer/Public/Sync/SyncYearListeningHistoryTask.swift | 26 | Swift | 0.286 | suggestion | 72 | 51 | 51 | false | [Playback 2025] Ensure sync for year is done based on model year | 3,767 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
private func reloadFilters() {
if firstTimeLoading {
loadingIndicator.startAnimating()
}
DispatchQueue.global(qos: .userInitiated).async { [weak self] in
guard let self else { return }
playlists = DataManager.sharedManager.allPlaylists(includeDeleted: fal... | Added this for fear that we could get spammed, primarily during a server sync? | private func reloadFilters() {
if firstTimeLoading {
loadingIndicator.startAnimating()
}
DispatchQueue.global(qos: .userInitiated).async { [weak self] in
guard let self else { return }
playlists = DataManager.sharedManager.allPlaylists(includeDeleted: fal... | @@ -256,6 +259,16 @@ class PlaylistsViewController: PCViewController, FilterCreatedDelegate {
private func addReloadPlaylistsObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(filtersUpdated), name: Constants.Notifications.playlistChanged, object: nil)
NotificationCent... | podcasts/PlaylistsViewController.swift | 26 | Swift | 0.286 | question | 78 | 51 | 51 | false | [Playlists] Refresh Playlist cell on podcast subscription/unsubscription | 3,778 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | bjtitus |
true
case .newOnboardingUpgradeTrialTimeline:
false
case .newOnboardingRecommendationChanges:
true
case .searchImprovements:
true
case .searchPredictive:
true
case .podcastBookmarksInline:
true
case .... | Remember to mark it false by default, or are you doing it of Firebase? | case .shareTranscripts:
true
case .doNotSwitchToDownloadedFile:
true
case .newOnboardingUpgradeTrialTimeline:
false
case .newOnboardingRecommendationChanges:
true
case .searchImprovements:
true
case .searchPredic... | @@ -419,6 +422,8 @@ public enum FeatureFlag: String, CaseIterable {
true
case .effectsPlayerQOSUpgrade:
true
+ case .refreshPlaylistOnSubscriptions:
+ true | Modules/Utils/Sources/PocketCastsUtils/Feature Flags/FeatureFlag.swift | 26 | Swift | 0.214 | question | 71 | 51 | 51 | false | [Playlists] Refresh Playlist cell on podcast subscription/unsubscription | 3,778 | Automattic/pocket-casts-ios | 1,136 | Swift | SergioEstevao | bjtitus |
.init(top: 0, leading: 0, bottom: UIDevice.current.isiPad() ? 5 : 0, trailing: 0)
}
init() {
Self.requireAccount = Settings.endOfYearRequireAccount
storyModelType = Self.currentYear.modelType
}
func showPrompt(in viewController: UIViewController) {
guard Self.isEndOfY... | What about making this `assertionFailure` instead? | .init(top: 0, leading: 0, bottom: UIDevice.current.isiPad() ? 5 : 0, trailing: 0)
}
init() {
Self.requireAccount = Settings.endOfYearRequireAccount
storyModelType = Self.currentYear.modelType
}
func showPrompt(in viewController: UIViewController) {
guard Self.isEndOfY... | @@ -120,7 +128,11 @@ struct EndOfYear {
switch Self.currentYear {
case .y2022:
+ #if DEBUG
fatalError("Shouldn't reach this") | podcasts/End of Year/EndOfYear.swift | 26 | Swift | 0.429 | bug | 50 | 51 | 51 | false | [Playback 2025] Update checks for end of year | 3,790 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
tracksService.eventNamePrefix = TracksConfig.prefix
tracksService.authenticatedUserTypeKey = TracksConfig.userKey
TracksLogging.delegate = TracksAdapterLoggingDelegate.shared
#if DEBUG
FileLog.shared.console("TracksAdapter anonymous UUID \(anonymousUUID)")
#endif
// Setup the re... | Would it make sense for these `fatalError` to be `assertionFailure`? Just to triple check that it's never released in prod? | tracksService.eventNamePrefix = TracksConfig.prefix
tracksService.authenticatedUserTypeKey = TracksConfig.userKey
TracksLogging.delegate = TracksAdapterLoggingDelegate.shared
#if DEBUG
FileLog.shared.console("TracksAdapter anonymous UUID \(anonymousUUID)")
#endif
// Setup the re... | @@ -61,9 +61,31 @@ class TracksAdapter: AnalyticsAdapter, AnonymousIdentifiable {
}
func track(name: String, properties: [AnyHashable: Any]?) {
+ #if DEBUG
+ if let properties {
+ validateProperties(properties)
+ }
+ #endif
tracksService.trackEventName(name, w... | podcasts/Analytics/Adapters/Tracks/TracksAdapter.swift | 26 | Swift | 0.643 | bug | 123 | 51 | 51 | false | Add event properties validation for Tracks | 3,791 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
try db.executeUpdate("ALTER TABLE SJFilteredPlaylist ADD COLUMN showArchivedEpisodes BOOLEAN DEFAULT FALSE;", values: nil)
schemaVersion = 69
} catch {
failedAt(69)
return
}
}
if schemaVersion < 70 {
do ... | Should we keep this in the code? | try db.executeUpdate("ALTER TABLE SJFilteredPlaylist ADD COLUMN showArchivedEpisodes BOOLEAN DEFAULT FALSE;", values: nil)
schemaVersion = 69
} catch {
failedAt(69)
return
}
}
if schemaVersion < 70 {
do ... | @@ -868,6 +868,25 @@ class DatabaseHelper {
}
}
+ if schemaVersion < 71 {
+ do {
+ // Indexes to optimize manual playlist queries by playlist_uuid and ordering by episodePosition
+ try db.executeUpdate("CREATE INDEX IF NOT EXISTS playlist_episode_p... | Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/Util/DatabaseHelper.swift | 26 | Swift | 0.143 | question | 32 | 41 | 36 | false | [Playlists] Improve artwork and count queries | 3,807 | Automattic/pocket-casts-ios | 1,136 | Swift | SergioEstevao | danielebogo |
/// Render Bookmarks inline in PodcastViewController using SwiftUI BookmarksListView
case podcastBookmarksInline
/// Enable reloading the subscription status in App Delegate
case earlyReloadSubscriptionStatus
/// Enable localization headers
case enableLocalizationHeaders
/// Enable the En... | typo in the name: `Cahce` -> `Cache` | /// Render Bookmarks inline in PodcastViewController using SwiftUI BookmarksListView
case podcastBookmarksInline
/// Enable reloading the subscription status in App Delegate
case earlyReloadSubscriptionStatus
/// Enable localization headers
case enableLocalizationHeaders
/// Enable the En... | @@ -255,6 +255,9 @@ public enum FeatureFlag: String, CaseIterable {
/// Uses the PlaylistMetadataLoader cache before running the query (the query will update when it's done)
case playlistDataCacheBeforeQuery
+ /// Avoid returning cached episode early and use policy instead
+ case episodesInfoCahceRelo... | Modules/Utils/Sources/PocketCastsUtils/Feature Flags/FeatureFlag.swift | 26 | Swift | 0.214 | performance | 36 | 51 | 51 | false | Use cache policy to reload episode info if necessary | 3,818 | Automattic/pocket-casts-ios | 1,136 | Swift | SergioEstevao | danielebogo |
import Foundation
import AVFoundation
import UIKit
import PocketCastsServer
import PocketCastsUtils
#if !os(watchOS)
/// MediaExporterItemConfiguration global configuration.
private enum MediaExporterItemConfiguration {
/// How much data is downloaded in memory before stored on a file.
public static var downlo... | Do you think it's better to change the buffer limit only with the new FF being on? | import Foundation
import AVFoundation
import UIKit
import PocketCastsServer
import PocketCastsUtils
#if !os(watchOS)
/// MediaExporterItemConfiguration global configuration.
private enum MediaExporterItemConfiguration {
/// How much data is downloaded in memory before stored on a file.
public static var downlo... | @@ -8,7 +8,7 @@ import PocketCastsUtils
/// MediaExporterItemConfiguration global configuration.
private enum MediaExporterItemConfiguration {
/// How much data is downloaded in memory before stored on a file.
- public static var downloadBufferLimit: Int = 16.KB
+ public static var downloadBufferLimit: Int... | podcasts/MediaExporterResourceLoaderDelegate.swift | 11 | Swift | 0.286 | question | 82 | 36 | 36 | false | Resource loader use memory buffer to fulfil requests | 3,829 | Automattic/pocket-casts-ios | 1,136 | Swift | danielebogo | SergioEstevao |
/// Enable the End of Year to use first story as loading screen
case endOfYearLoadIsFirstStory
/// Upgrades the Effects Player's AudioReadTask to a QOS level of "userInitiated" from "default"
case effectsPlayerQOSUpgrade
/// Refreshes by listening to notifications for podcast subscribe/unsubscribe... | Just a warning that this name of feature flag will be translated to `use_celullar_network_a_p_is` so maybe change to `Apis` | /// Enable the End of Year to use first story as loading screen
case endOfYearLoadIsFirstStory
/// Upgrades the Effects Player's AudioReadTask to a QOS level of "userInitiated" from "default"
case effectsPlayerQOSUpgrade
/// Refreshes by listening to notifications for podcast subscribe/unsubscribe... | @@ -267,6 +267,9 @@ public enum FeatureFlag: String, CaseIterable {
/// activates the audio session in the background to avoid locks in the main thread
case activateAudioSessionInBackground
+ /// Use cellular-specific network APIs instead of expensive network APIs
+ case useCellularNetworkAPIs | Modules/Utils/Sources/PocketCastsUtils/Feature Flags/FeatureFlag.swift | 26 | Swift | 0.571 | suggestion | 123 | 51 | 51 | false | Switch to allowsCellularAccess from allowsExpensiveNetworkAccess | 3,833 | Automattic/pocket-casts-ios | 1,136 | Swift | SergioEstevao | bjtitus |
return dataRequest.currentOffset >= requestedLength + requestedOffset
}
return false
}
// Data length to be loaded into memory with maximum size of readDataLimit.
let bytesToRespond = min(bytesCached - currentOffset, requestedLength, readDataLimit)
... | Small typo:
```suggestion
FileLog.shared.addMessage("MediaExporterResourceLoaderDelegate: failed to write data to file:\(error)")
``` | let requestedLength = dataRequest.requestedLength
let currentOffset = Int(dataRequest.currentOffset)
let bytesCached = fileHandle.fileSize
// Is there enough data cached to fulfill the request?
guard bytesCached > currentOffset else {
if FeatureFlag.streamAndDownload... | @@ -283,6 +283,7 @@ class MediaExporterResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelega
try fileHandle.append(data: bufferData)
bufferData = Data()
} catch {
+ FileLog.shared.addMessage("MediaExporterResourceLoaderDelegate: failed to write date to file:\(error)... | podcasts/MediaExporterResourceLoaderDelegate.swift | 26 | Swift | 0.857 | bug | 146 | 51 | 51 | false | Media exporter resource loader improvements | 3,844 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
try readHandle?.seek(toOffset: UInt64(offset))
} catch {
FileLog.shared.addMessage("MediaFileHandle: File seek error: \(error)")
return nil
}
return readHandle?.readData(ofLength: length)
}
func append(data: Data) throws {
lock.lock()
... | Should we log this error as well?
```suggestion
do {
try writeHandle.synchronize()
} catch {
FileLog.shared.addMessage("MediaFileHandle: synchronize error at path \(filePath): \(error)")
}
``` | FileLog.shared.addMessage("MediaFileHandle: File [\(filePath)] read handle is nil")
return nil
}
do {
try readHandle.seek(toOffset: UInt64(offset))
} catch {
FileLog.shared.addMessage("MediaFileHandle: File [\(filePath)] seek error: \(error)")
... | @@ -66,7 +73,7 @@ extension MediaFileHandle {
guard let writeHandle = writeHandle else { return }
- writeHandle.synchronizeFile()
+ try? writeHandle.synchronize() | podcasts/MediaFileHandle.swift | 26 | Swift | 1 | question | 206 | 42 | 51 | false | Media exporter resource loader improvements | 3,844 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
close()
}
}
// MARK: Internal methods
extension MediaFileHandle {
var attributes: [FileAttributeKey: Any]? {
do {
return try FileManager.default.attributesOfItem(atPath: filePath)
} catch let error as NSError {
FileLog.shared.addMessage("MediaFileHandle: FileAtt... | I wonder if we should catch the `nil` `readHandle` early and log it just to avoid confusion?
```swift
guard let readHandle = readHandle else {
FileLog.shared.addMessage("MediaFileHandle: nil readHandle for path \(filePath)")
return nil
}
``` | close()
}
}
// MARK: Internal methods
extension MediaFileHandle {
var attributes: [FileAttributeKey: Any]? {
do {
return try FileManager.default.attributesOfItem(atPath: filePath)
} catch let error as NSError {
FileLog.shared.addMessage("MediaFileHandle: File [\... | @@ -46,7 +47,12 @@ extension MediaFileHandle {
lock.lock()
defer { lock.unlock() }
- readHandle?.seek(toFileOffset: UInt64(offset))
+ do {
+ try readHandle?.seek(toOffset: UInt64(offset)) | podcasts/MediaFileHandle.swift | 26 | Swift | 1 | suggestion | 250 | 51 | 51 | false | Media exporter resource loader improvements | 3,844 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
import UIKit
protocol MainEpisodeActionViewDelegate: AnyObject {
func downloadTapped()
func stopDownloadTapped()
func playTapped()
func pauseTapped()
func errorTapped()
func waitingForWifiTapped()
}
class MainEpisodeActionView: UIView {
enum ButtonState {
case download, pauseDownlo... | Is this duplicating the `setCenterPoint` call? | import UIKit
protocol MainEpisodeActionViewDelegate: AnyObject {
func downloadTapped()
func stopDownloadTapped()
func playTapped()
func pauseTapped()
func errorTapped()
func waitingForWifiTapped()
}
class MainEpisodeActionView: UIView {
enum ButtonState {
case download, pauseDownlo... | @@ -24,6 +24,7 @@ class MainEpisodeActionView: UIView {
var enlargementScale: CGFloat = 1 {
didSet {
setCenterPoint()
+ setNeedsDisplay() | podcasts/MainEpisodeActionView.swift | 26 | Swift | 0.214 | question | 46 | 51 | 51 | false | Dynamic type: podcast view | 3,892 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
// MARK: - Private Helpers
private func setPlaybackProgress(_ progress: Double) {
playedAngle = MainEpisodeActionView.startingAngle
if progress > 1 {
playedAngle = 360 + MainEpisodeActionView.startingAngle
} else if progress > 0 {
playedAngle = CGFloat(360 * pro... | Would it be sufficient to put this in `layoutSubviews` instead and call `setNeedsLayout` from `enlargementScale`? |
// MARK: - Private Helpers
private func setPlaybackProgress(_ progress: Double) {
playedAngle = MainEpisodeActionView.startingAngle
if progress > 1 {
playedAngle = 360 + MainEpisodeActionView.startingAngle
} else if progress > 0 {
playedAngle = CGFloat(360 * pro... | @@ -185,7 +186,7 @@ class MainEpisodeActionView: UIView {
override func draw(_ rect: CGRect) {
guard let context = UIGraphicsGetCurrentContext() else { return }
-
+ setCenterPoint() | podcasts/MainEpisodeActionView.swift | 26 | Swift | 0.571 | question | 113 | 51 | 51 | false | Dynamic type: podcast view | 3,892 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
updateSizeConstraints(of: episodeImage, to: imageSize)
let buttonSize = max(44, metric.scaledValue(for: 44))
updateSizeConstraints(of: actionButton, to: buttonSize)
actionButton.enlargementScale = buttonSize / 44
updateSizeConstraints(of: selectView, to: buttonSize)
let... | Does it make sense to `guard` this for changes to `contentSizeCategory`?
```swift
guard traitCollection.preferredContentSizeCategory != previousTraitCollection?.preferredContentSizeCategory else { return }
``` | updateSizeConstraints(of: episodeImage, to: imageSize)
let buttonSize = max(44, metric.scaledValue(for: 44))
updateSizeConstraints(of: actionButton, to: buttonSize)
actionButton.enlargementScale = buttonSize / 44
updateSizeConstraints(of: selectView, to: buttonSize)
let... | @@ -565,4 +575,34 @@ class EpisodeCell: ThemeableSwipeCell, MainEpisodeActionViewDelegate {
selectTickImageView.tintColor = ThemeColor.primaryInteractive02()
starIndicator.image = UIImage(named: "list_starred")?.tintedImage(ThemeColor.support10())
}
+
+ private func updateSize() {
+ let... | podcasts/EpisodeCell.swift | 26 | Swift | 0.857 | suggestion | 210 | 28 | 29 | false | Dynamic type: podcast view | 3,892 | Automattic/pocket-casts-ios | 1,136 | Swift | bjtitus | SergioEstevao |
episodeInfo.themeOverride = themeOverride
dayName.themeOverride = themeOverride
dividerView.themeOverride = themeOverride
}
}
@IBOutlet var podcastImage: PodcastImageView!
@IBOutlet var episodeTitle: ThemeableLabel! {
didSet {
episodeTitle.sty... | The scalingWith parameter should be `.caption2` to match the text style used in the XIB file (UICTFontTextStyleCaption2 on line 51 of PlayerCell.xib). This inconsistency could lead to unexpected font scaling behavior. For reference, EpisodeCell.swift:49 uses `.caption2` for the same dayName label.
```suggestion
... | episodeInfo.themeOverride = themeOverride
dayName.themeOverride = themeOverride
dividerView.themeOverride = themeOverride
}
}
@IBOutlet var podcastImage: PodcastImageView!
@IBOutlet var episodeTitle: ThemeableLabel! {
didSet {
episodeTitle.sty... | @@ -17,19 +17,22 @@ class PlayerCell: ThemeableSwipeCell {
@IBOutlet var episodeTitle: ThemeableLabel! {
didSet {
episodeTitle.style = .primaryText01
+ episodeTitle.font = UIFont.font(ofSize: 16, scalingWith: .callout)
}
}
@IBOutlet var episodeInfo: ThemeableLa... | podcasts/PlayerCell.swift | 26 | Swift | 0.857 | suggestion | 410 | 51 | 51 | false | [Dynamic type] Update UpNext section | 3,918 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
}
}
override func handleThemeDidChange() {
selectView.layer.borderColor = AppTheme.colorForStyle(.primaryIcon02, themeOverride: themeOverride).cgColor
selectView.backgroundColor = showTick ? AppTheme.colorForStyle(.primaryInteractive01, themeOverride: themeOverride) : AppTheme.colorForS... | Remove trailing whitespace at the end of these lines. | }
}
override func handleThemeDidChange() {
selectView.layer.borderColor = AppTheme.colorForStyle(.primaryIcon02, themeOverride: themeOverride).cgColor
selectView.backgroundColor = showTick ? AppTheme.colorForStyle(.primaryInteractive01, themeOverride: themeOverride) : AppTheme.colorForS... | @@ -238,6 +243,26 @@ class PlayerCell: ThemeableSwipeCell {
let activeTheme = themeOverride ?? Theme.sharedTheme.activeTheme
overrideUserInterfaceStyle = activeTheme.isDark ? .dark : .light
}
+
+ private func updateSize() {
+ let metric = UIFontMetrics(forTextStyle: .largeTitle)
+ ... | podcasts/PlayerCell.swift | 26 | Swift | 0.286 | nitpick | 53 | 48 | 48 | false | [Dynamic type] Update UpNext section | 3,918 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsDataModel
import PocketCastsUtils
import PocketCastsServer
import UIKit
class UpNextViewController: UIViewController, UIGestureRecognizerDelegate {
static let playerCell = "PlayerCell"
static let nowPlayingCell = "UpNextNowPlayingCell"
static let emptyStateCell = "EmptyStateCell"
stat... | These computed properties add unnecessary function call overhead when they simply return a constant value. Since UITableView.automaticDimension is already a constant, consider changing these back to static let constants. For example: `static let upNextRowHeight: CGFloat = UITableView.automaticDimension`
```suggestion
... | import PocketCastsDataModel
import PocketCastsUtils
import PocketCastsServer
import UIKit
class UpNextViewController: UIViewController, UIGestureRecognizerDelegate {
static let playerCell = "PlayerCell"
static let nowPlayingCell = "UpNextNowPlayingCell"
static let emptyStateCell = "EmptyStateCell"
stat... | @@ -8,9 +8,18 @@ class UpNextViewController: UIViewController, UIGestureRecognizerDelegate {
static let nowPlayingCell = "UpNextNowPlayingCell"
static let emptyStateCell = "EmptyStateCell"
static let upNextSection = 1
- static let upNextRowHeight: CGFloat = 72
- static let nowPlayingRowHeight: CGFl... | podcasts/UpNextViewController.swift | 21 | Swift | 0.857 | suggestion | 551 | 46 | 46 | false | [Dynamic type] Update UpNext section | 3,918 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
return queue
}()
func setup(dbQueue: PCDBQueue) {
cacheFolders(dbQueue: dbQueue)
}
func findFolder(uuid: String, dbQueue: PCDBQueue) -> Folder? {
cachedFolderQueue.sync {
cachedFolders.first { $0.uuid == uuid }
}
}
func allFolders(includeDeleted: B... | Potential race condition: The `isUpdate` check happens outside the database write transaction and reads from `cachedFolders`, which may not be synchronized with the database state. If the cache is stale or another thread updates the database between this check and the actual insert/update operation, this could lead to ... |
return queue
}()
func setup(dbQueue: PCDBQueue) {
cacheFolders(dbQueue: dbQueue)
}
func findFolder(uuid: String, dbQueue: PCDBQueue) -> Folder? {
cachedFolderQueue.sync {
cachedFolders.first { $0.uuid == uuid }
}
}
func allFolders(includeDeleted: B... | @@ -37,21 +39,39 @@ class FolderDataManager {
}
func save(folder: Folder, dbQueue: PCDBQueue) {
- dbQueue.write { db in
- do {
- if folder.uuid.isEmpty {
- folder.uuid = UUID().uuidString.lowercased()
- }
+ if folder.uuid.isEmpty {
+ ... | Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/FolderDataManager.swift | 26 | Swift | 0.786 | bug | 649 | 51 | 51 | false | GRDB Macros: Folder | 3,920 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
if includeDeleted { return cachedFolders }
return cachedFolders.filter { $0.wasDeleted == false }
}
func save(folder: Folder, dbQueue: PCDBQueue) {
if folder.uuid.isEmpty {
folder.uuid = UUID().uuidString.lowercased()
}
let isUpdate = cachedFolders.contains... | The GRDB implementation could be simplified by using the `save()` method instead of manually checking for insert vs. update. GRDB's `save()` method (defined in GRDBQueue+QueryInterface.swift) automatically determines whether to insert or update based on whether the record exists in the database, which would also elimin... | if includeDeleted { return cachedFolders }
return cachedFolders.filter { $0.wasDeleted == false }
}
func save(folder: Folder, dbQueue: PCDBQueue) {
if folder.uuid.isEmpty {
folder.uuid = UUID().uuidString.lowercased()
}
if FeatureFlag.grdbQueryInterface.ena... | @@ -37,21 +39,39 @@ class FolderDataManager {
}
func save(folder: Folder, dbQueue: PCDBQueue) {
- dbQueue.write { db in
- do {
- if folder.uuid.isEmpty {
- folder.uuid = UUID().uuidString.lowercased()
- }
+ if folder.uuid.isEmpty {
+ ... | Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/FolderDataManager.swift | 26 | Swift | 1 | bug | 1,006 | 51 | 51 | false | GRDB Macros: Folder | 3,920 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
import Foundation
import GRDB
import GRDBMacros
@GRDBRecord(table: "Folder")
public class Folder: NSObject, Identifiable {
@objc public var uuid = ""
@objc public var name = ""
@objc public var color: Int32 = 0
@objc public var addedDate: Date?
@objc public var sortOrder: Int32 = 0
@objc public... | The PR description mentions that @GRDBColumn macros were applied to the Folder model, but no @GRDBColumn annotations are present in the code. If there are no custom column name mappings needed (i.e., all Swift property names match the database column names), then this is fine and the description should be updated to re... | import Foundation
import GRDB
import GRDBMacros
@GRDBRecord(table: "Folder")
public class Folder: NSObject, Identifiable {
@objc public var uuid = ""
@objc public var name = ""
@objc public var color: Int32 = 0
@objc public var addedDate: Date?
@objc public var sortOrder: Int32 = 0
@objc public... | @@ -11,8 +14,13 @@ public class Folder: NSObject, Identifiable {
@objc public var syncModified: Int64 = 0 | Modules/DataModel/Sources/PocketCastsDataModel/Public/Model/Folder.swift | 14 | Swift | 0.5 | suggestion | 507 | 33 | 31 | false | GRDB Macros: Folder | 3,920 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
import Foundation
import GRDB
import GRDBMacros
@GRDBRecord(table: "Folder")
public class Folder: NSObject, Identifiable {
@objc public var uuid = ""
@objc public var name = ""
@objc public var color: Int32 = 0
@objc public var addedDate: Date?
@objc public var sortOrder: Int32 = 0
@objc public... | The init implementation style is inconsistent with other NSObject model classes in the codebase. Other models like Episode and UserEpisode use `override public init() {}` without an explicit `super.init()` call. While functionally equivalent, for consistency with the codebase pattern, this should be simplified to match... | import Foundation
import GRDB
import GRDBMacros
@GRDBRecord(table: "Folder")
public class Folder: NSObject, Identifiable {
@objc public var uuid = ""
@objc public var name = ""
@objc public var color: Int32 = 0
@objc public var addedDate: Date?
@objc public var sortOrder: Int32 = 0
@objc public... | @@ -11,8 +14,13 @@ public class Folder: NSObject, Identifiable {
@objc public var syncModified: Int64 = 0
// transient not saved to database
+ @GRDBIgnore
public var cachedUnreadCount = 0
+ override public init() {
+ super.init()
+ } | Modules/DataModel/Sources/PocketCastsDataModel/Public/Model/Folder.swift | 22 | Swift | 0.857 | suggestion | 393 | 33 | 31 | false | GRDB Macros: Folder | 3,920 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
return queue
}()
func setup(dbQueue: PCDBQueue) {
cacheFolders(dbQueue: dbQueue)
}
func findFolder(uuid: String, dbQueue: PCDBQueue) -> Folder? {
cachedFolderQueue.sync {
cachedFolders.first { $0.uuid == uuid }
}
}
func allFolders(includeDeleted: B... | Thread safety issue: The `cachedFolders` array is accessed without synchronization on line 46 for the insert/update check, but it's protected by `cachedFolderQueue.sync` in other methods like `findFolder` (line 30-32) and when updating the cache in `cacheFolders` (line 152-154). This inconsistent synchronization could ... |
return queue
}()
func setup(dbQueue: PCDBQueue) {
cacheFolders(dbQueue: dbQueue)
}
func findFolder(uuid: String, dbQueue: PCDBQueue) -> Folder? {
cachedFolderQueue.sync {
cachedFolders.first { $0.uuid == uuid }
}
}
func allFolders(includeDeleted: B... | @@ -37,21 +39,39 @@ class FolderDataManager {
}
func save(folder: Folder, dbQueue: PCDBQueue) {
- dbQueue.write { db in
- do {
- if folder.uuid.isEmpty {
- folder.uuid = UUID().uuidString.lowercased()
- }
+ if folder.uuid.isEmpty {
+ ... | Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/FolderDataManager.swift | 26 | Swift | 1 | bug | 652 | 51 | 51 | false | GRDB Macros: Folder | 3,920 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
} catch {
FileLog.shared.addMessage("UserEpisodeDataManager.bulkSave error: \(error)")
}
} else {
// Legacy path
dbQueue.write { db in
do {
db.beginTransaction()
for episode in episodes {
... | Similar to the `save` method, the GRDB and legacy SQL code paths in `bulkSave` handle the `contentType` field inconsistently. The GRDB path will persist `contentType`, but the legacy SQL path does not include it in the `columnNames` array. This creates inconsistent behavior between the two implementations. | } catch {
FileLog.shared.addMessage("UserEpisodeDataManager.bulkSave error: \(error)")
}
} else {
// Legacy path
dbQueue.write { db in
do {
db.beginTransaction()
for episode in episodes {
... | @@ -371,24 +389,47 @@ class UserEpisodeDataManager {
}
func bulkSave(episodes: [UserEpisode], dbQueue: PCDBQueue) {
- dbQueue.write { db in
+ if FeatureFlag.grdbQueryInterface.enabled, let grdbQueue = dbQueue as? GRDBQueue {
+ // GRDB path using PersistableRecord
do {
-... | Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/UserEpisodeDataManager.swift | 26 | Swift | 0.714 | suggestion | 307 | 51 | 51 | false | GRDB Macros: User Episodes | 3,921 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
let isInsert = episode.id == 0
if isInsert {
episode.id = DBUtils.generateUniqueId()
}
try episode.save(db)
}
}
} catch {
FileLog.s... | The `isInsert` check is redundant. Lines 415-418 already determine `isInsert` and generate an ID if needed. Then lines 420-425 check `isInsert` again to decide between INSERT and UPDATE. The inner check on line 420 is unnecessary since `isInsert` was already determined and the ID was already generated. This doesn't cau... | let isInsert = episode.id == 0
if isInsert {
episode.id = DBUtils.generateUniqueId()
}
try episode.save(db)
}
}
} catch {
FileLog.s... | @@ -371,24 +389,47 @@ class UserEpisodeDataManager {
}
func bulkSave(episodes: [UserEpisode], dbQueue: PCDBQueue) {
- dbQueue.write { db in
+ if FeatureFlag.grdbQueryInterface.enabled, let grdbQueue = dbQueue as? GRDBQueue {
+ // GRDB path using PersistableRecord
do {
-... | Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/UserEpisodeDataManager.swift | 26 | Swift | 0.786 | bug | 354 | 51 | 51 | false | GRDB Macros: User Episodes | 3,921 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
filter.customIcon = 3
filter.filterAllPodcasts = true
filter.filterAudioVideoType = 1
filter.filterDownloaded = true
filter.filterFinished = true
filter.filterNotDownloaded = false
filter.filterPartiallyPlayed = true
filter.filterStarred = true
fil... | The EpisodeFilterColumnConsistencyTests don't set the feature flag, so they will only test the legacy SQL implementation, not the GRDB implementation. These tests should either:
1. Extend DataManagerTestCase and use runWithBothImplementations to test both paths, or
2. Explicitly set the feature flag using featureFlagSt... | import XCTest
import GRDB
@testable import PocketCastsDataModel
@testable import PocketCastsUtils
/// Tests to ensure the legacy SQL columnNames and GRDB-persisted columns remain in sync.
/// These tests prevent the issue where GRDB might persist a field that the legacy SQL path ignores
/// (or vice versa), causing in... | @@ -0,0 +1,180 @@
+import XCTest
+import GRDB
+@testable import PocketCastsDataModel
+@testable import PocketCastsUtils
+
+/// Tests to ensure the legacy SQL columnNames and GRDB-persisted columns remain in sync.
+/// These tests prevent the issue where GRDB might persist a field that the legacy SQL path ignores
+/// (... | Modules/DataModel/Tests/PocketCastsDataModelTests/EpisodeFilterColumnConsistencyTests.swift | 26 | Swift | 0.5 | bug | 564 | 27 | 169 | false | GRDB Macros: EpisodeFilter | 3,923 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
XCTAssertEqual(loaded.autoAddToUpNext, original.autoAddToUpNext, "\(implementationName): autoAddToUpNext should match")
XCTAssertEqual(loaded.autoArchiveEpisodeLimit, original.autoArchiveEpisodeLimit, "\(implementationName): autoArchiveEpisodeLimit should match")
XCTAssertEqual(loade... | The test comment on line 55 states "Verify all persisted fields match" but many database columns are not verified in this test. Missing verifications include: podcastHTMLDescription, backgroundColor, detailColor, primaryColor, secondaryColor, lastColorDownloadDate, latestEpisodeUuid, latestEpisodeDate, lastThumbnailDow... | XCTAssertEqual(loaded.autoDownloadSetting, original.autoDownloadSetting, "\(implementationName): autoDownloadSetting should match")
XCTAssertEqual(loaded.autoAddToUpNext, original.autoAddToUpNext, "\(implementationName): autoAddToUpNext should match")
XCTAssertEqual(loaded.autoArchiv... | @@ -0,0 +1,183 @@
+import XCTest
+import GRDB
+@testable import PocketCastsDataModel
+@testable import PocketCastsUtils
+
+/// Tests to ensure the legacy SQL columnNames and GRDB-persisted columns remain in sync.
+/// These tests prevent the issue where GRDB might persist a field that the legacy SQL path ignores
+/// (... | Modules/DataModel/Tests/PocketCastsDataModelTests/PodcastColumnConsistencyTests.swift | 26 | Swift | 0.571 | suggestion | 564 | 51 | 51 | false | GRDB Macros: Podcast | 3,924 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
init(spacing: CGFloat = 6) {
self.spacing = spacing
}
func configureLayout(collectionView: UICollectionView) {
guard let flowLayout = collectionView.collectionViewLayout as? ReorderableFlowLayout else { return }
let gridType = Settings.libraryType()
let spacing = gridType =... | List item height now scales with `.callout`, but `PodcastListCell`/`FolderListCell` still scale their artwork (and other constraints) using `.largeTitle` metrics. At larger Dynamic Type sizes this can cause the image/badge to outgrow the cell height, leading to clipping or Auto Layout constraint breaking. Use a consist... | init(spacing: CGFloat = 6) {
self.spacing = spacing
}
func configureLayout(collectionView: UICollectionView) {
guard let flowLayout = collectionView.collectionViewLayout as? ReorderableFlowLayout else { return }
let gridType = Settings.libraryType()
let spacing = gridType =... | @@ -47,7 +47,7 @@ class GridHelper {
let viewHeight = collectionView.bounds.height
if gridType == .list {
- let metric = UIFontMetrics(forTextStyle: .largeTitle)
+ let metric = UIFontMetrics(forTextStyle: .callout) | podcasts/GridHelper.swift | 26 | Swift | 1 | suggestion | 504 | 51 | 51 | false | [Dynamic type] Update text limits | 3,929 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
}
override func viewDidAppear(_ animated: Bool) {
getEnabledShortcuts()
}
// MARK: Tableview delegate and datasource
func numberOfSections(in tableView: UITableView) -> Int {
tableData.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) ->... | `viewForHeaderInSection` is initializing `SettingsTableHeader` with a frame height of `UITableView.automaticDimension` (=-1). That produces an invalid/negative initial frame and can cause unpredictable header sizing; use a concrete height (e.g. `Constants.Values.tableSectionHeaderHeight`) or `.zero` and rely on Auto La... | }
override func viewDidAppear(_ animated: Bool) {
getEnabledShortcuts()
}
// MARK: Tableview delegate and datasource
func numberOfSections(in tableView: UITableView) -> Int {
tableData.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) ->... | @@ -59,7 +64,7 @@ class SiriSettingsViewController: PCViewController, UITableViewDelegate, UITable
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
- let headerFrame = CGRect(x: 0, y: 0, width: 0, height: Constants.Values.tableSectionHeaderHeight)
+ ... | podcasts/SiriSettingsViewController.swift | 26 | Swift | 0.857 | suggestion | 455 | 51 | 51 | false | [Dynamic type] Update siri settings | 3,930 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
backgroundColor = .clear
badgeLabel.textColor = ThemeColor.primaryInteractive02()
badgeLabel.backgroundColor = ThemeColor.primaryInteractive01()
badgeLabel.layer.borderColor = ThemeColor.primaryUi04().cgColor
simpleBadge.borderColor = ThemeColor.primaryUi02()
simpleBadge... | `updateSize()` only updates the badge label’s width. Since the label’s font now scales with Dynamic Type, the fixed `heightAnchor` constant (25) and fixed `cornerRadius` (12) can cause vertical clipping and a non-pill shape at larger sizes. Consider storing/updating a height constraint (and recomputing corner radius/bo... | badgeLabel.textColor = ThemeColor.primaryInteractive02()
badgeLabel.backgroundColor = ThemeColor.primaryInteractive01()
badgeLabel.layer.borderColor = ThemeColor.primaryUi04().cgColor
simpleBadge.borderColor = ThemeColor.primaryUi02()
simpleBadge.centerColor = ThemeColor.primary... | @@ -100,4 +102,24 @@ class GridBadgeView: UIView {
simpleBadge.centerColor = ThemeColor.primaryInteractive01()
simpleBadge.backgroundColor = .clear
}
+
+ override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
+ super.traitCollectionDidChange(previousTrai... | podcasts/GridBadgeView.swift | 26 | Swift | 0.786 | suggestion | 401 | 31 | 34 | false | [Dynamic type] Update podcast grid cells | 3,931 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
updateBadgeColors()
}
@objc private func themeDidChange() {
updateBadgeColors()
}
private func updateBadgeColors() {
badgeLabel.clipsToBounds = true
backgroundColor = .clear
badgeLabel.textColor = ThemeColor.primaryInteractive02()
badgeLabel.backgroundC... | The width-sizing logic is duplicated between `updateBadge(count:badgeType:)` and `updateSize()` (including re-creating `UIFontMetrics`). This makes it easier for the two paths to drift (e.g., if the badge text formatting changes). Consider extracting a single helper that computes/apply the constraint constants based on... | updateSize()
}
@objc private func themeDidChange() {
updateBadgeColors()
}
private func updateBadgeColors() {
badgeLabel.clipsToBounds = true
backgroundColor = .clear
badgeLabel.textColor = ThemeColor.primaryInteractive02()
badgeLabel.backgroundColor = T... | @@ -100,4 +102,24 @@ class GridBadgeView: UIView {
simpleBadge.centerColor = ThemeColor.primaryInteractive01()
simpleBadge.backgroundColor = .clear
}
+
+ override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
+ super.traitCollectionDidChange(previousTrai... | podcasts/GridBadgeView.swift | 26 | Swift | 0.786 | refactor | 374 | 41 | 44 | false | [Dynamic type] Update podcast grid cells | 3,931 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
if gridType == .list {
let metric = UIFontMetrics(forTextStyle: .largeTitle)
let imageSize = max(65, metric.scaledValue(for: 65))
return CGSize(width: viewWidth, height: imageSize)
}
var divideBy: CGFloat
if viewWidth > viewHeight {
if vie... | `divideBy = floor(divideBy / 2)` will reduce a 3-column layout to 1 column at accessibility Dynamic Type sizes (e.g., 3 → 1), which is likely not the intended “fewer columns” behavior and can make the grid unexpectedly huge. Consider using `ceil(divideBy / 2)` (3 → 2) or otherwise clamping to a minimum column count tha... | if gridType == .list {
let metric = UIFontMetrics(forTextStyle: .title3)
var baseSize = CGFloat(65)
if collectionView.traitCollection.preferredContentSizeCategory.isAccessibilityCategory {
baseSize = 85
}
let imageSize = max(baseSize, ... | @@ -66,6 +66,9 @@ class GridHelper {
divideBy = gridType == .threeByThree ? 3 : 4
}
}
+ if collectionView.traitCollection.preferredContentSizeCategory.isAccessibilityCategory {
+ divideBy = floor(divideBy / 2) | podcasts/GridHelper.swift | 26 | Swift | 1 | suggestion | 441 | 51 | 51 | false | [Dynamic type] Update podcast grid cells | 3,931 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
}
func openSharePath(_ path: String, controller: UIViewController, onErrorOpen: URL?) {
progressDialog = ShiftyLoadingAlert(title: L10n.sharedItemLoading)
progressDialog?.showAlert(controller, hasProgress: false) {
// URLs that are already in the format https://pca.st/podcast/da3271... | `path` can include query parameters (e.g. `?t=123`) as constructed in `AppDelegate+SiriShortcuts.handleContinue`. With the current string-splitting approach, `components[3]` (episode UUID) and the fallback `uuid = path.suffix(...)` (podcast UUID) will include the query string when present, producing invalid UUIDs and b... | }
func openSharePath(_ path: String, controller: UIViewController, onErrorOpen: URL?) {
progressDialog = ShiftyLoadingAlert(title: L10n.sharedItemLoading)
progressDialog?.showAlert(controller, hasProgress: false) {
// Parse the URL into path and query components so that any query pa... | @@ -472,7 +472,23 @@ extension AppDelegate {
progressDialog = ShiftyLoadingAlert(title: L10n.sharedItemLoading)
progressDialog?.showAlert(controller, hasProgress: false) {
// URLs that are already in the format https://pca.st/podcast/da3271a0-69e7-0132-d9fd-5f4c86fd3263 (or /private/) hav... | podcasts/AppDelegate+UrlHandling.swift | 26 | Swift | 1 | refactor | 2,780 | 51 | 51 | false | Handle new podcast URL format | 3,937 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
}
func actionWasAdded() {
let label = UILabel()
label.font = UIFont.font(ofSize: 18, weight: .semibold, scalingWith: .headline)
label.adjustsFontForContentSizeCategory = true
label.numberOfLines = 0
label.text = name
label.textColor = AppTheme.mainTextColor(for: ... | The label is now multi-line (`numberOfLines = 0`) but it still has no trailing/width constraint, so it can grow into/overlap the segmented control (and won’t know where to wrap). Add a trailing constraint relative to the segmented control (e.g., label.trailing <= segmentedControl.leading - spacing) or otherwise constra... | }
func actionWasAdded() {
let label = UILabel()
label.font = UIFont.font(ofSize: 18, weight: .semibold, scalingWith: .headline)
label.adjustsFontForContentSizeCategory = true
label.numberOfLines = 0
label.text = name
label.textColor = AppTheme.mainTextColor(for: ... | @@ -44,13 +44,15 @@ class MultipleActionView: UIView {
imageView.heightAnchor.constraint(equalToConstant: 24),
imageView.widthAnchor.constraint(equalToConstant: 24),
label.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: 20),
- label... | podcasts/MultipleActionView.swift | 26 | Swift | 0.571 | suggestion | 337 | 51 | 51 | false | [Dynamic type] Options controller | 3,938 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
init(scrollView: UIScrollView, navBar: UINavigationBar, searchBar: PCSearchBarController? = nil, source: AnalyticsSource) {
self.source = source
super.init(frame: CGRect.zero)
clipsToBounds = true
backgroundColor = UIColor.clear
self.scrollView = scrollView
self.nav... | `refreshLabel.numberOfLines = 0` enables multi-line Dynamic Type, but the label is only constrained by leading/trailing/top while the refresh control view has `clipsToBounds = true`. At larger accessibility sizes the label can expand downward and get clipped. Add a bottom constraint (or a vertical centering/<= constrai... |
var heightConstraint: NSLayoutConstraint?
init(scrollView: UIScrollView, navBar: UINavigationBar, searchBar: PCSearchBarController? = nil, source: AnalyticsSource) {
self.source = source
super.init(frame: CGRect.zero)
clipsToBounds = true
backgroundColor = UIColor.clear
... | @@ -53,7 +53,9 @@ class PCRefreshControl: UIView {
// refresh label
refreshLabel.text = L10n.refreshControlPullToRefresh
refreshLabel.textAlignment = NSTextAlignment.center
- refreshLabel.font = UIFont.systemFont(ofSize: 12, weight: UIFont.Weight.semibold)
+ refreshLabel.font = ... | podcasts/PCRefreshControl.swift | 26 | Swift | 0.714 | suggestion | 381 | 51 | 51 | false | [Dynamic type] - Pull to refresh | 3,939 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
// refresh label
refreshLabel.text = L10n.refreshControlPullToRefresh
refreshLabel.textAlignment = NSTextAlignment.center
refreshLabel.font = UIFont.font(ofSize: 12, weight: .semibold, scalingWith: .caption1)
refreshLabel.adjustsFontForContentSizeCategory = true
refreshLa... | Commented-out code (`adjustsImageSizeForAccessibilityContentSizeCategory`) should be removed or enabled. Leaving commented lines in production code makes the intended accessibility behavior unclear and adds maintenance noise.
```suggestion
refreshOuterImage.image = UIImage(named: "refresh_outer")
addSu... | widthAnchor.constraint(equalTo: scrollView.safeAreaLayoutGuide.widthAnchor).isActive = true
bottomAnchor.constraint(equalTo: scrollView.topAnchor, constant: 0).isActive = true
alpha = 0
refreshInnerImage.image = UIImage(named: "refresh_inner")
addSubview(refreshInnerImage)
... | @@ -66,12 +68,14 @@ class PCRefreshControl: UIView {
refreshInnerImage.translatesAutoresizingMaskIntoConstraints = false
refreshInnerImage.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
refreshInnerImage.topAnchor.constraint(equalTo: topAnchor, constant: 15).isActive = true
... | podcasts/PCRefreshControl.swift | 26 | Swift | 0.857 | suggestion | 612 | 51 | 51 | false | [Dynamic type] - Pull to refresh | 3,939 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
self.refreshLabel.text = message
self.perform(#selector(self.refreshEndTimerFired), with: nil, afterDelay: 1.0)
}
}
@objc func refreshEndTimerFired() {
endRefreshing(pare... | `traitCollectionDidChange` recalculates `viewHeight`, but the view’s height constraint and top constraint were created with the original constant values and aren’t updated. As a result, Dynamic Type changes won’t actually resize/reposition the refresh control, and `pullDownAmountForRefresh` can also become stale. Consi... |
@objc func syncFailed() {
processRefreshCompleted(L10n.refreshControlSyncFailed)
}
func processRefreshCompleted(_ message: String) {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
self.refreshLabel.text = message
self.pe... | @@ -280,12 +284,23 @@ class PCRefreshControl: UIView {
@objc func refreshEndTimerFired() {
endRefreshing(parentViewVisible)
+
}
private enum RefreshDefaults {
- static let viewHeight: CGFloat = 80
+ static var viewHeight: CGFloat {
+ let metric = UIFontMetrics(forTex... | podcasts/PCRefreshControl.swift | 26 | Swift | 1 | suggestion | 722 | 51 | 51 | false | [Dynamic type] - Pull to refresh | 3,939 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsDataModel
import PocketCastsDependencyInjection
import PocketCastsServer
import PocketCastsUtils
import Combine
class PlaylistsViewController: PCViewController, FilterCreatedDelegate {
@Dependency(\.playlistMetadataLoader) private var playlistMetadataLoader: PlaylistMetadataLoader
@Dependenc... | When setting sectionFooterHeight to UITableView.automaticDimension, the codebase convention is to also set estimatedSectionFooterHeight. This helps the table view provide better scroll performance by allowing it to estimate dimensions before cells are loaded. See SettingsViewController.swift:108-109, UploadedSettingsVi... | import PocketCastsDataModel
import PocketCastsDependencyInjection
import PocketCastsServer
import PocketCastsUtils
import Combine
class PlaylistsViewController: PCViewController, FilterCreatedDelegate {
@Dependency(\.playlistMetadataLoader) private var playlistMetadataLoader: PlaylistMetadataLoader
@Dependenc... | @@ -26,6 +26,7 @@ class PlaylistsViewController: PCViewController, FilterCreatedDelegate {
filtersTable.dragDelegate = nil
filtersTable.dropDelegate = nil
}
+ filtersTable.sectionFooterHeight = UITableView.automaticDimension | podcasts/PlaylistsViewController.swift | 26 | Swift | 1 | performance | 602 | 51 | 51 | false | [Dynamic Type] - Playlists List | 3,946 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import UIKit
class AccountActionCell: ThemeableCell {
var imageAndTextColor: UIColor? = nil {
didSet {
handleThemeDidChange()
}
}
@IBOutlet var cellLabel: ThemeableLabel! {
didSet {
cellLabel.style = iconStyle
cellLabel.font = UIFont.font(ofSize... | `updateDisclosureScale()` calls `updateSizeConstraints(to:)` on `disclosureImageView`, but the disclosure image view is created programmatically and doesn’t appear to have any width/height constraints, so `updateSizeConstraints` will be a no-op (it only updates constraints owned by the view). To actually scale the acce... | }
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if traitCollection.preferredContentSizeCategory != previousTraitCollection?.preferredContentSizeCategory {
updateSize()
}
}
... | @@ -74,25 +74,32 @@ class AccountActionCell: ThemeableCell {
imageAndTextColor = nil
- updateImageScale()
+ updateSize()
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
... | podcasts/AccountActionCell.swift | 26 | Swift | 0.571 | suggestion | 498 | 106 | 29 | false | [Dynamic type] Update Create new playlist | 3,948 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import Combine
import SwiftUI
import PocketCastsDataModel
import PocketCastsServer
import UIKit
import SwiftUI
class UploadedViewController: PCViewController, UserEpisodeDetailProtocol {
private let episodesDataManager = EpisodesDataManager()
private var cancellables = Set<AnyCancellable>()
@IBOutlet var ... | The PR title contains a typo: "ploaded files" should be "Uploaded files". | import Combine
import SwiftUI
import PocketCastsDataModel
import PocketCastsServer
import UIKit
import SwiftUI
class UploadedViewController: PCViewController, UserEpisodeDetailProtocol {
private let episodesDataManager = EpisodesDataManager()
private var cancellables = Set<AnyCancellable>()
@IBOutlet var ... | @@ -13,6 +13,11 @@ class UploadedViewController: PCViewController, UserEpisodeDetailProtocol {
didSet { | podcasts/UploadedViewController.swift | 13 | Swift | 0.286 | suggestion | 73 | 38 | 38 | false | [Dynamic type] Uploaded files | 3,953 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
@IBOutlet var multiSelectActionBarBottomConstraint: NSLayoutConstraint!
var selectedEpisodes = [UserEpisode]() {
didSet {
multiSelectActionBar.setSelectedCount(count: selectedEpisodes.count)
updateSelectAllBtn()
}
}
// MARK: - View Methods
override func vi... | The header view frame is set to a fixed size (100x100), which doesn't make sense for a dynamically-sized header. Since the header is now being used as a section header with automatic dimension sizing, this fixed frame may cause layout issues. Consider removing this line or setting the frame width to the table view's wi... |
@IBOutlet var multiSelectActionBarBottomConstraint: NSLayoutConstraint!
var selectedEpisodes = [UserEpisode]() {
didSet {
multiSelectActionBar.setSelectedCount(count: selectedEpisodes.count)
updateSelectAllBtn()
}
}
// MARK: - View Methods
override func vi... | @@ -115,10 +120,9 @@ class UploadedViewController: PCViewController, UserEpisodeDetailProtocol {
// noEpisodeRefreshControl = UploadedRefreshControl(scrollView: noEpisodesScrollView, navBar: navController.navigationBar, source: .noFiles)
}
- let size = headerView.systemLayoutSizeFitting(UI... | podcasts/UploadedViewController.swift | 26 | Swift | 0.857 | suggestion | 387 | 51 | 51 | false | [Dynamic type] Uploaded files | 3,953 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsDataModel
import UIKit
extension UploadedViewController: UITableViewDataSource, UITableViewDelegate {
func registerCells() {
uploadsTable.register(UINib(nibName: "EpisodeCell", bundle: nil), forCellReuseIdentifier: "EpisodeCell")
}
func registerLongPress() {
let longPress... | Calling `updateHeaderView()` inside `viewForHeaderInSection` can cause performance issues because this delegate method may be called repeatedly during scrolling and other table view operations. The update method performs network/storage queries and updates UI, which should not happen on every scroll. Consider only upda... | import PocketCastsDataModel
import UIKit
extension UploadedViewController: UITableViewDataSource, UITableViewDelegate {
func registerCells() {
uploadsTable.register(UINib(nibName: "EpisodeCell", bundle: nil), forCellReuseIdentifier: "EpisodeCell")
}
func registerLongPress() {
let longPress... | @@ -17,6 +17,11 @@ extension UploadedViewController: UITableViewDataSource, UITableViewDelegate {
uploadedEpisodes.count
}
+ func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+ updateHeaderView()
+ return headerView
+ }
+ | podcasts/UploadedViewController+Table.swift | 24 | Swift | 1 | performance | 528 | 49 | 49 | false | [Dynamic type] Uploaded files | 3,953 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import Combine
import SwiftUI
import PocketCastsDataModel
import PocketCastsServer
import UIKit
import SwiftUI
class UploadedViewController: PCViewController, UserEpisodeDetailProtocol {
private let episodesDataManager = EpisodesDataManager()
private var cancellables = Set<AnyCancellable>()
@IBOutlet var ... | Setting `estimatedRowHeight` to `UITableView.automaticDimension` is incorrect. The `automaticDimension` constant is meant to be used for the actual `rowHeight` property to enable dynamic sizing, but `estimatedRowHeight` should have a numeric value that approximates the typical row height. According to Apple's documenta... | import Combine
import SwiftUI
import PocketCastsDataModel
import PocketCastsServer
import UIKit
import SwiftUI
class UploadedViewController: PCViewController, UserEpisodeDetailProtocol {
private let episodesDataManager = EpisodesDataManager()
private var cancellables = Set<AnyCancellable>()
@IBOutlet var ... | @@ -13,6 +13,11 @@ class UploadedViewController: PCViewController, UserEpisodeDetailProtocol {
didSet {
registerLongPress()
uploadsTable.allowsMultipleSelectionDuringEditing = true
+ uploadsTable.rowHeight = UITableView.automaticDimension
+ uploadsTable.estimated... | podcasts/UploadedViewController.swift | 17 | Swift | 0.857 | bug | 567 | 42 | 42 | false | [Dynamic type] Uploaded files | 3,953 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
showNotesWebView.evaluateJavaScript("document.readyState", completionHandler: { [weak self] complete, _ in
guard let self = self,
let result = complete as? String,
result == "complete" // ensure that the load of HTML is complete and not in another loading state
... | `//MARK:` here is inconsistent with the rest of this file (and most of the codebase) which uses `// MARK:` with a space. Standardizing keeps Xcode’s jump bar/section formatting consistent.
```suggestion
// MARK: - Dynamic type
``` | showNotesWebView.evaluateJavaScript("document.readyState", completionHandler: { [weak self] complete, _ in
guard let self = self,
let result = complete as? String,
result == "complete" // ensure that the load of HTML is complete and not in another loading state
... | @@ -243,4 +262,20 @@ class ShowNotesPlayerItemViewController: PlayerItemViewController, SFSafariViewC
safariViewController?.delegate = nil
safariViewController = nil
}
+
+ //MARK: - Dynamic type | podcasts/ShowNotesPlayerItemViewController.swift | 26 | Swift | 1 | suggestion | 234 | 42 | 42 | false | [Dynamic Type] Update player notes header to support dynamic type | 3,954 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
cellImage.tintColor = AppTheme.colorForStyle(iconStyle)
}
}
override var iconStyle: ThemeStyle {
didSet {
handleThemeDidChange()
}
}
override func handleThemeDidChange() {
cellImage.tintColor = AppTheme.colorForStyle(iconStyle)
cellSecond... | Missing call to updateSize() in awakeFromNib(). Similar cells like DisclosureCell, SwitchCell (when there's an image), and TopLevelSettingsCell call updateSize() during initialization to ensure the icon constraints are properly set on first load. Consider adding an awakeFromNib() override that calls updateSize() to ens... | cellImage.tintColor = AppTheme.colorForStyle(iconStyle)
}
}
override var iconStyle: ThemeStyle {
didSet {
handleThemeDidChange()
}
}
override func handleThemeDidChange() {
cellImage.tintColor = AppTheme.colorForStyle(iconStyle)
cellSecond... | @@ -38,19 +38,21 @@ class NewsletterCell: ThemeableCell {
override func prepareForReuse() {
super.prepareForReuse()
- updateImageScale()
+ updateSize()
}
| podcasts/NewsletterCell.swift | 26 | Swift | 0.857 | suggestion | 455 | 37 | 42 | false | [Dynamic Type] Update account cells to support dynamic type | 3,956 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
didSet {
if showsDisclosureIndicator {
let imageView = TintableImageView(image: UIImage(named: "chevron"))
disclosureImageView = imageView
accessoryView = imageView
updateColor()
updateSize()
} else {
... | Missing call to updateSize() in awakeFromNib(). Similar cells like DisclosureCell and TopLevelSettingsCell call updateSize() during initialization to ensure the icon constraints are properly set on first load. Consider adding an awakeFromNib() override that calls updateSize() to ensure consistent behavior. | didSet {
if showsDisclosureIndicator {
let imageView = TintableImageView(image: UIImage(named: "chevron"))
disclosureImageView = imageView
accessoryView = imageView
updateColor()
updateSize()
} else {
... | @@ -74,25 +74,23 @@ class AccountActionCell: ThemeableCell {
imageAndTextColor = nil
- updateImageScale()
+ updateSize()
} | podcasts/AccountActionCell.swift | 26 | Swift | 0.5 | suggestion | 307 | 40 | 45 | false | [Dynamic Type] Update account cells to support dynamic type | 3,956 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
private lazy var container: UIView = {
let container = UIView()
container.translatesAutoresizingMaskIntoConstraints = false
return container
}()
private lazy var chaptersLabel: UILabel = {
let label = UILabel()
label.textColor = .white
label.font = .font(ofS... | The previous implementation forced semantic direction so the lock icon appeared on the intended side in both LTR and RTL. With `UIButton.Configuration`, the default `imagePlacement` is `.leading`, so removing `semanticContentAttribute` likely moves the icon and can regress RTL behavior. Consider explicitly setting `but... |
private lazy var container: UIView = {
let container = UIView()
container.translatesAutoresizingMaskIntoConstraints = false
return container
}()
private lazy var chaptersLabel: UILabel = {
let label = UILabel()
label.textColor = .white
label.font = .font(ofS... | @@ -6,36 +6,37 @@ class ChaptersHeader: UIView {
var isTogglingChapters = false
- private lazy var container: UIStackView = {
- let container = UIStackView()
- container.layoutMargins = .init(top: 0, left: 12, bottom: 0, right: 12)
- container.isLayoutMarginsRelativeArrangement = true
-... | podcasts/ChaptersHeader.swift | 26 | Swift | 0.857 | suggestion | 546 | 51 | 51 | false | [Dynamic type] Update Player chapters | 3,957 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
var isTogglingChapters = false
private lazy var container: UIView = {
let container = UIView()
container.translatesAutoresizingMaskIntoConstraints = false
return container
}()
private lazy var chaptersLabel: UILabel = {
let label = UILabel()
label.textColor = .... | There is trailing whitespace at the end of this line, which will be flagged by SwiftLint's `trailing_whitespace` rule and fail lint/CI. Please remove the extra spaces. |
var isTogglingChapters = false
private lazy var container: UIView = {
let container = UIView()
container.translatesAutoresizingMaskIntoConstraints = false
return container
}()
private lazy var chaptersLabel: UILabel = {
let label = UILabel()
label.textColor = .... | @@ -6,36 +6,37 @@ class ChaptersHeader: UIView {
var isTogglingChapters = false
- private lazy var container: UIStackView = {
- let container = UIStackView()
- container.layoutMargins = .init(top: 0, left: 12, bottom: 0, right: 12)
- container.isLayoutMarginsRelativeArrangement = true
-... | podcasts/ChaptersHeader.swift | 26 | Swift | 0.571 | bug | 167 | 51 | 51 | false | [Dynamic type] Update Player chapters | 3,957 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
NSLayoutConstraint.activate([
divider.heightAnchor.constraint(equalToConstant: 1),
divider.leadingAnchor.constraint(equalTo: container.leadingAnchor),
divider.trailingAnchor.constraint(equalTo: container.trailingAnchor),
divider.bottomAnchor.constraint(equalTo: co... | The fixed proportional width constraints (`chaptersLabel` = 40% and `toggleButton` = 50%) can cause truncation for longer localizations and larger Dynamic Type sizes (the button title can’t grow beyond 50% of the header). Consider removing these width constraints and letting intrinsic content size + hugging/compression... |
private func setUpConstraints() {
NSLayoutConstraint.activate([
divider.heightAnchor.constraint(equalToConstant: 1),
divider.leadingAnchor.constraint(equalTo: container.leadingAnchor),
divider.trailingAnchor.constraint(equalTo: container.trailingAnchor),
divi... | @@ -107,9 +108,28 @@ class ChaptersHeader: UIView {
divider.heightAnchor.constraint(equalToConstant: 1),
divider.leadingAnchor.constraint(equalTo: container.leadingAnchor),
divider.trailingAnchor.constraint(equalTo: container.trailingAnchor),
- divider.bottomAnchor.cons... | podcasts/ChaptersHeader.swift | 26 | Swift | 1 | suggestion | 1,596 | 32 | 34 | false | [Dynamic type] Update Player chapters | 3,957 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import UIKit
import PocketCastsServer
class ChaptersHeader: UIView {
weak var delegate: ChaptersHeaderDelegate?
var isTogglingChapters = false
private lazy var container: UIView = {
let container = UIView()
container.translatesAutoresizingMaskIntoConstraints = false
return contain... | `container` now relies on `layoutMarginsGuide` for leading/trailing constraints, but its `layoutMargins` are no longer set (it used to be 12pt). This will change horizontal padding (default margins are typically 8pt) and may not match the intended design. Consider restoring `container.layoutMargins = .init(top: 0, left... | import UIKit
import PocketCastsServer
class ChaptersHeader: UIView {
weak var delegate: ChaptersHeaderDelegate?
var isTogglingChapters = false
private lazy var container: UIView = {
let container = UIView()
container.translatesAutoresizingMaskIntoConstraints = false
return contain... | @@ -6,36 +6,37 @@ class ChaptersHeader: UIView {
var isTogglingChapters = false
- private lazy var container: UIStackView = {
- let container = UIStackView()
- container.layoutMargins = .init(top: 0, left: 12, bottom: 0, right: 12)
- container.isLayoutMarginsRelativeArrangement = true
-... | podcasts/ChaptersHeader.swift | 11 | Swift | 0.857 | suggestion | 578 | 36 | 36 | false | [Dynamic type] Update Player chapters | 3,957 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
}
@IBOutlet var importView: ThemeableView! {
didSet {
importView.style = .primaryUi01Active
}
}
@IBOutlet var exportView: ThemeableView! {
didSet {
exportView.style = .primaryUi01Active
}
}
@IBOutlet var importImage: UIImageView! {
... | `numberOfLines = 0` alone won’t allow the button title to wrap if the label’s `lineBreakMode` remains a truncation mode (the XIB sets `middleTruncation`). At large Dynamic Type sizes this will likely still truncate rather than expand the row. Set `exportBtn.titleLabel?.lineBreakMode = .byWordWrapping` (and keep the >=4... | }
@IBOutlet var importView: ThemeableView! {
didSet {
importView.style = .primaryUi01Active
}
}
@IBOutlet var exportView: ThemeableView! {
didSet {
exportView.style = .primaryUi01Active
}
}
@IBOutlet var importImage: UIImageView! {
... | @@ -53,6 +53,9 @@ class ImportExportViewController: PCViewController, UIDocumentInteractionControl
@IBOutlet var exportBtn: UIButton! {
didSet {
exportBtn.setTitle(L10n.exportPodcastsOption, for: .normal)
+ exportBtn.titleLabel?.font = .font(ofSize: 13, scalingWith: .subheadline)
+... | podcasts/ImportExportViewController.swift | 26 | Swift | 0.929 | suggestion | 535 | 51 | 51 | false | [Dynamic Type] Update exporter to support dynamic type | 3,958 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
chartsTable.reloadData()
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if previousTraitCollec... | `UIFontMetrics(forTextStyle: .largeTitle)` is created for every row, even though it's only used when `showFeaturedCell && indexPath.row == 0`. Consider moving the metrics initialization inside that conditional to avoid unnecessary work during table view sizing/layout passes.
```suggestion
if showFeaturedCell, i... | override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
chartsTable.reloadData()
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if previousTraitCollec... | @@ -62,10 +70,20 @@ class PodcastHeaderListViewController: PCViewController, UITableViewDataSource,
// MARK: - UITableView Methods
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+ let metric = UIFontMetrics(forTextStyle: .largeTitle)
+ if showFeature... | podcasts/PodcastHeaderListViewController.swift | 26 | Swift | 0.857 | suggestion | 409 | 51 | 51 | false | [Dynamic Type] Discovery - Feature cells | 3,959 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
}
@objc private func handleShare() {
guard let source = source?.deletingPathExtension() else { return }
Analytics.track(.discoverListShareTapped)
let activityViewController = UIActivityViewController(activityItems: [source], applicationActivities: nil)
present(activityViewContro... | The featured cell uses `.largeTitle` metrics + a minimum in `heightForRowAt`, but `estimatedHeightForRowAt` uses `UIFontMetrics.default` and no minimum. This can make the estimated height diverge from the actual height (especially for smaller content size categories), leading to extra re-layout/jumpiness while scrollin... | }
@objc private func handleShare() {
guard let source = source?.deletingPathExtension() else { return }
Analytics.track(.discoverListShareTapped)
let activityViewController = UIActivityViewController(activityItems: [source], applicationActivities: nil)
present(activityViewContro... | @@ -62,10 +70,20 @@ class PodcastHeaderListViewController: PCViewController, UITableViewDataSource,
// MARK: - UITableView Methods
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+ let metric = UIFontMetrics(forTextStyle: .largeTitle)
+ if showFeature... | podcasts/PodcastHeaderListViewController.swift | 26 | Swift | 0.643 | suggestion | 406 | 51 | 51 | false | [Dynamic Type] Discovery - Feature cells | 3,959 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsServer
import UIKit
class FeaturedSummaryViewController: SimpleNotificationsViewController, GridLayoutDelegate, UICollectionViewDataSource, UICollectionViewDelegate, DiscoverSummaryProtocol, TinyPageControlDelegate {
@IBOutlet var featuredCollectionView: ThemeableCollectionView!
@IBOutlet var... | `cellHeight` now depends on Dynamic Type scaling, but `featuredCollectionViewHeight.constant` is only updated inside `viewDidLayoutSubviews` when the view width changes. If the user changes preferred content size category while this controller is visible, the height constraint may not update, causing clipping/incorrect... | import PocketCastsServer
import UIKit
class FeaturedSummaryViewController: SimpleNotificationsViewController, GridLayoutDelegate, UICollectionViewDataSource, UICollectionViewDelegate, DiscoverSummaryProtocol, TinyPageControlDelegate {
@IBOutlet var featuredCollectionView: ThemeableCollectionView!
@IBOutlet var... | @@ -16,7 +16,11 @@ class FeaturedSummaryViewController: SimpleNotificationsViewController, GridLayo
private static let cellId = "FeaturedCollectionViewCell"
private var maxCellWidth = 400 as CGFloat
- private let cellHeight = 181 as CGFloat
+ private var cellHeight: CGFloat {
+ let metric = UIF... | podcasts/FeaturedSummaryViewController.swift | 21 | Swift | 0.786 | bug | 539 | 46 | 46 | false | [Dynamic Type] Discovery - Feature cells | 3,959 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsServer
import UIKit
class FeaturedSummaryViewController: SimpleNotificationsViewController, GridLayoutDelegate, UICollectionViewDataSource, UICollectionViewDelegate, DiscoverSummaryProtocol, TinyPageControlDelegate {
@IBOutlet var featuredCollectionView: ThemeableCollectionView!
@IBOutlet var... | This computed property simply returns cellHeight without any transformation. Consider removing fullHeight and using cellHeight directly throughout the code.
```suggestion
``` | import PocketCastsServer
import UIKit
class FeaturedSummaryViewController: SimpleNotificationsViewController, GridLayoutDelegate, UICollectionViewDataSource, UICollectionViewDelegate, DiscoverSummaryProtocol, TinyPageControlDelegate {
@IBOutlet var featuredCollectionView: ThemeableCollectionView!
@IBOutlet var... | @@ -16,7 +16,13 @@ class FeaturedSummaryViewController: SimpleNotificationsViewController, GridLayo
private static let cellId = "FeaturedCollectionViewCell"
private var maxCellWidth = 400 as CGFloat
- private let cellHeight = 181 as CGFloat
+ private var cellHeight: CGFloat {
+ return DiscoverF... | podcasts/FeaturedSummaryViewController.swift | 24 | Swift | 0.786 | suggestion | 175 | 49 | 49 | false | [Dynamic Type] Discovery - Feature cells | 3,959 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
// Calculate how many episodes will be deleted
let episodesToDelete = localEpisodes.filter { !uuids.contains($0.uuid) }
let deletedCount = episodesToDelete.count
// Log to Sentry if episodes are being deleted from the queue
// This helps track unexpected queue overwrites
... | The new `queueOverwritten`/deletion logging will currently fire for *any* deletion (`deletedCount > 0`), which is likely to occur during normal cross-device sync (user removes a single item on another device). This can create a lot of noisy Sentry warnings and doesn't match the doc comment that says it’s for “significa... |
let uuidsSet = Set(uuids)
let deletedCount = localEpisodes.reduce(0) { count, episode in
uuidsSet.contains(episode.uuid) ? count : count + 1
}
// Log to Sentry only if queue is significantly modified to avoid noise from normal sync
// Threshold: more than 75% of loc... | @@ -278,6 +310,32 @@ class UpNextSyncTask: ApiBaseTask {
FileLog.shared.addMessage("UpNextSyncTask: The following \(uuids.count) episodes will be kept: \(uuids)")
+ // Calculate how many episodes will be deleted
+ let episodesToDelete = localEpisodes.filter { !uuids.contains($0.uuid) }
+ ... | Modules/Server/Sources/PocketCastsServer/Public/Sync/UpNextSyncTask.swift | 26 | Swift | 0.643 | suggestion | 481 | 51 | 51 | false | [Watch + Up Next] watchOS Sentry logging | 3,965 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
// Meaning any episodes that exist on the server and locally will be kept regardless of if they were removed from
// the another device or not.
//
// This can result in episodes being "added back" after logging in on a different device,
// however this is preferable to accidental... | `episodesToDelete` is only used for its count, and the membership check `uuids.contains($0.uuid)` is O(n) on an Array, making this O(localEpisodes × uuids). Consider converting `uuids` to a `Set` for membership checks and computing `deletedCount` without allocating an intermediate array (or use `filter(...).count`).
``... | // Meaning any episodes that exist on the server and locally will be kept regardless of if they were removed from
// the another device or not.
//
// This can result in episodes being "added back" after logging in on a different device,
// however this is preferable to accidental... | @@ -278,6 +310,32 @@ class UpNextSyncTask: ApiBaseTask {
FileLog.shared.addMessage("UpNextSyncTask: The following \(uuids.count) episodes will be kept: \(uuids)")
+ // Calculate how many episodes will be deleted
+ let episodesToDelete = localEpisodes.filter { !uuids.contains($0.uuid) }
+ ... | Modules/Server/Sources/PocketCastsServer/Public/Sync/UpNextSyncTask.swift | 26 | Swift | 0.857 | performance | 514 | 51 | 51 | false | [Watch + Up Next] watchOS Sentry logging | 3,965 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
PlaybackManager.shared.changeEffects(effects)
} else if WatchConstants.Messages.SignificantSyncableUpdate.type == messageType {
RefreshManager.shared.refreshPodcasts()
} else if WatchConstants.Messages.MinorSyncableUpdate.type == messageType {
if DateUtil.hasEnoughTim... | The default parameter `= [:]` should be removed from the `userInfo` parameter. This is a WCSessionDelegate protocol method and should match the protocol signature exactly: `func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any])`. Default parameters on protocol method implementations can cause un... | PlaybackManager.shared.changeEffects(effects)
} else if WatchConstants.Messages.SignificantSyncableUpdate.type == messageType {
RefreshManager.shared.refreshPodcasts()
} else if WatchConstants.Messages.MinorSyncableUpdate.type == messageType {
if DateUtil.hasEnoughTim... | @@ -213,6 +228,18 @@ class WatchManager: NSObject, WCSessionDelegate {
}
}
+ func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) { | podcasts/WatchManager.swift | 26 | Swift | 0.857 | suggestion | 441 | 51 | 51 | false | [Watch + Up Next] Watch sync API updates | 3,968 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
import UIKit
import PocketCastsUtils
protocol TranscriptSearchAccessoryViewDelegate: AnyObject {
// When "Done" is tapped on this view
func doneTapped()
// When "Search" is tapped on the keyboard
func searchButtonTapped()
// Text to search for
func search(_ term: String)
// Previous matc... | The maxContentSizeCategory property is initialized to .accessibilityExtraExtraExtraLarge on line 24, but the init parameter defaults to .extraExtraLarge on line 77. This inconsistency means that if the view is initialized via the required init(coder:) method (which doesn't call the custom init), it will use the larger ... | import UIKit
import PocketCastsUtils
protocol TranscriptSearchAccessoryViewDelegate: AnyObject {
// When "Done" is tapped on this view
func doneTapped()
// When "Search" is tapped on the keyboard
func searchButtonTapped()
// Text to search for
func search(_ term: String)
// Previous matc... | @@ -21,6 +21,8 @@ protocol TranscriptSearchAccessoryViewDelegate: AnyObject {
class TranscriptSearchAccessoryView: UIInputView {
weak var delegate: TranscriptSearchAccessoryViewDelegate?
+ var maxContentSizeCategory: UIContentSizeCategory = .accessibilityExtraExtraExtraLarge | podcasts/TranscriptSearchAccessoryView.swift | 24 | Swift | 0.857 | suggestion | 653 | 49 | 49 | false | [Dynamic Type] Transcript update actions and paywall | 3,969 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
}
}
extension TranscriptSearchAccessoryView: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
delegate?.searchButtonTapped()
return true
}
}
// MARK: - Configuration Helpers
private extension TranscriptSearchAccessoryView {
func configureTextField(_... | The rightLabel font is using .large as maxSizeCategory instead of maxContentSizeCategory. This is inconsistent with line 127 where the same property is updated using maxContentSizeCategory. This means the rightLabel will be initialized with a different max size than what it gets updated to in updateSize(), which could ... | }
}
extension TranscriptSearchAccessoryView: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
delegate?.searchButtonTapped()
return true
}
}
// MARK: - Configuration Helpers
private extension TranscriptSearchAccessoryView {
func configureTextField(_... | @@ -138,19 +158,26 @@ private extension TranscriptSearchAccessoryView {
textField.backgroundColor = .systemGray3
textField.rightLabel.textColor = .secondaryLabel
textField.delegate = self
- textField.font = UIFont.preferredFont(forTextStyle: .body)
- textField.adjustsFontForCont... | podcasts/TranscriptSearchAccessoryView.swift | 26 | Swift | 0.857 | suggestion | 491 | 51 | 51 | false | [Dynamic Type] Transcript update actions and paywall | 3,969 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
private extension TranscriptSearchAccessoryView {
func configureTextField(_ textField: CustomTextField) {
textField.returnKeyType = .search
textField.autocorrectionType = .no
textField.spellCheckingType = .no
textField.clearButtonMode = .whileEditing
textField.layer.cornerRad... | The setTitle call is redundant after setAttributedTitle. When you set an attributed title on a UIButton, the attributed title takes precedence over the plain title. This line has no effect and should be removed to avoid confusion.
```suggestion
``` | private extension TranscriptSearchAccessoryView {
func configureTextField(_ textField: CustomTextField) {
textField.returnKeyType = .search
textField.autocorrectionType = .no
textField.spellCheckingType = .no
textField.clearButtonMode = .whileEditing
textField.layer.cornerRad... | @@ -138,19 +158,26 @@ private extension TranscriptSearchAccessoryView {
textField.backgroundColor = .systemGray3
textField.rightLabel.textColor = .secondaryLabel
textField.delegate = self
- textField.font = UIFont.preferredFont(forTextStyle: .body)
- textField.adjustsFontForCont... | podcasts/TranscriptSearchAccessoryView.swift | 26 | Swift | 0.857 | suggestion | 249 | 51 | 51 | false | [Dynamic Type] Transcript update actions and paywall | 3,969 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
// MARK: - Configuration Helpers
private extension TranscriptSearchAccessoryView {
func configureTextField(_ textField: CustomTextField) {
textField.returnKeyType = .search
textField.autocorrectionType = .no
textField.spellCheckingType = .no
textField.clearButtonMode = .whileEditin... | The indentation of the .font key in the attributes dictionary is inconsistent with the .foregroundColor key above it. The .font key has extra leading whitespace that should be removed for consistent formatting.
```suggestion
.font: UIFont.font(with: .callout, maxSizeCategory: maxContentSizeCategory)
``` |
// MARK: - Configuration Helpers
private extension TranscriptSearchAccessoryView {
func configureTextField(_ textField: CustomTextField) {
textField.returnKeyType = .search
textField.autocorrectionType = .no
textField.spellCheckingType = .no
textField.clearButtonMode = .whileEditin... | @@ -138,19 +158,26 @@ private extension TranscriptSearchAccessoryView {
textField.backgroundColor = .systemGray3
textField.rightLabel.textColor = .secondaryLabel
textField.delegate = self
- textField.font = UIFont.preferredFont(forTextStyle: .body)
- textField.adjustsFontForCont... | podcasts/TranscriptSearchAccessoryView.swift | 26 | Swift | 0.857 | suggestion | 316 | 51 | 51 | false | [Dynamic Type] Transcript update actions and paywall | 3,969 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import Foundation
import SwiftUI
import PocketCastsUtils
import MessageUI
import UniformTypeIdentifiers
class LogsViewModel: NSObject, ObservableObject, MFMailComposeViewControllerDelegate {
@Published var logs = ""
var presenter: UIViewController?
init(presenter: UIViewController? = nil) {
self.p... | Now that logs can come from multiple sources, `mailLogs()` still hard-codes the subject to "iOS Logs" and always attaches as "logs.txt". Consider using `selectedSource` to adjust the email subject and attachment filename so shared watch logs aren’t mislabeled as iOS logs. | import Foundation
import SwiftUI
import PocketCastsUtils
import MessageUI
import UniformTypeIdentifiers
enum LogSource: String, CaseIterable {
case iOS
case watchOS
}
class LogsViewModel: NSObject, ObservableObject, MFMailComposeViewControllerDelegate {
@Published var logs = ""
@Published var selected... | @@ -4,18 +4,32 @@ import PocketCastsUtils
import MessageUI
import UniformTypeIdentifiers
+enum LogSource: String, CaseIterable {
+ case iOS
+ case watchOS
+}
+
class LogsViewModel: NSObject, ObservableObject, MFMailComposeViewControllerDelegate {
@Published var logs = ""
+ @Published var selectedSour... | podcasts/LogsView.swift | 15 | Swift | 0.643 | suggestion | 272 | 40 | 40 | false | [Watch + Up Next] Send file watchOS log + add to LogsView | 3,971 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
effects.toggleDefinedSpeedInterval()
PlaybackManager.shared.changeEffects(effects)
} else if WatchConstants.Messages.SignificantSyncableUpdate.type == messageType {
RefreshManager.shared.refreshPodcasts()
} else if WatchConstants.Messages.MinorSyncableUpdate.type == ... | With `watchLogFileTransfer` enabled, the watch side responds to the log request with an empty reply and delivers the contents later via `transferFile`. The current iOS `requestLogFile` path treats a reply without `logContents` as a completed request (returns cached value) and cancels the timeout, so the UI/support flow... | effects.toggleDefinedSpeedInterval()
PlaybackManager.shared.changeEffects(effects)
} else if WatchConstants.Messages.SignificantSyncableUpdate.type == messageType {
RefreshManager.shared.refreshPodcasts()
} else if WatchConstants.Messages.MinorSyncableUpdate.type == ... | @@ -213,6 +213,15 @@ class WatchManager: NSObject, WCSessionDelegate {
}
}
+ func session(_ session: WCSession, didReceive file: WCSessionFile) {
+ guard FeatureFlag.watchLogFileTransfer.enabled else { return }
+
+ // Check if this is a log file transfer
+ if file.metadata?[Watch... | podcasts/WatchManager.swift | 26 | Swift | 0.786 | performance | 634 | 51 | 51 | false | [Watch + Up Next] Send file watchOS log + add to LogsView | 3,971 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
private func handleChangeChapter(next: Bool) {
if next {
PlaybackManager.shared.skipToNextChapter()
} else {
PlaybackManager.shared.skipToPreviousChapter()
}
}
private func handleMarkPlayed(episodeUuid: String) {
guard let episode = DataManager.shared... | `handleLogFileTransfer` reads the transferred file but never removes it. `WCSessionFile.fileURL` points to an inbox file that can accumulate over time; after successfully parsing it, delete the file to avoid unbounded temporary storage growth.
```suggestion
}
do {
try FileManager... | }
private func handleUnarchive(episodeUuid: String) {
guard let episode = DataManager.sharedManager.findEpisode(uuid: episodeUuid) else { return }
EpisodeManager.unarchiveEpisode(episode: episode, fireNotification: true)
sendStateToWatchInBackground()
}
private func handleChan... | @@ -294,6 +303,20 @@ class WatchManager: NSObject, WCSessionDelegate {
}
}
+ private func handleLogFileTransfer(file: WCSessionFile) {
+ do {
+ let logContents = try String(contentsOf: file.fileURL, encoding: .utf8)
+ Task {
+ await logCache.setCachedLog(lo... | podcasts/WatchManager.swift | 26 | Swift | 1 | bug | 525 | 51 | 51 | false | [Watch + Up Next] Send file watchOS log + add to LogsView | 3,971 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
class LogsViewModel: NSObject, ObservableObject, MFMailComposeViewControllerDelegate {
@Published var logs = ""
var presenter: UIViewController?
init(presenter: UIViewController? = nil) {
self.presenter = presenter
}
func load() async {
let result = await FileLog.shared.logFileAsS... | The `load()` implementation sets the watch logs UI to the “not available” message immediately when `watchLogFileAsString()` returns nil. In file-transfer mode the initial request can legitimately return nil/old cache while the log arrives asynchronously via `transferFile`, so this can present a false negative and never... |
enum LogSource: String, CaseIterable {
case iOS
case watchOS
}
class LogsViewModel: NSObject, ObservableObject, MFMailComposeViewControllerDelegate {
@Published var logs = ""
@Published var selectedSource: LogSource = .iOS
var presenter: UIViewController?
init(presenter: UIViewController? = n... | @@ -4,18 +4,32 @@ import PocketCastsUtils
import MessageUI
import UniformTypeIdentifiers
+enum LogSource: String, CaseIterable {
+ case iOS
+ case watchOS
+}
+
class LogsViewModel: NSObject, ObservableObject, MFMailComposeViewControllerDelegate {
@Published var logs = ""
+ @Published var selectedSour... | podcasts/LogsView.swift | 26 | Swift | 0.857 | performance | 1,128 | 51 | 51 | false | [Watch + Up Next] Send file watchOS log + add to LogsView | 3,971 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
@EnvironmentObject var theme: Theme
var body: some View {
VStack {
NonEditableTextView(text: model.logs, scrolledToBottom: true)
Spacer()
}
.navigationTitle(L10n.logs)
.toolbar {
ToolbarItemGroup(placement: .topBarTrailing) {
i... | The Picker’s accessibility label/title is hard-coded ("Log Source") and the segment titles come from `rawValue`, so they won’t localize with the rest of the view (which uses `L10n`). Consider adding localized strings for the picker label and segment titles. | }
presenter?.present(mailVC, animated: true)
}
func mailComposeController(_ controller: MFMailComposeViewController,
didFinishWith result: MFMailComposeResult,
error: Error?) {
presenter?.dismiss(animated: true)
}... | @@ -66,9 +80,18 @@ struct LogsView: View {
@EnvironmentObject var theme: Theme
var body: some View {
- VStack {
+ VStack(spacing: 0) {
+ Picker("Log Source", selection: $model.selectedSource) {
+ ForEach(LogSource.allCases, id: \.self) { source in
+ ... | podcasts/LogsView.swift | 26 | Swift | 0.643 | suggestion | 257 | 40 | 51 | false | [Watch + Up Next] Send file watchOS log + add to LogsView | 3,971 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | bjtitus |
progressView.backgroundColor = .black.withAlphaComponent(0.1)
}
// Disclosure icon
switch activeTheme {
case .dark:
disclosureImageView.backgroundColor = AppTheme.colorForStyle(.primaryInteractive02)
disclosureImageView.tintColor = nil
case .... | The `setNeedsUpdateConstraints()` call is ineffective because there is no `updateConstraints()` override in this class. This method only triggers constraint updates when there's a corresponding `updateConstraints()` implementation.
Looking at the XIB changes, a spacer view was added to the stack view with a width con... | } else {
progressView.backgroundColor = .black.withAlphaComponent(0.1)
}
// Disclosure icon
switch activeTheme {
case .dark:
disclosureImageView.backgroundColor = AppTheme.colorForStyle(.primaryInteractive02)
disclosureImageView.tintColor = ni... | @@ -174,6 +175,9 @@ class UpNextNowPlayingCell: ThemeableCell {
}
func updateDownloadStatus() {
+ defer {
+ setNeedsUpdateConstraints()
+ } | podcasts/UpNextNowPlayingCell.swift | 26 | Swift | 1 | refactor | 798 | 51 | 51 | false | [Dynamic type] Update alignment on up next cells | 3,972 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsServer
import PocketCastsUtils
import UIKit
class SmallPagedListSummaryViewController: DiscoverPeekViewController, GridLayoutDelegate, UICollectionViewDataSource, DiscoverSummaryProtocol, TinyPageControlDelegate {
@IBOutlet var podcastImage: PodcastImageView!
@IBOutlet var showAllButton: Them... | The font is configured to scale with `.title1` text style, but the XIB file specifies `UICTFontTextStyleTitle2`. This creates an inconsistency where the XIB's font descriptor and the Swift code's scaling text style don't match. According to the codebase convention seen in DiscoverFeaturedView.swift, a 22pt bold font sh... | import PocketCastsServer
import PocketCastsUtils
import UIKit
class SmallPagedListSummaryViewController: DiscoverPeekViewController, GridLayoutDelegate, UICollectionViewDataSource, DiscoverSummaryProtocol, TinyPageControlDelegate {
@IBOutlet var podcastImage: PodcastImageView!
@IBOutlet var showAllButton: Them... | @@ -7,10 +7,19 @@ class SmallPagedListSummaryViewController: DiscoverPeekViewController, GridLayou
@IBOutlet var showAllButton: ThemeableUIButton! {
didSet {
showAllButton.setTitle(L10n.discoverShowAll.localizedUppercase, for: .normal)
+ showAllButton.titleLabel?.font = .font(ofSiz... | podcasts/SmallPagedListSummaryViewController.swift | 18 | Swift | 0.857 | suggestion | 528 | 43 | 43 | false | [Dynamic type] Discover trending list | 3,975 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsServer
import UIKit
import PocketCastsDataModel
class LargeListSummaryViewController: DiscoverPeekViewController, DiscoverSummaryProtocol, UICollectionViewDataSource, GridLayoutDelegate, UICollectionViewDelegateFlowLayout {
@IBOutlet weak var divider: ThemeDividerView!
@IBOutlet weak var tit... | The traitCollectionDidChange implementation is missing the guard statement pattern used consistently throughout the codebase. This should include a guard statement to exit early if the preferredContentSizeCategory hasn't changed, avoiding unnecessary work when trait collection changes for other reasons like appearance ... | // MARK: - Page Changed
override func pageDidChange(to currentPage: Int, totalPages: Int) {
guard let item else {
return
}
Analytics.track(.discoverLargeListPageChanged, properties: ["current_page": currentPage,
... | @@ -242,4 +255,20 @@ class LargeListSummaryViewController: DiscoverPeekViewController, DiscoverSummar
"total_pages": totalPages,
"list_id": item.inferredListId])
}
+
+ // MAR... | podcasts/LargeListSummaryViewController.swift | 26 | Swift | 0.857 | suggestion | 517 | 246 | 29 | false | [Dynamic Type] Discover large list | 3,977 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
import PocketCastsServer
import PocketCastsUtils
import UIKit
class LargeListCell: ThemeableCollectionCell {
@IBOutlet var podcastImage: PodcastImageView!
@IBOutlet var podcastTitle: ThemeableLabel!
@IBOutlet var podcastAuthor: ThemeableLabel! {
didSet {
podcastAuthor.style = .primaryT... | The traitCollectionDidChange implementation is missing the guard statement pattern used consistently throughout the codebase. This should include a guard statement to exit early if the preferredContentSizeCategory hasn't changed, avoiding unnecessary work when trait collection changes for other reasons like appearance ... | }
override func prepareForReuse() {
super.prepareForReuse()
podcastImage.clearArtwork()
subscribeButton.shouldAnimate = false
subscribeButton.currentlyOn = false
discoverPodcast = nil
updateSize()
}
// MARK: - Dynamic Type support
func updateSize()... | @@ -80,5 +91,22 @@ class LargeListCell: ThemeableCollectionCell {
subscribeButton.shouldAnimate = false
subscribeButton.currentlyOn = false
discoverPodcast = nil
+ updateSize()
+ }
+
+ // MARK: - Dynamic Type support
+
+ func updateSize() {
+ let largeSize = traitCollec... | podcasts/LargeListCell.swift | 26 | Swift | 0.857 | suggestion | 517 | 85 | 29 | false | [Dynamic Type] Discover large list | 3,977 | Automattic/pocket-casts-ios | 1,136 | Swift | Copilot | SergioEstevao |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.