From fc24cb81dfe931d39f34d6dcd9ef848897072efe Mon Sep 17 00:00:00 2001 From: Jay Zheng Date: Sun, 2 Mar 2025 11:07:22 -0500 Subject: [PATCH 1/8] added String extension file with a function to remove prefix for university of. Applied it to opponent names in game cards --- score-ios/Utils/StringExtension.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 score-ios/Utils/StringExtension.swift diff --git a/score-ios/Utils/StringExtension.swift b/score-ios/Utils/StringExtension.swift new file mode 100644 index 0000000..8e8bc06 --- /dev/null +++ b/score-ios/Utils/StringExtension.swift @@ -0,0 +1,16 @@ +// +// UtilFunctions.swift +// score-ios +// +// Created by Jidong Zheng on 3/1/25. +// + +import Foundation + +class UtilFunctions { + static func removeUniversityPrefix(from str: String) -> String { + return str.localizedCaseInsensitiveContains("University of ") ? str.replacingOccurrences(of: "University of ", with: "U", options: .caseInsensitive) : str + } +} + +extension From a7bbef076472b14a82abdb736f147186e2c807fc Mon Sep 17 00:00:00 2001 From: Jay Zheng Date: Sun, 2 Mar 2025 12:37:37 -0500 Subject: [PATCH 2/8] added comment to new string function --- .DS_Store | Bin 8196 -> 8196 bytes score-ios.xcodeproj/project.pbxproj | 8 ++++++-- score-ios/Utils/StringExtension.swift | 11 ++++++----- score-ios/ViewModels/GamesViewModel.swift | 3 ++- .../Views/DetailedViews/DynamicScoreBox.swift | 3 ++- .../DetailedViews/GameDetailedScoreView.swift | 4 ++-- score-ios/Views/DetailedViews/GameView.swift | 2 +- .../Views/DetailedViews/PastGameCard.swift | 2 +- .../Views/DetailedViews/UpcomingCard.swift | 2 +- score-ios/Views/ListViews/PastGameTile.swift | 2 +- .../Views/ListViews/UpcomingGameTile.swift | 3 +-- 11 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.DS_Store b/.DS_Store index 375e6c68e1981cfb11dd9dcc64e59ee5010ba2a3..6efb83dea6be5d4ff923a4f09a0cabc0f7d25dee 100644 GIT binary patch delta 85 zcmZp1XmQwZMwpo;m1XjIVKa_0X>AwBoyQ!3937z)m!zEhBnAcsgs{J`mPkQ{VQ_MO cZUIn&fq~@!h!mYHC?Yxefr#Md%_4!^0C3_Ml>h($ delta 85 zcmZp1XmQwZMwpp>Z`0)S!e$(^l(v{OcNcxFqG|CowQEAcXyewL}Us41<&N ba|?hHKq&_hDLPqDL~`;25y8!yMFP120gD=t diff --git a/score-ios.xcodeproj/project.pbxproj b/score-ios.xcodeproj/project.pbxproj index 1201118..2a156c6 100644 --- a/score-ios.xcodeproj/project.pbxproj +++ b/score-ios.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1CFA55BB2D74001200493D75 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CFA55BA2D74001200493D75 /* StringExtension.swift */; }; CE335CD32C922E8D0037F572 /* PrimaryColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD22C922E8D0037F572 /* PrimaryColors.swift */; }; CE335CD52C922ECB0037F572 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD42C922ECB0037F572 /* Constants.swift */; }; CE335CD72C922F390037F572 /* Dates.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD62C922F390037F572 /* Dates.swift */; }; @@ -96,6 +97,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1CFA55BA2D74001200493D75 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = ""; }; CE335CD22C922E8D0037F572 /* PrimaryColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryColors.swift; sourceTree = ""; }; CE335CD42C922ECB0037F572 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; CE335CD62C922F390037F572 /* Dates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dates.swift; sourceTree = ""; }; @@ -236,6 +238,7 @@ CE335CD62C922F390037F572 /* Dates.swift */, CE528FA32C9653C200C238B5 /* Error.swift */, CE3C9C422D011A23008BFB4C /* OrdinalSuffix.swift */, + 1CFA55BA2D74001200493D75 /* StringExtension.swift */, ); path = Utils; sourceTree = ""; @@ -651,6 +654,7 @@ CE8ED5142D6C42D400A274DE /* GameSectionHeaderView.swift in Sources */, D86347B12CDBFF7C003DD8F6 /* UpcomingGamesView.swift in Sources */, D86347DF2CE98B3C003DD8F6 /* MainTabView.swift in Sources */, + 1CFA55BB2D74001200493D75 /* StringExtension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -814,7 +818,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"score-ios/Preview Content\""; - DEVELOPMENT_TEAM = YLRVJFG2A8; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "score-ios/Info.plist"; @@ -844,7 +848,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"score-ios/Preview Content\""; - DEVELOPMENT_TEAM = YLRVJFG2A8; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "score-ios/Info.plist"; diff --git a/score-ios/Utils/StringExtension.swift b/score-ios/Utils/StringExtension.swift index 8e8bc06..86cc0c5 100644 --- a/score-ios/Utils/StringExtension.swift +++ b/score-ios/Utils/StringExtension.swift @@ -7,10 +7,11 @@ import Foundation -class UtilFunctions { - static func removeUniversityPrefix(from str: String) -> String { - return str.localizedCaseInsensitiveContains("University of ") ? str.replacingOccurrences(of: "University of ", with: "U", options: .caseInsensitive) : str +extension String { + /// remove "University of " and replay it with "U", eg. University of Miama -> UMiami + func removingUniversityPrefix() -> String { + return self.localizedCaseInsensitiveContains("University of ") + ? self.replacingOccurrences(of: "University of ", with: "U", options: .caseInsensitive) + : self } } - -extension diff --git a/score-ios/ViewModels/GamesViewModel.swift b/score-ios/ViewModels/GamesViewModel.swift index 10259d1..078565b 100644 --- a/score-ios/ViewModels/GamesViewModel.swift +++ b/score-ios/ViewModels/GamesViewModel.swift @@ -75,7 +75,7 @@ class GamesViewModel: ObservableObject let isUpcoming = game.date > now let isFinishedToday = game.date < now && game.date >= startOfToday let isFinishedByToday = game.date < startOfToday - + updatedGames.append(game) if isLive { self.allUpcomingGames.insert(game, at: 0) @@ -105,3 +105,4 @@ class GamesViewModel: ObservableObject } } + diff --git a/score-ios/Views/DetailedViews/DynamicScoreBox.swift b/score-ios/Views/DetailedViews/DynamicScoreBox.swift index a6b2751..49ec6e4 100644 --- a/score-ios/Views/DetailedViews/DynamicScoreBox.swift +++ b/score-ios/Views/DetailedViews/DynamicScoreBox.swift @@ -122,7 +122,8 @@ extension DynamicScoreBox { private func thirdRow(columnWidth: CGFloat) -> some View { HStack(spacing: 0) { - Text(game.opponent.name) + + Text(game.opponent.name.removingUniversityPrefix()) .lineLimit(1) .font(Constants.Fonts.gameText) .frame(width: 55, alignment: .leading) diff --git a/score-ios/Views/DetailedViews/GameDetailedScoreView.swift b/score-ios/Views/DetailedViews/GameDetailedScoreView.swift index ab8e032..731da25 100644 --- a/score-ios/Views/DetailedViews/GameDetailedScoreView.swift +++ b/score-ios/Views/DetailedViews/GameDetailedScoreView.swift @@ -104,7 +104,7 @@ extension GameDetailedScoreView { VStack(alignment: .leading, spacing: 4) { Text("Men's Football") .font(Constants.Fonts.medium14) - Text("Cornell vs. " + game.opponent.name) + Text("Cornell vs. " + game.opponent.name.removingUniversityPrefix()) .font(Constants.Fonts.semibold24) HStack() { @@ -244,7 +244,7 @@ extension GameDetailedScoreView { private var thirdRow: some View { HStack { - Text(game.opponent.name) + Text(game.opponent.name.removingUniversityPrefix()) .font(Constants.Fonts.gameText) .foregroundStyle(.gray) .frame(width: 60, alignment: .leading) diff --git a/score-ios/Views/DetailedViews/GameView.swift b/score-ios/Views/DetailedViews/GameView.swift index fc8710b..927a40e 100644 --- a/score-ios/Views/DetailedViews/GameView.swift +++ b/score-ios/Views/DetailedViews/GameView.swift @@ -155,7 +155,7 @@ extension GameView { VStack(alignment: .leading, spacing: 4) { Text("\(game.sex.description) \(game.sport.description)") .font(Constants.Fonts.subheader) - Text("Cornell vs. " + game.opponent.name) + Text("Cornell vs. " + game.opponent.name.removingUniversityPrefix()) .font(Constants.Fonts.header) HStack(spacing: 10) { diff --git a/score-ios/Views/DetailedViews/PastGameCard.swift b/score-ios/Views/DetailedViews/PastGameCard.swift index f0acbac..be95f6d 100644 --- a/score-ios/Views/DetailedViews/PastGameCard.swift +++ b/score-ios/Views/DetailedViews/PastGameCard.swift @@ -89,7 +89,7 @@ extension PastGameCard { Constants.Colors.gray_icons } .frame(width: 25, height: 27) - Text(game.opponent.name) + Text(game.opponent.name.removingUniversityPrefix()) .font(Constants.Fonts.gameTitle) .foregroundStyle(Color.black) Spacer() diff --git a/score-ios/Views/DetailedViews/UpcomingCard.swift b/score-ios/Views/DetailedViews/UpcomingCard.swift index 7c10e6e..18dd64b 100644 --- a/score-ios/Views/DetailedViews/UpcomingCard.swift +++ b/score-ios/Views/DetailedViews/UpcomingCard.swift @@ -76,7 +76,7 @@ extension UpcomingGameCard { } .frame(width: 24, height: 24) - Text(game.opponent.name) + Text(game.opponent.name.removingUniversityPrefix()) .font(Constants.Fonts.gameTitle) .foregroundStyle(Color.black) diff --git a/score-ios/Views/ListViews/PastGameTile.swift b/score-ios/Views/ListViews/PastGameTile.swift index 418d3b5..b594bdf 100644 --- a/score-ios/Views/ListViews/PastGameTile.swift +++ b/score-ios/Views/ListViews/PastGameTile.swift @@ -72,7 +72,7 @@ struct PastGameTile: View { } .frame(width: 20, height: 20) - Text(game.opponent.name) + Text(game.opponent.name.removingUniversityPrefix()) .font(Constants.Fonts.gameTitle) .lineLimit(1) diff --git a/score-ios/Views/ListViews/UpcomingGameTile.swift b/score-ios/Views/ListViews/UpcomingGameTile.swift index 6c87a9e..51dd488 100644 --- a/score-ios/Views/ListViews/UpcomingGameTile.swift +++ b/score-ios/Views/ListViews/UpcomingGameTile.swift @@ -24,8 +24,7 @@ struct UpcomingGameTile: View { Constants.Colors.gray_icons } .frame(width: 20, height: 20) - - Text(game.opponent.name) + Text(game.opponent.name.removingUniversityPrefix()) .font(Constants.Fonts.gameTitle) .lineLimit(1) } From 63521ff6c7a4b8e548035b0d80222e722f99ffef Mon Sep 17 00:00:00 2001 From: Jay Zheng Date: Sun, 2 Mar 2025 19:04:27 -0500 Subject: [PATCH 3/8] reverse shorten University name, instead made it scrollable --- score-ios/Utils/StringExtension.swift | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 score-ios/Utils/StringExtension.swift diff --git a/score-ios/Utils/StringExtension.swift b/score-ios/Utils/StringExtension.swift deleted file mode 100644 index 86cc0c5..0000000 --- a/score-ios/Utils/StringExtension.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// UtilFunctions.swift -// score-ios -// -// Created by Jidong Zheng on 3/1/25. -// - -import Foundation - -extension String { - /// remove "University of " and replay it with "U", eg. University of Miama -> UMiami - func removingUniversityPrefix() -> String { - return self.localizedCaseInsensitiveContains("University of ") - ? self.replacingOccurrences(of: "University of ", with: "U", options: .caseInsensitive) - : self - } -} From 275264ebbdd1488a4d7ceecb45e2d68a8b116909 Mon Sep 17 00:00:00 2001 From: Jay Zheng Date: Sun, 2 Mar 2025 19:10:57 -0500 Subject: [PATCH 4/8] added scroll view to more views --- score-ios.xcodeproj/project.pbxproj | 4 ---- score-ios/Networking/NetworkEnv.swift | 2 +- .../Views/DetailedViews/DynamicScoreBox.swift | 14 +++++++------- .../DetailedViews/GameDetailedScoreView.swift | 17 ++++++++++------- score-ios/Views/DetailedViews/GameView.swift | 7 ++++--- .../Views/DetailedViews/PastGameCard.swift | 2 +- .../Views/DetailedViews/UpcomingCard.swift | 2 +- score-ios/Views/ListViews/PastGameTile.swift | 9 +++++---- .../Views/ListViews/UpcomingGameTile.swift | 9 ++++++--- 9 files changed, 35 insertions(+), 31 deletions(-) diff --git a/score-ios.xcodeproj/project.pbxproj b/score-ios.xcodeproj/project.pbxproj index 2a156c6..9f2f75f 100644 --- a/score-ios.xcodeproj/project.pbxproj +++ b/score-ios.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 1CFA55BB2D74001200493D75 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CFA55BA2D74001200493D75 /* StringExtension.swift */; }; CE335CD32C922E8D0037F572 /* PrimaryColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD22C922E8D0037F572 /* PrimaryColors.swift */; }; CE335CD52C922ECB0037F572 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD42C922ECB0037F572 /* Constants.swift */; }; CE335CD72C922F390037F572 /* Dates.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD62C922F390037F572 /* Dates.swift */; }; @@ -97,7 +96,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1CFA55BA2D74001200493D75 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = ""; }; CE335CD22C922E8D0037F572 /* PrimaryColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryColors.swift; sourceTree = ""; }; CE335CD42C922ECB0037F572 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; CE335CD62C922F390037F572 /* Dates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dates.swift; sourceTree = ""; }; @@ -238,7 +236,6 @@ CE335CD62C922F390037F572 /* Dates.swift */, CE528FA32C9653C200C238B5 /* Error.swift */, CE3C9C422D011A23008BFB4C /* OrdinalSuffix.swift */, - 1CFA55BA2D74001200493D75 /* StringExtension.swift */, ); path = Utils; sourceTree = ""; @@ -654,7 +651,6 @@ CE8ED5142D6C42D400A274DE /* GameSectionHeaderView.swift in Sources */, D86347B12CDBFF7C003DD8F6 /* UpcomingGamesView.swift in Sources */, D86347DF2CE98B3C003DD8F6 /* MainTabView.swift in Sources */, - 1CFA55BB2D74001200493D75 /* StringExtension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/score-ios/Networking/NetworkEnv.swift b/score-ios/Networking/NetworkEnv.swift index 24b4ce0..3f500e8 100644 --- a/score-ios/Networking/NetworkEnv.swift +++ b/score-ios/Networking/NetworkEnv.swift @@ -5,7 +5,7 @@ // Created by Daniel Chuang on 2/12/25. // -let network_mode = NetworkEnv.local +let network_mode = NetworkEnv.deployment enum NetworkEnv { case local diff --git a/score-ios/Views/DetailedViews/DynamicScoreBox.swift b/score-ios/Views/DetailedViews/DynamicScoreBox.swift index 49ec6e4..1ce2ed1 100644 --- a/score-ios/Views/DetailedViews/DynamicScoreBox.swift +++ b/score-ios/Views/DetailedViews/DynamicScoreBox.swift @@ -122,13 +122,13 @@ extension DynamicScoreBox { private func thirdRow(columnWidth: CGFloat) -> some View { HStack(spacing: 0) { - - Text(game.opponent.name.removingUniversityPrefix()) - .lineLimit(1) - .font(Constants.Fonts.gameText) - .frame(width: 55, alignment: .leading) - .padding(.leading, 5) - + ScrollView(.horizontal, showsIndicators: false){ + Text(game.opponent.name) + .lineLimit(1) + .font(Constants.Fonts.gameText) + .frame(width: 55, alignment: .leading) + .padding(.leading, 5) + } ForEach(0.. Date: Sun, 2 Mar 2025 19:18:28 -0500 Subject: [PATCH 5/8] Delete Package.resolved --- .../xcshareddata/swiftpm/Package.resolved | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 092041f..0000000 --- a/score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pins" : [ - { - "identity" : "apollo-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apollographql/apollo-ios.git", - "state" : { - "revision" : "c3f48d45ec1300bc95243bf19f67284f9dc0d14a", - "version" : "1.15.3" - } - }, - { - "identity" : "sqlite.swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/stephencelis/SQLite.swift.git", - "state" : { - "revision" : "a95fc6df17d108bd99210db5e8a9bac90fe984b8", - "version" : "0.15.3" - } - } - ], - "version" : 2 -} From b6f379b4ec4e86932e96f17d04543a0150690f2e Mon Sep 17 00:00:00 2001 From: Jay Zheng Date: Wed, 12 Mar 2025 18:35:19 -0400 Subject: [PATCH 6/8] made new textUtil file for string manipulation specifically for university name being too long, made it scrollable, added shadow to trailing to indicate scrollable. Shorten university of to U --- .DS_Store | Bin 8196 -> 8196 bytes score-ios.xcodeproj/project.pbxproj | 4 +++ .../xcshareddata/swiftpm/Package.resolved | 24 +++++++++++++++ score-ios/Utils/TextUtils.swift | 29 ++++++++++++++++++ .../Views/DetailedViews/DynamicScoreBox.swift | 6 ++-- .../DetailedViews/GameDetailedScoreView.swift | 6 ++-- score-ios/Views/DetailedViews/GameView.swift | 3 +- .../Views/DetailedViews/PastGameCard.swift | 2 +- .../Views/DetailedViews/UpcomingCard.swift | 3 +- score-ios/Views/ListViews/PastGameTile.swift | 3 +- .../Views/ListViews/UpcomingGameTile.swift | 3 +- 11 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 score-ios/Utils/TextUtils.swift diff --git a/.DS_Store b/.DS_Store index 6efb83dea6be5d4ff923a4f09a0cabc0f7d25dee..413655dae963478f013b6718d0ab3ccbcaaea191 100644 GIT binary patch delta 85 zcmZp1XmQwZMwpqk?7-yn!e$)TUMSki9z5m<cxFqG|CowQEAcXyewL}Us41<&N da|?hH3=FIfK&0qoK@rKx4@3kvZx#vU1^^;j8-xG= delta 85 zcmZp1XmQwZMwpo;m1XjIVKa_0X>AwBoyQ!3937z)m!zEhBnAcsgs{J`mPkQ{VQ_MO cZUIn&fq~@!h!mYHC?Yxefr#Md%_4!^0C3_Ml>h($ diff --git a/score-ios.xcodeproj/project.pbxproj b/score-ios.xcodeproj/project.pbxproj index 9f2f75f..25248b3 100644 --- a/score-ios.xcodeproj/project.pbxproj +++ b/score-ios.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1C2876FF2D823A7A003AD8D3 /* TextUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C2876FE2D823A7A003AD8D3 /* TextUtils.swift */; }; CE335CD32C922E8D0037F572 /* PrimaryColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD22C922E8D0037F572 /* PrimaryColors.swift */; }; CE335CD52C922ECB0037F572 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD42C922ECB0037F572 /* Constants.swift */; }; CE335CD72C922F390037F572 /* Dates.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD62C922F390037F572 /* Dates.swift */; }; @@ -96,6 +97,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1C2876FE2D823A7A003AD8D3 /* TextUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextUtils.swift; sourceTree = ""; }; CE335CD22C922E8D0037F572 /* PrimaryColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryColors.swift; sourceTree = ""; }; CE335CD42C922ECB0037F572 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; CE335CD62C922F390037F572 /* Dates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dates.swift; sourceTree = ""; }; @@ -236,6 +238,7 @@ CE335CD62C922F390037F572 /* Dates.swift */, CE528FA32C9653C200C238B5 /* Error.swift */, CE3C9C422D011A23008BFB4C /* OrdinalSuffix.swift */, + 1C2876FE2D823A7A003AD8D3 /* TextUtils.swift */, ); path = Utils; sourceTree = ""; @@ -613,6 +616,7 @@ files = ( CE3C9C432D011A23008BFB4C /* OrdinalSuffix.swift in Sources */, CE8ED5022D6BF4E800A274DE /* TimeUpdate.swift in Sources */, + 1C2876FF2D823A7A003AD8D3 /* TextUtils.swift in Sources */, D89102132CF10CA9004CE226 /* NetworkManager.swift in Sources */, CE725D3E2C89120200386943 /* ScoreApp.swift in Sources */, D836AD922CB62C8800BD1545 /* NoGameView.swift in Sources */, diff --git a/score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..f3f8c4a --- /dev/null +++ b/score-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,24 @@ +{ + "originHash" : "6b067d3fafa8b6816a1507517f5f83e403209fe5e4f2246c62127d371c045b62", + "pins" : [ + { + "identity" : "apollo-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apollographql/apollo-ios.git", + "state" : { + "revision" : "c3f48d45ec1300bc95243bf19f67284f9dc0d14a", + "version" : "1.15.3" + } + }, + { + "identity" : "sqlite.swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stephencelis/SQLite.swift.git", + "state" : { + "revision" : "a95fc6df17d108bd99210db5e8a9bac90fe984b8", + "version" : "0.15.3" + } + } + ], + "version" : 3 +} diff --git a/score-ios/Utils/TextUtils.swift b/score-ios/Utils/TextUtils.swift new file mode 100644 index 0000000..24d1d38 --- /dev/null +++ b/score-ios/Utils/TextUtils.swift @@ -0,0 +1,29 @@ +// +// TextUtils.swift +// score-ios +// +// Created by Jay Zheng on 3/12/25. +// + +import SwiftUI + +struct TextUtil { + static func trailingFadeWhite(width: CGFloat = 30) -> some View { + LinearGradient( + gradient: Gradient(colors: [Color.clear, Color.white]), + startPoint: .leading, + endPoint: .trailing + ) + .frame(width: width) + .allowsHitTesting(false) + } +} + +extension String { + /// remove "University of " and replay it with "U", eg. University of Miama -> UMiami + func removingUniversityPrefix() -> String { + return self.localizedCaseInsensitiveContains("University of ") + ? self.replacingOccurrences(of: "University of ", with: "U ", options: .caseInsensitive) + : self + } +} diff --git a/score-ios/Views/DetailedViews/DynamicScoreBox.swift b/score-ios/Views/DetailedViews/DynamicScoreBox.swift index 1ce2ed1..e688615 100644 --- a/score-ios/Views/DetailedViews/DynamicScoreBox.swift +++ b/score-ios/Views/DetailedViews/DynamicScoreBox.swift @@ -123,12 +123,14 @@ extension DynamicScoreBox { private func thirdRow(columnWidth: CGFloat) -> some View { HStack(spacing: 0) { ScrollView(.horizontal, showsIndicators: false){ - Text(game.opponent.name) + Text(game.opponent.name.removingUniversityPrefix()) .lineLimit(1) .font(Constants.Fonts.gameText) - .frame(width: 55, alignment: .leading) + .frame(/*width: 55,*/ alignment: .leading) .padding(.leading, 5) + } + .overlay(TextUtil.trailingFadeWhite(width: 5), alignment: .trailing) ForEach(0.. Date: Mon, 17 Mar 2025 17:46:13 -0400 Subject: [PATCH 7/8] added comment to TextUtil.trailingFadeWhite --- score-ios/Utils/TextUtils.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/score-ios/Utils/TextUtils.swift b/score-ios/Utils/TextUtils.swift index 24d1d38..c609e0e 100644 --- a/score-ios/Utils/TextUtils.swift +++ b/score-ios/Utils/TextUtils.swift @@ -8,6 +8,7 @@ import SwiftUI struct TextUtil { + /// add trailing shadow to long names to indicate scrollable name static func trailingFadeWhite(width: CGFloat = 30) -> some View { LinearGradient( gradient: Gradient(colors: [Color.clear, Color.white]), From 2a26ad105a19c90e0035ddfd6b98bd2568730572 Mon Sep 17 00:00:00 2001 From: Jay Zheng Date: Thu, 20 Mar 2025 19:25:12 -0400 Subject: [PATCH 8/8] PR Comment Fixed - made new folder for ViewModifier and moved TrailingFadeGradient to withTrailingFadeGradient - renamed TextUtil file to String+Extention --- score-ios.xcodeproj/project.pbxproj | 20 +++++++-- score-ios/Utils/String+Extension.swift | 17 ++++++++ score-ios/Utils/TextUtils.swift | 30 -------------- .../ViewModifiers/TrailingFadeGradient.swift | 41 +++++++++++++++++++ score-ios/ViewModels/GamesViewModel.swift | 5 +-- .../Views/DetailedViews/DynamicScoreBox.swift | 6 +-- .../DetailedViews/GameDetailedScoreView.swift | 6 ++- score-ios/Views/DetailedViews/GameView.swift | 3 +- score-ios/Views/ListViews/PastGameTile.swift | 3 +- .../Views/ListViews/UpcomingGameTile.swift | 2 +- 10 files changed, 88 insertions(+), 45 deletions(-) create mode 100644 score-ios/Utils/String+Extension.swift delete mode 100644 score-ios/Utils/TextUtils.swift create mode 100644 score-ios/Utils/ViewModifiers/TrailingFadeGradient.swift diff --git a/score-ios.xcodeproj/project.pbxproj b/score-ios.xcodeproj/project.pbxproj index 25248b3..4b793fe 100644 --- a/score-ios.xcodeproj/project.pbxproj +++ b/score-ios.xcodeproj/project.pbxproj @@ -7,7 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 1C2876FF2D823A7A003AD8D3 /* TextUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C2876FE2D823A7A003AD8D3 /* TextUtils.swift */; }; + 1C87865D2D8CD76900EBDF74 /* TrailingFadeGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C87865C2D8CD76900EBDF74 /* TrailingFadeGradient.swift */; }; + 1C87865F2D8CDADC00EBDF74 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C87865E2D8CDADC00EBDF74 /* String+Extension.swift */; }; CE335CD32C922E8D0037F572 /* PrimaryColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD22C922E8D0037F572 /* PrimaryColors.swift */; }; CE335CD52C922ECB0037F572 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD42C922ECB0037F572 /* Constants.swift */; }; CE335CD72C922F390037F572 /* Dates.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD62C922F390037F572 /* Dates.swift */; }; @@ -97,7 +98,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1C2876FE2D823A7A003AD8D3 /* TextUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextUtils.swift; sourceTree = ""; }; + 1C87865C2D8CD76900EBDF74 /* TrailingFadeGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrailingFadeGradient.swift; sourceTree = ""; }; + 1C87865E2D8CDADC00EBDF74 /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; CE335CD22C922E8D0037F572 /* PrimaryColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryColors.swift; sourceTree = ""; }; CE335CD42C922ECB0037F572 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; CE335CD62C922F390037F572 /* Dates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dates.swift; sourceTree = ""; }; @@ -198,6 +200,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1C87865B2D8CD73C00EBDF74 /* ViewModifiers */ = { + isa = PBXGroup; + children = ( + 1C87865C2D8CD76900EBDF74 /* TrailingFadeGradient.swift */, + ); + path = ViewModifiers; + sourceTree = ""; + }; CE335CCA2C9226EB0037F572 /* Configs */ = { isa = PBXGroup; children = ( @@ -233,12 +243,13 @@ CE335CCE2C9227050037F572 /* Utils */ = { isa = PBXGroup; children = ( + 1C87865B2D8CD73C00EBDF74 /* ViewModifiers */, CE335CD22C922E8D0037F572 /* PrimaryColors.swift */, CE335CD42C922ECB0037F572 /* Constants.swift */, CE335CD62C922F390037F572 /* Dates.swift */, CE528FA32C9653C200C238B5 /* Error.swift */, CE3C9C422D011A23008BFB4C /* OrdinalSuffix.swift */, - 1C2876FE2D823A7A003AD8D3 /* TextUtils.swift */, + 1C87865E2D8CDADC00EBDF74 /* String+Extension.swift */, ); path = Utils; sourceTree = ""; @@ -616,7 +627,6 @@ files = ( CE3C9C432D011A23008BFB4C /* OrdinalSuffix.swift in Sources */, CE8ED5022D6BF4E800A274DE /* TimeUpdate.swift in Sources */, - 1C2876FF2D823A7A003AD8D3 /* TextUtils.swift in Sources */, D89102132CF10CA9004CE226 /* NetworkManager.swift in Sources */, CE725D3E2C89120200386943 /* ScoreApp.swift in Sources */, D836AD922CB62C8800BD1545 /* NoGameView.swift in Sources */, @@ -633,6 +643,7 @@ D86347AF2CDBD2F4003DD8F6 /* PastGameCard.swift in Sources */, CE8ED5122D6C3FCB00A274DE /* CarouselView.swift in Sources */, CE528FF72C979DA000C238B5 /* GameView.swift in Sources */, + 1C87865D2D8CD76900EBDF74 /* TrailingFadeGradient.swift in Sources */, CE8ED4F82D6BF42B00A274DE /* Sport.swift in Sources */, D87882282CC060FC00421F67 /* GameDetailedScoreView.swift in Sources */, D83EE8862CC9917C008B693C /* ScoreSummaryTile.swift in Sources */, @@ -655,6 +666,7 @@ CE8ED5142D6C42D400A274DE /* GameSectionHeaderView.swift in Sources */, D86347B12CDBFF7C003DD8F6 /* UpcomingGamesView.swift in Sources */, D86347DF2CE98B3C003DD8F6 /* MainTabView.swift in Sources */, + 1C87865F2D8CDADC00EBDF74 /* String+Extension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/score-ios/Utils/String+Extension.swift b/score-ios/Utils/String+Extension.swift new file mode 100644 index 0000000..a36d26b --- /dev/null +++ b/score-ios/Utils/String+Extension.swift @@ -0,0 +1,17 @@ +// +// String+Extension.swift +// score-ios +// +// Created by Jay Zheng on 3/20/25. +// + +import SwiftUI + +extension String { + /// remove "University of " and replay it with "U", eg. University of Miama -> UMiami + func removingUniversityPrefix() -> String { + return self.localizedCaseInsensitiveContains("University of ") + ? self.replacingOccurrences(of: "University of ", with: "U ", options: .caseInsensitive) + : self + } +} diff --git a/score-ios/Utils/TextUtils.swift b/score-ios/Utils/TextUtils.swift deleted file mode 100644 index c609e0e..0000000 --- a/score-ios/Utils/TextUtils.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// TextUtils.swift -// score-ios -// -// Created by Jay Zheng on 3/12/25. -// - -import SwiftUI - -struct TextUtil { - /// add trailing shadow to long names to indicate scrollable name - static func trailingFadeWhite(width: CGFloat = 30) -> some View { - LinearGradient( - gradient: Gradient(colors: [Color.clear, Color.white]), - startPoint: .leading, - endPoint: .trailing - ) - .frame(width: width) - .allowsHitTesting(false) - } -} - -extension String { - /// remove "University of " and replay it with "U", eg. University of Miama -> UMiami - func removingUniversityPrefix() -> String { - return self.localizedCaseInsensitiveContains("University of ") - ? self.replacingOccurrences(of: "University of ", with: "U ", options: .caseInsensitive) - : self - } -} diff --git a/score-ios/Utils/ViewModifiers/TrailingFadeGradient.swift b/score-ios/Utils/ViewModifiers/TrailingFadeGradient.swift new file mode 100644 index 0000000..8d12bc5 --- /dev/null +++ b/score-ios/Utils/ViewModifiers/TrailingFadeGradient.swift @@ -0,0 +1,41 @@ +// +// TrailingFadeGradient.swift +// score-ios +// +// Created by Jay Zheng on 3/20/25. +// + +import SwiftUI + +/// A view modifier that adds a trailing fade gradient to indicate scrollable content +struct TrailingFadeGradient: ViewModifier { + var width: CGFloat + var backgroundColor: Color + + init(width: CGFloat = 30, backgroundColor: Color = .white) { + self.width = width + self.backgroundColor = backgroundColor + } + + func body(content: Content) -> some View { + content + .overlay( + LinearGradient( + gradient: Gradient(colors: [.clear, backgroundColor]), + startPoint: .leading, + endPoint: .trailing + ) + .frame(width: width) + .allowsHitTesting(false), + alignment: .trailing + ) + } +} +// Add this as a view extension +extension View { + /// Adds a trailing fade gradient to indicate scrollable content + func withTrailingFadeGradient(width: CGFloat = 30, backgroundColor: Color = .white) -> some View { + self.modifier(TrailingFadeGradient(width: width, backgroundColor: backgroundColor)) + } +} + diff --git a/score-ios/ViewModels/GamesViewModel.swift b/score-ios/ViewModels/GamesViewModel.swift index 078565b..eb25bd8 100644 --- a/score-ios/ViewModels/GamesViewModel.swift +++ b/score-ios/ViewModels/GamesViewModel.swift @@ -8,7 +8,7 @@ import Foundation import SwiftUI -class GamesViewModel: ObservableObject +class GamesViewModel: ObservableObject { @Published var errorMessage: String? @Published var games: [Game] = [] // List of all games @@ -75,7 +75,7 @@ class GamesViewModel: ObservableObject let isUpcoming = game.date > now let isFinishedToday = game.date < now && game.date >= startOfToday let isFinishedByToday = game.date < startOfToday - + updatedGames.append(game) if isLive { self.allUpcomingGames.insert(game, at: 0) @@ -105,4 +105,3 @@ class GamesViewModel: ObservableObject } } - diff --git a/score-ios/Views/DetailedViews/DynamicScoreBox.swift b/score-ios/Views/DetailedViews/DynamicScoreBox.swift index e688615..67a2492 100644 --- a/score-ios/Views/DetailedViews/DynamicScoreBox.swift +++ b/score-ios/Views/DetailedViews/DynamicScoreBox.swift @@ -126,11 +126,11 @@ extension DynamicScoreBox { Text(game.opponent.name.removingUniversityPrefix()) .lineLimit(1) .font(Constants.Fonts.gameText) - .frame(/*width: 55,*/ alignment: .leading) + .frame(alignment: .leading) .padding(.leading, 5) - } - .overlay(TextUtil.trailingFadeWhite(width: 5), alignment: .trailing) + .withTrailingFadeGradient() + ForEach(0..