Add a share button for exporting MP3s, mostly useful for debugging

This commit is contained in:
Jackson Harper
2022-08-24 22:18:01 +08:00
parent 24901f9c01
commit 886d5fbe2c

View File

@ -88,6 +88,26 @@ public struct MiniPlayer: View {
.padding(.top, 8)
.frame(maxWidth: .infinity, alignment: .leading)
Button(
action: {
let shareActivity = UIActivityViewController(activityItems: [self.audioSession.localAudioUrl], applicationActivities: nil)
if let vc = UIApplication.shared.windows.first?.rootViewController {
shareActivity.popoverPresentationController?.sourceView = vc.view
// Setup share activity position on screen on bottom center
shareActivity.popoverPresentationController?.sourceRect = CGRect(x: UIScreen.main.bounds.width / 2, y: UIScreen.main.bounds.height, width: 0, height: 0)
shareActivity.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.down
vc.present(shareActivity, animated: true, completion: nil)
}
},
label: {
Image(systemName: "square.and.arrow.up")
.font(.appCallout)
.tint(.appGrayText)
}
)
.padding(.top, 8)
.frame(maxWidth: .infinity, alignment: .trailing)
Capsule()
.fill(.gray)
.frame(width: 60, height: 4)