Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions score-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"score-ios/Preview Content\"";
DEVELOPMENT_TEAM = W7U2WA4D54;
ENABLE_PREVIEWS = YES;
Expand All @@ -960,7 +960,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.3;
MARKETING_VERSION = 2.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.cornellappdev.score-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand All @@ -978,7 +978,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"score-ios/Preview Content\"";
DEVELOPMENT_TEAM = W7U2WA4D54;
ENABLE_PREVIEWS = YES;
Expand All @@ -994,7 +994,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.3;
MARKETING_VERSION = 2.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.cornellappdev.score-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down
9 changes: 4 additions & 5 deletions score-ios/ViewModels/GamesViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class GamesViewModel: ObservableObject
// TODO: Remove once backend is has implemented pagination with sorted dates and pages by game type
func fetchGames() {
// Set loading state before fetch
dataState = (hasNotFetchedYet ? .loading : .refreshing)
dataState = (dataState == .success ? .refreshing : .loading)

self.privateUpcomingGames.removeAll()
self.privatePastGames.removeAll()
Expand Down Expand Up @@ -209,13 +209,12 @@ class GamesViewModel: ObservableObject
}

guard let fetchedGames = fetchedGames, !fetchedGames.isEmpty else {
// If this is the first fetch and no games, show empty data error
if offset == 0 {
// First page returned empty —> no games
self.dataState = .error(error: .emptyData)
} else {
// // Otherwise process all accumulated games
// self.processGames(accumulatedGames)
self.dataState = .error(error: .networkError)
// Process what we have
self.processGames(accumulatedGames)
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion score-ios/ViewModels/HighlightsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HighlightsViewModel: ObservableObject {

// MARK: - Loading
func loadHighlights() {
dataState = (hasNotFetchedYet ? .loading : .refreshing)
dataState = (dataState == .success ? .refreshing : .loading)

Task {
do {
Expand Down
7 changes: 4 additions & 3 deletions score-ios/Views/ListViews/GameErrorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import SwiftUI

struct GameErrorView: View {

@ObservedObject var viewModel: GamesViewModel
let message: String
let onRetry: () -> Void

var body: some View {
ZStack {
Expand All @@ -25,7 +26,7 @@ struct GameErrorView: View {
.frame(width: 64, height: 64)
.padding(.bottom, 16)

Text("Oops! Schedules failed to load.")
Text("Oops! \(message) failed to load.")
.font(Constants.Fonts.Header.h2)
.padding(.bottom, 8)

Expand All @@ -35,7 +36,7 @@ struct GameErrorView: View {
Spacer()

Button {
viewModel.fetchGames()
onRetry()
} label: {
HStack {
Image(systemName: "arrow.trianglehead.2.clockwise")
Expand Down
19 changes: 3 additions & 16 deletions score-ios/Views/ListViews/HighlightTileArticle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,15 @@ struct HighlightTileArticle: View {
// Background Image with dark overlay
AsyncImage(url: URL(string: article.image)) { phase in
switch phase {
case .empty:
Rectangle()
.fill(Constants.Colors.gray_icons.opacity(0.2))
.overlay(Color.black.opacity(0.60)) // dark tint
case .success(let image):
image
.resizable()
.scaledToFill()
.overlay(Color.black.opacity(0.60)) // dark tint
case .failure(_):
default:
Rectangle()
.fill(Constants.Colors.gray_icons.opacity(0.3))
.overlay(
Image(systemName: "photo")
.resizable()
.scaledToFit()
.foregroundColor(.white.opacity(0.7))
.padding()
.overlay(Color.black.opacity(0.60)) // dark tint
)
@unknown default:
EmptyView()
.fill(Constants.Colors.gray_icons.opacity(0.2))
.overlay(Color.black.opacity(0.60)) // dark tint
}
}
.frame(width: width, height: 192)
Expand Down
17 changes: 5 additions & 12 deletions score-ios/Views/ListViews/HighlightTileVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,15 @@ struct HighlightTileVideo: View {
// Thumbnail
AsyncImage(url: URL(string: video.thumbnail)) { phase in
switch phase {
case .empty:
// While loading
Rectangle()
.fill(Constants.Colors.gray_icons.opacity(0.2))
case .success(let image):
image
.resizable()
.scaledToFill()
case .failure(_):
// If loading fails
Image(systemName: "photo")
.resizable()
.scaledToFit()
.foregroundColor(.gray)
@unknown default:
EmptyView()
.overlay(Color.black.opacity(0.60)) // dark tint
default:
Rectangle()
.fill(Constants.Colors.gray_icons.opacity(0.2))
.overlay(Color.black.opacity(0.60)) // dark tint
}
}
.frame(width: width, height: 117)
Expand Down
5 changes: 4 additions & 1 deletion score-ios/Views/ListViews/HighlightView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ struct HighlightView: View {
switch viewModel.dataState {
case .idle, .loading:
HighlightLoadingView()


case .error:
GameErrorView(message: "Highlights", onRetry: { viewModel.loadHighlights() })

default:
VStack{
headerView
Expand Down
2 changes: 1 addition & 1 deletion score-ios/Views/ListViews/PastGamesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct PastGamesView: View {
}

if case .error = vm.dataState {
GameErrorView(viewModel: vm)
GameErrorView(message: "Schedules", onRetry: { vm.fetchGames() })
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion score-ios/Views/ListViews/UpcomingGamesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct UpcomingGamesView: View {
}

if case .error = vm.dataState {
GameErrorView(viewModel: vm)
GameErrorView(message: "Schedules", onRetry: { vm.fetchGames() })
}
}
}
Expand Down