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
24 changes: 18 additions & 6 deletions score-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@
7626AD6B2E973D9B002149CD /* HighlightTileArticle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7626AD652E973D9B002149CD /* HighlightTileArticle.swift */; };
7626AD6C2E973D9B002149CD /* HighlightTileVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7626AD662E973D9B002149CD /* HighlightTileVideo.swift */; };
7626AD6F2E973E08002149CD /* View+CornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7626AD6E2E973E08002149CD /* View+CornerRadius.swift */; };
7665A4072EB00531004A9903 /* HighlightsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7665A4062EB00528004A9903 /* HighlightsViewModel.swift */; };
7675D0932EBC0F1D00940292 /* NoHighlightView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7675D0922EBC0F1700940292 /* NoHighlightView.swift */; };
76AED8512EC50B7F00694C0B /* YoutubeVideo.graphql in Resources */ = {isa = PBXBuildFile; fileRef = 76AED8502EC50B7100694C0B /* YoutubeVideo.graphql */; };
76AED8532EC50C2700694C0B /* Article.graphql in Resources */ = {isa = PBXBuildFile; fileRef = 76AED8522EC50C2100694C0B /* Article.graphql */; };
76D998E92E9F1AF900713EE5 /* SearchViewFullScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D998E82E9F1AF300713EE5 /* SearchViewFullScreen.swift */; };
76E679212E9FF6A100C39132 /* NoHighlightView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E679202E9FF69C00C39132 /* NoHighlightView.swift */; };
B136701ECD164EE9AC64667F /* Article.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CB4DBAE237D47AB882D4EBC /* Article.swift */; };
CE335CD32C922E8D0037F572 /* PrimaryColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD22C922E8D0037F572 /* PrimaryColors.swift */; };
CE335CD52C922ECB0037F572 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD42C922ECB0037F572 /* Constants.swift */; };
Expand Down Expand Up @@ -137,8 +140,11 @@
7626AD662E973D9B002149CD /* HighlightTileVideo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightTileVideo.swift; sourceTree = "<group>"; };
7626AD672E973D9B002149CD /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
7626AD6E2E973E08002149CD /* View+CornerRadius.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+CornerRadius.swift"; sourceTree = "<group>"; };
7665A4062EB00528004A9903 /* HighlightsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightsViewModel.swift; sourceTree = "<group>"; };
7675D0922EBC0F1700940292 /* NoHighlightView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoHighlightView.swift; sourceTree = "<group>"; };
76AED8502EC50B7100694C0B /* YoutubeVideo.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = YoutubeVideo.graphql; sourceTree = "<group>"; };
76AED8522EC50C2100694C0B /* Article.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = Article.graphql; sourceTree = "<group>"; };
76D998E82E9F1AF300713EE5 /* SearchViewFullScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewFullScreen.swift; sourceTree = "<group>"; };
76E679202E9FF69C00C39132 /* NoHighlightView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoHighlightView.swift; sourceTree = "<group>"; };
840304A20FA141C291346BA8 /* Highlight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Highlight.swift; sourceTree = "<group>"; };
CE335CD22C922E8D0037F572 /* PrimaryColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryColors.swift; sourceTree = "<group>"; };
CE335CD42C922ECB0037F572 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -431,7 +437,7 @@
D86347AE2CDBD2F3003DD8F6 /* PastGameCard.swift */,
CE528FF62C979DA000C238B5 /* GameView.swift */,
D836AD912CB62C8800BD1545 /* NoGameView.swift */,
76E679202E9FF69C00C39132 /* NoHighlightView.swift */,
7675D0922EBC0F1700940292 /* NoHighlightView.swift */,
D87882272CC060FC00421F67 /* GameDetailedScoreView.swift */,
CE3C9C402D010177008BFB4C /* ScoringSummary.swift */,
);
Expand Down Expand Up @@ -491,6 +497,7 @@
isa = PBXGroup;
children = (
D87787C72CFFAE5200EA79E1 /* GamesViewModel.swift */,
7665A4062EB00528004A9903 /* HighlightsViewModel.swift */,
D864B5AA2D793A7400A3A50E /* PastGameViewModel.swift */,
);
path = ViewModels;
Expand All @@ -508,6 +515,8 @@
children = (
D8DD4E632CFD48E400F2C46E /* Team.graphql */,
D891020A2CED6A86004CE226 /* Game.graphql */,
76AED8522EC50C2100694C0B /* Article.graphql */,
76AED8502EC50B7100694C0B /* YoutubeVideo.graphql */,
D89102062CED6A28004CE226 /* schema.graphqls */,
);
path = GraphQL;
Expand Down Expand Up @@ -615,7 +624,7 @@
packageReferences = (
D89102012CED68D9004CE226 /* XCRemoteSwiftPackageReference "apollo-ios" */,
D0A904F32E8DDD990008194B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
76101F682E9743EC006D6EDD /* XCLocalSwiftPackageReference "gameAPI" */,
761050E32EC50DCC00FD73F8 /* XCLocalSwiftPackageReference "gameAPI" */,
);
productRefGroup = CE725D392C89120200386943 /* Products */;
projectDirPath = "";
Expand All @@ -636,9 +645,11 @@
D8DD4E642CFD48ED00F2C46E /* Team.graphql in Resources */,
D891020B2CED6A8E004CE226 /* Game.graphql in Resources */,
2C1375CB2E7233390089EBC7 /* GoogleService-Info.plist in Resources */,
76AED8512EC50B7F00694C0B /* YoutubeVideo.graphql in Resources */,
CE528FE42C96A27500C238B5 /* Poppins-Light.ttf in Resources */,
CE528FEE2C96A27500C238B5 /* Poppins-Black.ttf in Resources */,
CE528FEC2C96A27500C238B5 /* Poppins-LightItalic.ttf in Resources */,
76AED8532EC50C2700694C0B /* Article.graphql in Resources */,
CE528FEF2C96A27500C238B5 /* Poppins-Thin.ttf in Resources */,
CE528FE02C96A27500C238B5 /* Poppins-ExtraLight.ttf in Resources */,
CE528FF02C96A27500C238B5 /* Poppins-SemiBold.ttf in Resources */,
Expand Down Expand Up @@ -749,16 +760,17 @@
FD27F4232DC0A68900CC172E /* GamesCacheManager.swift in Sources */,
CE725D3C2C89120200386943 /* Home.swift in Sources */,
FD5A38DF2D8F3E1400CF5E30 /* ShimmerModifier.swift in Sources */,
76E679212E9FF6A100C39132 /* NoHighlightView.swift in Sources */,
CE528FA02C96420700C238B5 /* PickerView.swift in Sources */,
CE528FA42C9653C200C238B5 /* Error.swift in Sources */,
CE335CD52C922ECB0037F572 /* Constants.swift in Sources */,
CE8ED4FE2D6BF49E00A274DE /* GameUpdate.swift in Sources */,
7665A4072EB00531004A9903 /* HighlightsViewModel.swift in Sources */,
D86347E12CE98D37003DD8F6 /* TabViewIcon.swift in Sources */,
CE3C9C412D010177008BFB4C /* ScoringSummary.swift in Sources */,
CE8ED50E2D6C3B8000A274DE /* SportSelectorView.swift in Sources */,
CE8ED5082D6C36E200A274DE /* GameListView.swift in Sources */,
CE8ED5142D6C42D400A274DE /* GameSectionHeaderView.swift in Sources */,
7675D0932EBC0F1D00940292 /* NoHighlightView.swift in Sources */,
D86347B12CDBFF7C003DD8F6 /* UpcomingGamesView.swift in Sources */,
D86347DF2CE98B3C003DD8F6 /* MainTabView.swift in Sources */,
1C87865F2D8CDADC00EBDF74 /* String+Extension.swift in Sources */,
Expand Down Expand Up @@ -1099,7 +1111,7 @@
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
76101F682E9743EC006D6EDD /* XCLocalSwiftPackageReference "gameAPI" */ = {
761050E32EC50DCC00FD73F8 /* XCLocalSwiftPackageReference "gameAPI" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = gameAPI;
};
Expand Down
55 changes: 11 additions & 44 deletions score-ios/Models/Article.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
//

import Foundation
import GameAPI

struct Article: Identifiable {
var id: String
var title: String
var summary: String
var image: String
var url: String
var source: String
var publishedAt: String
var sport: Sport

var formattedDate: String {
if let date = ISO8601DateFormatter().date(from: publishedAt) {
Expand All @@ -24,46 +24,13 @@ struct Article: Identifiable {
}
return publishedAt
}
}

// MARK: - Dummy Data
extension Article {
static let dummyData: [Article] = [
Article(
id: "1",
title: "Cornell Upsets Rival in Thrilling Overtime Victory",
summary: "Cornell's offense exploded late in the fourth quarter to secure a dramatic win.",
image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2",
url: "https://cornellbigred.com/news/2025/10/08/article",
source: "Cornell Daily Sun",
publishedAt: "2025-10-08T00:00:00Z"
),
Article(
id: "2",
title: "Cornell Daily Sun Reports Historic Win",
summary: "Cornell's offense shines in a big win.",
image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2",
url: "https://cornellsun.com/article",
source: "Cornell Daily Sun",
publishedAt: "2025-10-09T00:00:00Z"
),
Article(
id: "3",
title: "Big Red Basketball Team Advances to Championship",
summary: "Cornell basketball team secures spot in the championship game with dominant performance.",
image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2",
url: "https://cornellsun.com/basketball-championship",
source: "Cornell Daily Sun",
publishedAt: "2025-10-10T00:00:00Z"
),
Article(
id: "4",
title: "Hockey Team Prepares for Rivalry Game",
summary: "Cornell hockey team gears up for the highly anticipated rivalry matchup.",
image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2",
url: "https://cornellsun.com/hockey-rivalry",
source: "Cornell Daily Sun",
publishedAt: "2025-10-11T00:00:00Z"
)
]

init(from gqlArticle: ArticlesQuery.Data.Article) {
self.id = gqlArticle.id ?? UUID().uuidString
self.image = gqlArticle.image ?? ""
self.title = gqlArticle.title
self.url = gqlArticle.url
self.publishedAt = gqlArticle.publishedAt
self.sport = Sport(normalizedValue: gqlArticle.sportsType) ?? .All
}
}
10 changes: 10 additions & 0 deletions score-ios/Models/GraphQL/Article.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
query Articles($sportsType: String) {
articles(sportsType: $sportsType) {
id
title
image
sportsType
publishedAt
url
}
}
13 changes: 13 additions & 0 deletions score-ios/Models/GraphQL/YoutubeVideo.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
query YoutubeVideos {
youtubeVideos {
id
title
description
thumbnail
b64Thumbnail
url
publishedAt
duration
sportsType
}
}
4 changes: 3 additions & 1 deletion score-ios/Models/GraphQL/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Attributes:
- url: The URL to the video.
- published_at: The date and time the video was published.
- duration: The duration of the video (optional).
- sportsType: The sport type extracted from the video title.
"""
type YoutubeVideoType {
id: String
Expand All @@ -84,6 +85,7 @@ type YoutubeVideoType {
url: String!
publishedAt: String!
duration: String
sportsType: String
}

"""
Expand Down Expand Up @@ -201,4 +203,4 @@ type CreateYoutubeVideo {

type CreateArticle {
article: ArticleType
}
}
84 changes: 11 additions & 73 deletions score-ios/Models/Highlight.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,84 +29,22 @@ enum Highlight: Identifiable {
}
}

var title: String{
switch self{
var title: String {
switch self {
case .article(let article):
return article.title
case .video(let video):
return video.title
}
}

var sport: Sport {
switch self {
case .article(let article):
return article.sport
case .video(let video):
return video.sport
}
}
}

// MARK: - Dummy Data
extension Highlight {
static let dummyData: [Highlight] = [
.video(
YouTubeVideo(
id: "QGHb9heJAco",
title: "Cornell Celebrates Coach Mike Schafer '86",
description: "Cornell Celebrates Coach Mike Schafer '86 Narrated by Jeremy Schaap '91.",
thumbnail: "https://i.ytimg.com/vi/QGHb9heJAco/hqdefault.jpg",
b64Thumbnail: nil,
url: "https://youtube.com/watch?v=QGHb9heJAco",
publishedAt: "2025-10-014T00:00:00Z"
)
),
.article(
Article(
id: "1",
title: "Cornell Daily Sun Reports Historic Win",
summary: "Cornell's offense shines in a big win.",
image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2",
url: "https://cornellsun.com/article",
source: "Cornell Daily Sun",
publishedAt: "2025-10-14T00:00:00Z"
)
),
.video(
YouTubeVideo(
id: "ABC123def",
title: "Cornell Basketball Highlights - Championship Game",
description: "Watch the best moments from Cornell's championship victory.",
thumbnail: "https://i.ytimg.com/vi/ABC123def/hqdefault.jpg",
b64Thumbnail: nil,
url: "https://youtube.com/watch?v=ABC123def",
publishedAt: "2025-10-013T00:00:00Z"
)
),
.article(
Article(
id: "2",
title: "Cornell Upsets Rival in Thrilling Overtime Victory",
summary: "Cornell's offense exploded late in the fourth quarter to secure a dramatic win.",
image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2",
url: "https://cornellbigred.com/news/2025/10/08/article",
source: "Cornell Daily Sun",
publishedAt: "2025-10-14T00:00:00Z"
)
),
.video(
YouTubeVideo(
id: "XYZ789ghi",
title: "Cornell Hockey Rivalry Game Recap",
description: "Complete recap of the intense rivalry game between Cornell and their arch-rivals.",
thumbnail: "https://i.ytimg.com/vi/XYZ789ghi/hqdefault.jpg",
b64Thumbnail: nil,
url: "https://youtube.com/watch?v=XYZ789ghi",
publishedAt: "2025-10-14T00:00:00Z"
)
),
.article(
Article(
id: "3",
title: "Big Red Basketball Team Advances to Championship",
summary: "Cornell basketball team secures spot in the championship game with dominant performance.",
image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2",
url: "https://cornellsun.com/basketball-championship",
source: "Cornell Daily Sun",
publishedAt: "2025-10-13T00:00:00Z"
)
)
]
}
57 changes: 15 additions & 42 deletions score-ios/Models/YouTubeVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import GameAPI

struct YouTubeVideo: Identifiable {
var id: String
Expand All @@ -15,6 +16,8 @@ struct YouTubeVideo: Identifiable {
var b64Thumbnail: String?
var url: String
var publishedAt: String
var sport: Sport
var duration: String?

// Format publishedAt -> MM/dd or similar
var formattedDate: String {
Expand All @@ -25,46 +28,16 @@ struct YouTubeVideo: Identifiable {
}
return publishedAt
}
}

// MARK: - Dummy Data
extension YouTubeVideo {
static let dummyData: [YouTubeVideo] = [
YouTubeVideo(
id: "QGHb9heJAco",
title: "Cornell Celebrates Coach Mike Schafer '86",
description: "Cornell Celebrates Coach Mike Schafer '86 Narrated by Jeremy Schaap '91.",
thumbnail: "https://i.ytimg.com/vi/QGHb9heJAco/hqdefault.jpg",
b64Thumbnail: nil,
url: "https://youtube.com/watch?v=QGHb9heJAco",
publishedAt: "2025-10-09T00:00:00Z"
),
YouTubeVideo(
id: "ABC123def",
title: "Cornell Basketball Highlights - Championship Game",
description: "Watch the best moments from Cornell's championship victory.",
thumbnail: "https://i.ytimg.com/vi/ABC123def/hqdefault.jpg",
b64Thumbnail: nil,
url: "https://youtube.com/watch?v=ABC123def",
publishedAt: "2025-10-08T00:00:00Z"
),
YouTubeVideo(
id: "XYZ789ghi",
title: "Cornell Hockey Rivalry Game Recap",
description: "Complete recap of the intense rivalry game between Cornell and their arch-rivals.",
thumbnail: "https://i.ytimg.com/vi/XYZ789ghi/hqdefault.jpg",
b64Thumbnail: nil,
url: "https://youtube.com/watch?v=XYZ789ghi",
publishedAt: "2025-10-10T00:00:00Z"
),
YouTubeVideo(
id: "DEF456jkl",
title: "Cornell Football Season Highlights",
description: "Best plays and moments from Cornell's football season.",
thumbnail: "https://i.ytimg.com/vi/DEF456jkl/hqdefault.jpg",
b64Thumbnail: nil,
url: "https://youtube.com/watch?v=DEF456jkl",
publishedAt: "2025-10-11T00:00:00Z"
)
]

init(from gqlYouTubeVideo: YoutubeVideosQuery.Data.YoutubeVideo) {
self.id = gqlYouTubeVideo.id ?? UUID().uuidString
self.title = gqlYouTubeVideo.title
self.description = gqlYouTubeVideo.description
self.thumbnail = gqlYouTubeVideo.thumbnail
self.b64Thumbnail = gqlYouTubeVideo.b64Thumbnail
self.url = gqlYouTubeVideo.url
self.publishedAt = gqlYouTubeVideo.publishedAt
self.sport = Sport(normalizedValue: gqlYouTubeVideo.sportsType ?? "All") ?? .All
self.duration = gqlYouTubeVideo.duration
}
}
Loading