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