Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
Added settings/about page and favorite teams
Browse files Browse the repository at this point in the history
  • Loading branch information
inickt committed May 12, 2018
1 parent db057d9 commit 1dfc04f
Show file tree
Hide file tree
Showing 17 changed files with 1,013 additions and 73 deletions.
48 changes: 45 additions & 3 deletions LazyMan-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@
01D0F3C3205DBA8B008174EC /* FeedPlaylist.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D0F3C2205DBA8B008174EC /* FeedPlaylist.swift */; };
01DC7B952092530A003C311A /* GameListTableBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DC7B942092530A003C311A /* GameListTableBackgroundView.swift */; };
01DC7B9720925325003C311A /* GameListTableBackgroundView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01DC7B9620925325003C311A /* GameListTableBackgroundView.xib */; };
01DC7B9F2092BE6B003C311A /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DC7B9E2092BE6B003C311A /* SettingsViewController.swift */; };
01DC7BA020940B23003C311A /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 01DC7BA220940B23003C311A /* Settings.storyboard */; };
01DC7BA4209414AC003C311A /* SettingsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DC7BA3209414AC003C311A /* SettingsManager.swift */; };
01E593CA204B03F800CE338A /* GameManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E593C9204B03F800CE338A /* GameManager.swift */; };
01E593CE204B07E400CE338A /* Game.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E593CD204B07E400CE338A /* Game.swift */; };
01E9A71120A75DA600AB231B /* UpdateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E9A71020A75DA600AB231B /* UpdateManager.swift */; };
01E9A71320A772B100AB231B /* SettingsOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E9A71220A772B100AB231B /* SettingsOptionsViewController.swift */; };
01EDB67E208A8DD700E74B52 /* String+replace.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EDB67D208A8DD700E74B52 /* String+replace.swift */; };
2DBB500360049A35282D0F72 /* Pods_LazyMan_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6692BA5DC5F8089A7F24FDEC /* Pods_LazyMan_iOS.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -72,8 +77,13 @@
01D0F3CA2061CFB9008174EC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Game.storyboard; sourceTree = "<group>"; };
01DC7B942092530A003C311A /* GameListTableBackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameListTableBackgroundView.swift; sourceTree = "<group>"; };
01DC7B9620925325003C311A /* GameListTableBackgroundView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GameListTableBackgroundView.xib; sourceTree = "<group>"; };
01DC7B9E2092BE6B003C311A /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
01DC7BA120940B23003C311A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Settings.storyboard; sourceTree = "<group>"; };
01DC7BA3209414AC003C311A /* SettingsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsManager.swift; sourceTree = "<group>"; };
01E593C9204B03F800CE338A /* GameManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameManager.swift; sourceTree = "<group>"; };
01E593CD204B07E400CE338A /* Game.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = "<group>"; };
01E9A71020A75DA600AB231B /* UpdateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateManager.swift; sourceTree = "<group>"; };
01E9A71220A772B100AB231B /* SettingsOptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsOptionsViewController.swift; sourceTree = "<group>"; };
01EDB67D208A8DD700E74B52 /* String+replace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+replace.swift"; sourceTree = "<group>"; };
6692BA5DC5F8089A7F24FDEC /* Pods_LazyMan_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LazyMan_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
AB4E0BF11AC215B0A921B72A /* Pods-LazyMan-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LazyMan-iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-LazyMan-iOS/Pods-LazyMan-iOS.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -113,6 +123,7 @@
012CB8AD203A3E7C00E76740 /* LazyMan-iOS */ = {
isa = PBXGroup;
children = (
01DC7B9B2092BB99003C311A /* Settings */,
01DC7B99209293F1003C311A /* Managers */,
01DC7B98209293A8003C311A /* Models */,
019387BB2081396400D1CDBC /* Example Schedules */,
Expand Down Expand Up @@ -201,10 +212,22 @@
children = (
015F345D2050CFC40005453C /* TeamManager.swift */,
01E593C9204B03F800CE338A /* GameManager.swift */,
01DC7BA3209414AC003C311A /* SettingsManager.swift */,
01E9A71020A75DA600AB231B /* UpdateManager.swift */,
);
path = Managers;
sourceTree = "<group>";
};
01DC7B9B2092BB99003C311A /* Settings */ = {
isa = PBXGroup;
children = (
01DC7BA220940B23003C311A /* Settings.storyboard */,
01DC7B9E2092BE6B003C311A /* SettingsViewController.swift */,
01E9A71220A772B100AB231B /* SettingsOptionsViewController.swift */,
);
path = Settings;
sourceTree = "<group>";
};
1A68C0BF12E806DE05FE9B6A /* Pods */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -232,7 +255,7 @@
1A27598C587C0F45B8858311 /* [CP] Check Pods Manifest.lock */,
012CB8A7203A3E7C00E76740 /* Sources */,
012CB8A8203A3E7C00E76740 /* Frameworks */,
01DC7B9A2092A4EA003C311A /* ShellScript */,
01DC7B9A2092A4EA003C311A /* Build Number and Storyboard Labels */,
012CB8A9203A3E7C00E76740 /* Resources */,
426B6D90171E64CC4320375D /* [CP] Embed Pods Frameworks */,
217844BAFF81752828390607 /* [CP] Copy Pods Resources */,
Expand All @@ -259,6 +282,11 @@
012CB8AA203A3E7C00E76740 = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
};
};
};
};
};
Expand Down Expand Up @@ -294,24 +322,26 @@
010DB56720423DF300DFB4A0 /* Logos.xcassets in Resources */,
01344C862061D0EC0040BDE7 /* Game.storyboard in Resources */,
0179AEC22076DB5D00539C6D /* nhlschedule2018-04-05.json in Resources */,
01DC7BA020940B23003C311A /* Settings.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
01DC7B9A2092A4EA003C311A /* ShellScript */ = {
01DC7B9A2092A4EA003C311A /* Build Number and Storyboard Labels */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Build Number and Storyboard Labels";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# ON/OFF Script Toggle (script ON with #, script OFF without #)\n#exit 0\n\n# Increment Build Number Bool (Increment ON with true, increment OFF with false)\nshouldIncrement=true\n\n# App vesion / Build version constants\nversionNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleShortVersionString\" \"$INFOPLIST_FILE\")\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n\n# Increment build number\nif [ \"$shouldIncrement\" = true ]; then\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\nfi\n\n# Output version & build numbers into a label on LaunchScreen.storyboard\nsed -i bak -e \"/userLabel=\\\"APP_VERSION\\\"/s/text=\\\"[^\\\"]*\\\"/text=\\\"Version: $versionNumber – Build: $buildNumber\\\"/\" \"$PROJECT_DIR/$PROJECT_NAME/Resources/Base.lproj/LaunchScreen.storyboard\"";
shellScript = "# ON/OFF Script Toggle (script ON with #, script OFF without #)\n#exit 0\n\n# Increment Build Number Bool (Increment ON with true, increment OFF with false)\nshouldIncrement=true\n\n# App vesion / Build version constants\nversionNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleShortVersionString\" \"$INFOPLIST_FILE\")\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n\n# Increment build number\nif [ \"$shouldIncrement\" = true ]; then\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\nfi\n\n# Output version & build numbers into a label on LaunchScreen.storyboard\nsed -i bak -e \"/userLabel=\\\"APP_VERSION\\\"/s/text=\\\"[^\\\"]*\\\"/text=\\\"Version: $versionNumber – Build: $buildNumber\\\"/\" \"$PROJECT_DIR/$PROJECT_NAME/Resources/Base.lproj/LaunchScreen.storyboard\"\nsed -i bak -e \"/userLabel=\\\"APP_VERSION\\\"/s/text=\\\"[^\\\"]*\\\"/text=\\\"Version: $versionNumber – Build: $buildNumber\\\"/\" \"$PROJECT_DIR/$PROJECT_NAME/Settings/Base.lproj/Settings.storyboard\"";
};
1A27598C587C0F45B8858311 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -390,12 +420,16 @@
015F34622055F1550005453C /* GameSettingsOptionsViewController.swift in Sources */,
013959EA207ADF3B00E37E9C /* JSONLoader.swift in Sources */,
01EDB67E208A8DD700E74B52 /* String+replace.swift in Sources */,
01DC7B9F2092BE6B003C311A /* SettingsViewController.swift in Sources */,
01794C6C2072FFD5008FFFEE /* GameOptionSelector.swift in Sources */,
01344C8B2061D32E0040BDE7 /* GamePresenter.swift in Sources */,
01D0F3C3205DBA8B008174EC /* FeedPlaylist.swift in Sources */,
012CB8AF203A3E7C00E76740 /* AppDelegate.swift in Sources */,
01DC7BA4209414AC003C311A /* SettingsManager.swift in Sources */,
010E4584203A6964001EF46C /* GameListViewController.swift in Sources */,
01E9A71320A772B100AB231B /* SettingsOptionsViewController.swift in Sources */,
015F345E2050CFC40005453C /* TeamManager.swift in Sources */,
01E9A71120A75DA600AB231B /* UpdateManager.swift in Sources */,
01434A742040D3FF0094E221 /* GameTableViewCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -427,6 +461,14 @@
name = Game.storyboard;
sourceTree = "<group>";
};
01DC7BA220940B23003C311A /* Settings.storyboard */ = {
isa = PBXVariantGroup;
children = (
01DC7BA120940B23003C311A /* Base */,
);
name = Settings.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down
2 changes: 2 additions & 0 deletions LazyMan-iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
let selectedView = UIView()
selectedView.backgroundColor = UIColor.darkGray
UITableViewCell.appearance().selectedBackgroundView = selectedView
UITableViewCell.appearance().backgroundColor = .black


// Configures split view controller
if let svc = self.window?.rootViewController as? UISplitViewController
Expand Down
14 changes: 14 additions & 0 deletions LazyMan-iOS/GameList/Base.lproj/GameList.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
<action selector="leagueChanged:" destination="DiW-Fz-1X3" eventType="valueChanged" id="IZ0-JV-xBd"/>
</connections>
</segmentedControl>
<barButtonItem key="rightBarButtonItem" image="settings" id="yeq-Yf-Ujh">
<connections>
<segue destination="CPc-Vr-Mgc" kind="presentation" modalPresentationStyle="formSheet" id="LZN-ox-hnd"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" barStyle="black" translucent="NO" prompted="NO"/>
<nil key="simulatedBottomBarMetrics"/>
Expand All @@ -142,6 +147,14 @@
</objects>
<point key="canvasLocation" x="-150" y="-1349"/>
</scene>
<!--Settings-->
<scene sceneID="mmI-dC-oMT">
<objects>
<viewControllerPlaceholder storyboardName="Settings" id="CPc-Vr-Mgc" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="4kV-Rf-QTr" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="607" y="-1602"/>
</scene>
<!--Split View Controller-->
<scene sceneID="tJB-XD-td0">
<objects>
Expand Down Expand Up @@ -320,5 +333,6 @@
<resources>
<image name="blackhawks" width="500" height="500"/>
<image name="capitals" width="500" height="500"/>
<image name="settings" width="30" height="30"/>
</resources>
</document>
13 changes: 12 additions & 1 deletion LazyMan-iOS/GameList/GameListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,24 @@ class GameListViewController: UIViewController, GameListViewControllerType
override func loadView()
{
super.loadView()
self.league = SettingsManager.shared.defaultLeague
self.leagueControl.selectedSegmentIndex = SettingsManager.shared.defaultLeague == .NHL ? 0 : 1
self.splitViewController?.delegate = self
self.calendar.scope = .week
self.weekFormatter.dateFormat = "EEEE MMMM d, yyyy"
self.updateDate(date: self.date, wasSwiped: false, firstLoad: true)
NotificationCenter.default.addObserver(self, selector: #selector(updateToday), name: .UIApplicationWillEnterForeground, object: nil)
}

override func viewDidLoad()
{
super.viewDidLoad()
if SettingsManager.shared.versionUpdates
{
UpdateManager.checkUpdate(completion: self.showMessage)
}
}

override func viewWillAppear(_ animated: Bool)
{
super.viewWillAppear(animated)
Expand All @@ -114,7 +125,7 @@ class GameListViewController: UIViewController, GameListViewControllerType

// MARK: - Private

private func showError(message: String)
private func showMessage(message: String)
{
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .alert)
let okAction = UIAlertAction(title: "Ok", style: .cancel, handler: nil)
Expand Down
9 changes: 9 additions & 0 deletions LazyMan-iOS/GameList/GameTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ class GameTableViewCell: UITableViewCell
self.awayTeamLabel.text = self.game?.awayTeam.fullName
self.homeTeamLabel.text = self.game?.homeTeam.fullName
self.timeLabel.text = self.game?.getGameState()

if game?.hasFavoriteTeam() ?? false
{
self.backgroundColor = UIColor(red: 0.0, green: 0.07, blue: 0.14, alpha: 1.0)
}
else
{
self.backgroundColor = .black
}
}
}
}
2 changes: 2 additions & 0 deletions LazyMan-iOS/GameView/Base.lproj/Game.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="260"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="separatorColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<sections>
<tableViewSection id="wbg-6w-IdC">
<cells>
Expand Down Expand Up @@ -218,6 +219,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="260"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="separatorColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="checkmark" indentationWidth="10" reuseIdentifier="gameOptionCell" textLabel="b5W-Xs-NDN" detailTextLabel="B7I-Uo-lIu" style="IBUITableViewCellStyleValue1" id="Hf5-R2-Nbd">
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
Expand Down
6 changes: 3 additions & 3 deletions LazyMan-iOS/GameView/GamePresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class GamePresenter: NSObject, GamePresenterType

func viewDidLoad()
{
self.cdnSelector.select(index: 0)
self.cdnSelector.select(index: SettingsManager.shared.defaultCDN == .Akamai ? 0 : 1)
if self.feedSelector.count > 0 { self.feedSelector.select(index: 0) }
}

Expand Down Expand Up @@ -110,7 +110,7 @@ class GamePresenter: NSObject, GamePresenterType
self.qualitySelector = GameOptionSelector<FeedPlaylist>(objects: feedPlaylists)
self.qualitySelector?.onSelection = self.qualitySelected

if feedPlaylists.count > 0 { self.qualitySelector?.select(index: 0) }
if feedPlaylists.count > SettingsManager.shared.defaultQuality { self.qualitySelector?.select(index: SettingsManager.shared.defaultQuality) }

}) { (error) in
self.gameView?.showError(message: error)
Expand All @@ -129,7 +129,7 @@ class GamePresenter: NSObject, GamePresenterType
self.qualitySelector = GameOptionSelector<FeedPlaylist>(objects: feedPlaylists)
self.qualitySelector?.onSelection = self.qualitySelected

if feedPlaylists.count > 1 { self.qualitySelector?.select(index: 1) }
if feedPlaylists.count > SettingsManager.shared.defaultQuality { self.qualitySelector?.select(index: SettingsManager.shared.defaultQuality) }

}) { (error) in
self.gameView?.showError(message: error)
Expand Down
14 changes: 13 additions & 1 deletion LazyMan-iOS/GameView/GameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class GameViewController: UIViewController, GameViewControllerType, AVPlayerView
self.navigation.title = gameTitle
}
}
private var hidden = false

// MARK: - IBActions

Expand Down Expand Up @@ -65,6 +66,12 @@ class GameViewController: UIViewController, GameViewControllerType, AVPlayerView
self.presenter.viewWillAppear()
}

override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear(animated)
self.hidden = false
}

// MARK: - Navigation

override func prepare(for segue: UIStoryboardSegue, sender: Any?)
Expand All @@ -87,7 +94,11 @@ class GameViewController: UIViewController, GameViewControllerType, AVPlayerView
let playerItem = AVPlayerItem(asset: asset)
let player = AVPlayer(playerItem: playerItem)
self.playerVC?.player = player
player.play()
if !self.hidden
{
try? AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
player.play()
}
}

func showError(message: String)
Expand All @@ -109,5 +120,6 @@ class GameViewController: UIViewController, GameViewControllerType, AVPlayerView
@objc private func pause()
{
self.playerVC?.player?.pause()
self.hidden = true
}
}
Loading

0 comments on commit 1dfc04f

Please sign in to comment.