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 @@ -447,7 +453,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 @@ -507,6 +513,7 @@
isa = PBXGroup;
children = (
D87787C72CFFAE5200EA79E1 /* GamesViewModel.swift */,
7665A4062EB00528004A9903 /* HighlightsViewModel.swift */,
D864B5AA2D793A7400A3A50E /* PastGameViewModel.swift */,
);
path = ViewModels;
Expand All @@ -524,6 +531,8 @@
children = (
D8DD4E632CFD48E400F2C46E /* Team.graphql */,
D891020A2CED6A86004CE226 /* Game.graphql */,
76AED8522EC50C2100694C0B /* Article.graphql */,
76AED8502EC50B7100694C0B /* YoutubeVideo.graphql */,
D89102062CED6A28004CE226 /* schema.graphqls */,
);
path = GraphQL;
Expand Down Expand Up @@ -631,7 +640,7 @@
packageReferences = (
D89102012CED68D9004CE226 /* XCRemoteSwiftPackageReference "apollo-ios" */,
D0A904F32E8DDD990008194B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
76101F682E9743EC006D6EDD /* XCLocalSwiftPackageReference "gameAPI" */,
761050E32EC50DCC00FD73F8 /* XCLocalSwiftPackageReference "gameAPI" */,
);
productRefGroup = CE725D392C89120200386943 /* Products */;
projectDirPath = "";
Expand All @@ -652,9 +661,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 @@ -765,16 +776,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 @@ -1115,7 +1127,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
Copy link
Contributor

@angelinaa-chen angelinaa-chen Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this will ever happen, but could we also put a fallback value for the title and url since the Article properties aren't optionals? An empty string would work as a default

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
}
}
12 changes: 12 additions & 0 deletions score-ios/Models/GraphQL/YoutubeVideo.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
query YoutubeVideos {
youtubeVideos {
id
title
description
thumbnail
b64Thumbnail
url
publishedAt
duration
}
}
12 changes: 11 additions & 1 deletion score-ios/Models/GraphQL/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Query {
gamesBySport(sport: String!): [GameType]
gamesByGender(gender: String!): [GameType]
gamesBySportGender(sport: String!, gender: String!): [GameType]
gamesByDate(startDate: DateTime!, endDate: DateTime!): [GameType]
teams: [TeamType]
team(id: String!): TeamType
teamByName(name: String!): TeamType
Expand Down Expand Up @@ -72,6 +73,7 @@ Attributes:
- thumbnail: The URL of the video's thumbnail.
- url: The URL to the video.
- published_at: The date and time the video was published.
- duration: The duration of the video (optional).
"""
type YoutubeVideoType {
id: String
Expand All @@ -81,6 +83,7 @@ type YoutubeVideoType {
b64Thumbnail: String!
url: String!
publishedAt: String!
duration: String
}

"""
Expand Down Expand Up @@ -163,6 +166,13 @@ type TeamType {
name: String!
}

"""
The `DateTime` scalar type represents a DateTime
value as specified by
[iso8601](https://en.wikipedia.org/wiki/ISO_8601).
"""
scalar DateTime

type Mutation {
"""Creates a new game."""
createGame(boxScore: String, city: String!, date: String!, gender: String!, location: String, opponentId: String!, result: String, scoreBreakdown: String, sport: String!, state: String!, ticketLink: String, time: String!, utcDate: String): CreateGame
Expand All @@ -171,7 +181,7 @@ type Mutation {
createTeam(b64Image: String, color: String!, image: String, name: String!): CreateTeam

"""Creates a new youtube video."""
createYoutubeVideo(b64Thumbnail: String!, description: String!, id: String!, publishedAt: String!, thumbnail: String!, title: String!, url: String!): CreateYoutubeVideo
createYoutubeVideo(b64Thumbnail: String!, description: String!, duration: String!, id: String!, publishedAt: String!, thumbnail: String!, title: String!, url: String!): CreateYoutubeVideo

"""Creates a new article."""
createArticle(image: String, publishedAt: String!, slug: String!, sportsType: String!, title: String!, url: String!): CreateArticle
Expand Down
80 changes: 9 additions & 71 deletions score-ios/Models/Highlight.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,76 +37,14 @@ enum Highlight: Identifiable {
return video.title
}
}

var sport: Sport{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a space between the "t" and "{"

switch self{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here space before the "{"

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"
)
)
]
}
Loading