mirror of
https://github.com/wallabag/ios-app.git
synced 2026-05-19 15:10:34 +00:00
b59b9e0408
* Bump version * Clean code (#393) * Mac os version (#395) * wip mac os version * Build on macos * WIP Webview * Update app icon Refacto routing * Move folder * Image list * Change badge update * Arrange entry view menu * Add refresh command * Add app Sandbox for macos + first build on macos * Fix #397 * Fix macos build * Try fix app icon * Rework toolbar entry * Fix logo * Add test on serverViewModel * Update refresh button * Clean file + clean Picker * Fix progress view * Fix delete entry on ipad fix #389 * Swiftformat * Add swipe to back fix #356 * enhance bottom button tap fix #400 * Add dismiss action in entry view fix #338 * Add sorting options only on id fix #71 * Add progress
77 lines
2.8 KiB
Swift
77 lines
2.8 KiB
Swift
import Factory
|
|
import SwiftUI
|
|
|
|
#if os(iOS)
|
|
struct PlayerView: View {
|
|
@EnvironmentObject var playerPublisher: PlayerPublisher
|
|
|
|
var body: some View {
|
|
VStack {
|
|
if playerPublisher.podcast != nil {
|
|
playerPublisher.podcast.map { podcast in
|
|
VStack {
|
|
EntryPicture(url: podcast.picture).frame(width: 100, alignment: .center)
|
|
Text(podcast.title)
|
|
.padding(4)
|
|
HStack {
|
|
Button(action: {
|
|
playerPublisher.togglePlaying()
|
|
}, label: {
|
|
Image(systemName: playerPublisher.isPlaying ? "pause.circle" : "play.circle")
|
|
}).font(.system(size: 30))
|
|
Button(action: {
|
|
playerPublisher.stop()
|
|
}, label: {
|
|
Image(systemName: "stop.circle")
|
|
}).font(.system(size: 30))
|
|
}
|
|
.buttonStyle(.plain)
|
|
}.padding()
|
|
}
|
|
} else {
|
|
VStack {
|
|
EntryPicture(url: nil).frame(width: 100, alignment: .center)
|
|
Text("Select one entry")
|
|
.padding(4)
|
|
HStack {
|
|
Button(action: {}, label: {
|
|
Image(systemName: "play.circle")
|
|
.font(.system(size: 30))
|
|
}).disabled(true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.frame(width: 200, height: 200, alignment: .center)
|
|
.background(Color.primary.colorInvert())
|
|
.cornerRadius(6)
|
|
.shadow(radius: 10)
|
|
.gesture(DragGesture().onEnded { swipe in
|
|
if swipe.startLocation.x < swipe.location.x {
|
|
playerPublisher.showPlayer = false
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
struct PlayerView_Previews: PreviewProvider {
|
|
static var player: PlayerPublisher = {
|
|
let coreData = Container.shared.coreData()
|
|
let player = PlayerPublisher()
|
|
let entry = Entry(context: coreData.viewContext)
|
|
player.load(entry)
|
|
return player
|
|
}()
|
|
|
|
static var previews: some View {
|
|
PlayerView()
|
|
.environmentObject(PlayerPublisher())
|
|
.previewLayout(.sizeThatFits)
|
|
|
|
PlayerView()
|
|
.environmentObject(player)
|
|
.previewLayout(.sizeThatFits)
|
|
}
|
|
}
|
|
#endif
|