commit
0786988d96
|
@ -35,7 +35,6 @@ struct ContinueWatchingView: View {
|
|||
|
||||
var body: some View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
if items.count > 0 {
|
||||
LazyHStack {
|
||||
Spacer().frame(width: 14)
|
||||
ForEach(items, id: \.id) { item in
|
||||
|
@ -82,4 +81,3 @@ struct ContinueWatchingView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,15 +16,16 @@ struct HomeView: View {
|
|||
@Environment(\.verticalSizeClass) var vSizeClass
|
||||
@State var showingSettings = false
|
||||
|
||||
var body: some View {
|
||||
@ViewBuilder
|
||||
var innerBody: some View {
|
||||
if(viewModel.isLoading) {
|
||||
ProgressView()
|
||||
} else {
|
||||
ScrollView {
|
||||
LazyVStack(alignment: .leading) {
|
||||
Spacer().frame(height: hSizeClass == .compact && vSizeClass == .regular ? 0 : 16)
|
||||
if !viewModel.resumeItems.isEmpty {
|
||||
ContinueWatchingView(items: viewModel.resumeItems)
|
||||
.padding(.top, hSizeClass == .compact && vSizeClass == .regular ? 0 : 16)
|
||||
}
|
||||
if !viewModel.nextUpItems.isEmpty {
|
||||
NextUpView(items: viewModel.nextUpItems)
|
||||
|
@ -52,10 +53,15 @@ struct HomeView: View {
|
|||
}.padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.top, hSizeClass == .compact && vSizeClass == .regular ? 0 : 16)
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .phone ? 20 : 30)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer().frame(height: UIDevice.current.userInterfaceIdiom == .phone ? 20 : 30)
|
||||
}
|
||||
}
|
||||
var body: some View {
|
||||
innerBody
|
||||
.navigationTitle(MainTabView.Tab.home.localized)
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .navigationBarTrailing) {
|
||||
|
@ -71,4 +77,3 @@ struct HomeView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
import SwiftUI
|
||||
|
||||
struct LatestMediaView: View {
|
||||
@StateObject var viewModel: LatestMediaViewModel
|
||||
@ObservedObject var viewModel: LatestMediaViewModel
|
||||
|
||||
var body: some View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
ZStack {
|
||||
LazyHStack {
|
||||
Spacer().frame(width: 16)
|
||||
ForEach(viewModel.items, id: \.id) { item in
|
||||
|
@ -43,7 +42,6 @@ struct LatestMediaView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 190)
|
||||
}
|
||||
.padding(EdgeInsets(top: -2, leading: 0, bottom: 0, trailing: 0)).frame(height: 190)
|
||||
|
|
|
@ -15,7 +15,6 @@ struct NextUpView: View {
|
|||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
if items.count != 0 {
|
||||
Text("Next Up")
|
||||
.font(.title2)
|
||||
.fontWeight(.bold)
|
||||
|
@ -48,7 +47,6 @@ struct NextUpView: View {
|
|||
}
|
||||
.frame(height: 200)
|
||||
}
|
||||
}
|
||||
.padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ final class ConnectToServerViewModel: ViewModel {
|
|||
func getPublicUsers() {
|
||||
if ServerEnvironment.current.server != nil {
|
||||
UserAPI.getPublicUsers()
|
||||
.trackActivity(loading)
|
||||
.sink(receiveCompletion: { completion in
|
||||
self.handleAPIRequestCompletion(completion: completion)
|
||||
}, receiveValue: { response in
|
||||
|
@ -56,6 +57,7 @@ final class ConnectToServerViewModel: ViewModel {
|
|||
|
||||
func connectToServer() {
|
||||
ServerEnvironment.current.create(with: uriSubject.value)
|
||||
.trackActivity(loading)
|
||||
.sink(receiveCompletion: { result in
|
||||
switch result {
|
||||
case let .failure(error):
|
||||
|
@ -71,6 +73,7 @@ final class ConnectToServerViewModel: ViewModel {
|
|||
|
||||
func login() {
|
||||
SessionManager.current.login(username: usernameSubject.value, password: passwordSubject.value)
|
||||
.trackActivity(loading)
|
||||
.sink(receiveCompletion: { completion in
|
||||
switch completion {
|
||||
case .finished:
|
||||
|
|
Loading…
Reference in New Issue