Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #137 from atfinke/2020.02
Browse files Browse the repository at this point in the history
2020.02
  • Loading branch information
atfinke authored Feb 22, 2020
2 parents 684f2e7 + b4b0013 commit 871ce07
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion WKRKit/WKRKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>9558</string>
<string>9593</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion WKRUIKit/WKRUIKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>10193</string>
<string>10228</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
3 changes: 2 additions & 1 deletion WikiRaces/Shared/Other/CommonExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ extension UIView {
}

static func animateFlash(withDuration duration: TimeInterval,
toAlpha alpha: CGFloat = 0,
items: [UIView],
whenHidden: (() -> Void)?,
completion: (() -> Void)?) {
UIView.animate(withDuration: duration / 2.0, animations: {
items.forEach { $0.alpha = 0.0 }
items.forEach { $0.alpha = alpha }
}, completion: { _ in
whenHidden?()
UIView.animate(withDuration: duration / 2.0, animations: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal class CenteredTableViewController: UIViewController {

let reuseIdentifier = "cell"
let tableView = WKRUICenteredTableView()
private let overlayButton = WKRUIButton()
let overlayButton = WKRUIButton()

var contentView: UIView!
private var overlayBottomConstraint: NSLayoutConstraint!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ internal class ResultsViewController: CenteredTableViewController {
var shareResultsBarButtonItem: UIBarButtonItem?

var isAnimatingToPointsStandings = false
var isPulsingReadyButton = false
var hasAnimatedToPointsStandings = false

let resultRenderer = ResultRenderer()
Expand Down Expand Up @@ -236,14 +237,43 @@ internal class ResultsViewController: CenteredTableViewController {
return
}

var isAnotherPlayerReady = false
var isLocalPlayerReady = false
for index in 0..<resultsInfo.playerCount {
let player = resultsInfo.raceRankingsPlayer(at: index)
guard let cell = tableView.cellForRow(at: IndexPath(row: index)) as? ResultsTableViewCell else {
tableView.reloadData()
return
}
cell.isShowingCheckmark = readyStates.isPlayerReady(player)
let isPlayerReady = readyStates.isPlayerReady(player)
cell.isShowingCheckmark = isPlayerReady

if player == localPlayer {
isLocalPlayerReady = isPlayerReady
} else if isPlayerReady {
isAnotherPlayerReady = true
}
}

if isAnotherPlayerReady && !isLocalPlayerReady && !isAnimatingToPointsStandings {
isAnimatingToPointsStandings = true
animateButtonLabel()
UINotificationFeedbackGenerator().notificationOccurred(.warning)
}
}

func animateButtonLabel() {
guard viewIfLoaded?.window != nil,
let label = overlayButton.titleLabel else {
return
}
UIView.animateFlash(withDuration: 2,
toAlpha: 0.25,
items: [label],
whenHidden: nil,
completion: {
self.animateButtonLabel()
})
}

private func updateTableView(_ oldResultsInfo: WKRResultsInfo? = nil) {
Expand Down
8 changes: 6 additions & 2 deletions WikiRaces/WikiRaces.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
143BB7181F60BDC000D00541 /* MenuViewController+GameKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 143BB7171F60BDC000D00541 /* MenuViewController+GameKit.swift */; };
143BB7191F60BDC000D00541 /* MenuViewController+GameKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 143BB7171F60BDC000D00541 /* MenuViewController+GameKit.swift */; };
143BB7351F60DF4A00D00541 /* MPCConnectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 143BB7341F60DF4A00D00541 /* MPCConnectViewController.swift */; };
143FC31C2401BB0900AB313A /* MPCHostAutoInviteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 141854DE2373666A008C988A /* MPCHostAutoInviteCell.swift */; };
14495D8821FF9A0500CAA129 /* ResultRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14495D8721FF9A0500CAA129 /* ResultRenderer.swift */; };
14495D8921FF9A0500CAA129 /* ResultRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14495D8721FF9A0500CAA129 /* ResultRenderer.swift */; };
14495D8A21FF9A0500CAA129 /* ResultRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14495D8721FF9A0500CAA129 /* ResultRenderer.swift */; };
Expand Down Expand Up @@ -1497,6 +1498,7 @@
14C260061F6F02A500CD7373 /* VotingTableViewCell.swift in Sources */,
14DF31BB21169372005BA432 /* MPCConnectViewController+Invite.swift in Sources */,
14B2DD4E22213A07009B8AB3 /* GlobalRacesHelper.swift in Sources */,
143FC31C2401BB0900AB313A /* MPCHostAutoInviteCell.swift in Sources */,
144A102D202FC7A2003DB51A /* CenteredTableViewController.swift in Sources */,
14BA538921FE3B1400A8CB01 /* ConnectViewController.swift in Sources */,
14C6B1F51FF2EABD00F6B422 /* MPCHostViewController.swift in Sources */,
Expand Down Expand Up @@ -1724,6 +1726,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = WikiRaces/WikiRaces.entitlements;
CURRENT_PROJECT_VERSION = 6344;
DEFINES_MODULE = YES;
DERIVE_UIKITFORMAC_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = 72S993BNAV;
Expand All @@ -1740,7 +1743,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2020.01;
MARKETING_VERSION = 2020.02;
OTHER_LDFLAGS = " -ObjC";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=300 -Xfrontend -warn-long-expression-type-checking=150";
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.wikiraces;
Expand All @@ -1758,6 +1761,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = WikiRaces/WikiRaces.entitlements;
CURRENT_PROJECT_VERSION = 6344;
DEFINES_MODULE = YES;
DERIVE_UIKITFORMAC_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = 72S993BNAV;
Expand All @@ -1774,7 +1778,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2020.01;
MARKETING_VERSION = 2020.02;
OTHER_LDFLAGS = " -ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.wikiraces;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion WikiRaces/WikiRaces/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>6330</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down

0 comments on commit 871ce07

Please sign in to comment.