Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/mobile/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,24 @@ target 'AudiusReactNative' do
end
end

# SwiftAudioEx 1.x only shifts the current index for an insert in front
# of the current item when the queue already has more than one item. With
# a single item, inserting at 0 leaves the index one slot early, so the
# player replays the current track instead of advancing. Fixed upstream
# on main but not released. Fail if the line changes so an update can't
# silently drop the patch.
queue_manager = File.join(__dir__, 'Pods/SwiftAudioEx/Sources/SwiftAudioEx/QueueManager.swift')
buggy_line = 'if (self.items.count > 1 && currentIndex >= index) {'
fixed_line = 'if (self.items.count > 0 && currentIndex >= index) {'
text = File.read(queue_manager)
if text.include?(buggy_line)
File.chmod(0644, queue_manager)
File.write(queue_manager, text.sub(buggy_line, fixed_line))
Pod::UI.puts "Patched SwiftAudioEx QueueManager.swift: shift current index when inserting into a one-item queue".green
elsif !text.include?(fixed_line)
raise "SwiftAudioEx QueueManager.swift no longer contains '#{buggy_line}'. Check whether the insert index fix is still needed and update the Podfile patch."
end

end
end

Loading