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 #135 from atfinke/2020.01
Browse files Browse the repository at this point in the history
2020.01
  • Loading branch information
atfinke authored Jan 7, 2020
2 parents c4a6f85 + 490b466 commit 684f2e7
Show file tree
Hide file tree
Showing 29 changed files with 100 additions and 29 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion WKRCloudStats/WKRCloudStats.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0900;
LastUpgradeCheck = 1100;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "Andrew Finke";
TargetAttributes = {
145623D31F8DE63C00B1ECAC = {
Expand Down Expand Up @@ -304,6 +304,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 72S993BNAV;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = WKRCloudStats/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.WKRCloudStats;
Expand All @@ -321,6 +322,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 72S993BNAV;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = WKRCloudStats/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.WKRCloudStats;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions WKRKit/WKRKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 3.6.6;
MARKETING_VERSION = 2020.01;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.WKRKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down Expand Up @@ -697,7 +697,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 3.6.6;
MARKETING_VERSION = 2020.01;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.WKRKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
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>9536</string>
<string>9558</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
4 changes: 2 additions & 2 deletions WKRUIKit/WKRUIKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 3.6.6;
MARKETING_VERSION = 2020.01;
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.WKRUIKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -605,7 +605,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 3.6.6;
MARKETING_VERSION = 2020.01;
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.WKRUIKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
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>10171</string>
<string>10193</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ extension GameKitConnectViewController: GKMatchDelegate, GKMatchmakerViewControl
request.maxPlayers = maxPlayerCount
if let invite = GlobalRaceHelper.shared.lastInvite,
let controller = GKMatchmakerViewController(invite: invite) {

PlayerAnonymousMetrics.log(event: .userAction("issue#119: invite"))

controller.matchmakerDelegate = self
present(controller, animated: true, completion: nil)
self.controller = controller
GlobalRaceHelper.shared.lastInvite = nil
} else if let controller = GKMatchmakerViewController(matchRequest: request) {
PlayerAnonymousMetrics.log(event: .userAction("issue#119: matchRequest"))

controller.matchmakerDelegate = self
present(controller, animated: true, completion: nil)
self.controller = controller
#if !MULTIWINDOWDEBUG && !targetEnvironment(macCatalyst)
findTrace = Performance.startTrace(name: "Global Race Find Trace")
#endif
Expand All @@ -39,6 +46,8 @@ extension GameKitConnectViewController: GKMatchDelegate, GKMatchmakerViewControl
}

func sendStartMessageToPlayers() {
PlayerAnonymousMetrics.log(event: .userAction("issue#119: sendStartMessageToPlayers"))

func fail() {
showError(title: "Unable To Start Match",
message: "Please try again later.")
Expand Down Expand Up @@ -69,6 +78,8 @@ extension GameKitConnectViewController: GKMatchDelegate, GKMatchmakerViewControl
// MARK: - GKMatchDelegate -

func match(_ match: GKMatch, didReceive data: Data, fromRemotePlayer player: GKPlayer) {
PlayerAnonymousMetrics.log(event: .userAction("issue#119: didReceive"))

if isPlayerHost, WKRSeenFinalArticlesStore.isRemoteTransferData(data) {
WKRSeenFinalArticlesStore.addRemoteTransferData(data)
} else if let object = try? JSONDecoder().decode(StartMessage.self, from: data) {
Expand All @@ -90,12 +101,16 @@ extension GameKitConnectViewController: GKMatchDelegate, GKMatchmakerViewControl
// MARK: - GKMatchmakerViewControllerDelegate -

func matchmakerViewControllerWasCancelled(_ viewController: GKMatchmakerViewController) {
PlayerAnonymousMetrics.log(event: .userAction("issue#119: wasCancelled"))

dismiss(animated: true) {
self.pressedCancelButton()
}
}

func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFailWithError error: Error) {
PlayerAnonymousMetrics.log(event: .userAction("issue#119: didFailWithError"))

let info = "matchmaker...didFailWithError: " + error.localizedDescription
PlayerAnonymousMetrics.log(event: .error(info))

Expand All @@ -106,6 +121,8 @@ extension GameKitConnectViewController: GKMatchDelegate, GKMatchmakerViewControl
}

func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFind match: GKMatch) {
PlayerAnonymousMetrics.log(event: .userAction("issue#119: didFind"))

#if !MULTIWINDOWDEBUG && !targetEnvironment(macCatalyst)
findTrace?.stop()
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class GameKitConnectViewController: ConnectViewController {
var isPlayerHost = false
var hostPlayerAlias: String?
var match: GKMatch?
weak var controller: GKMatchmakerViewController?

#if !MULTIWINDOWDEBUG && !targetEnvironment(macCatalyst)
var findTrace: Trace?
Expand All @@ -34,8 +35,8 @@ class GameKitConnectViewController: ConnectViewController {
setupCoreInterface()

onQuit = { [weak self] in
self?.match?.delegate = nil
self?.match?.disconnect()
guard let self = self else { return }
self.teardown()
}

#if !MULTIWINDOWDEBUG && !targetEnvironment(macCatalyst)
Expand All @@ -48,6 +49,8 @@ class GameKitConnectViewController: ConnectViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

PlayerAnonymousMetrics.log(event: .userAction("issue#119: viewDidAppear"))

guard isFirstAppear else {
return
}
Expand All @@ -66,4 +69,16 @@ class GameKitConnectViewController: ConnectViewController {
toggleCoreInterface(isHidden: false, duration: 0.5)
}

override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
PlayerAnonymousMetrics.log(event: .userAction("issue#119: viewDidDisappear"))
}

private func teardown() {
PlayerAnonymousMetrics.log(event: .userAction("issue#119: teardown game connect"))
controller?.matchmakerDelegate = nil
match?.delegate = nil
match?.disconnect()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ extension MPCConnectViewController: MCNearbyServiceAdvertiserDelegate, MCSession
let info = "session...didReceive: \(String(describing: hostPeerID?.displayName)), \(object.hostName)"
PlayerAnonymousMetrics.log(event: .error(info))

showError(title: "Connection Issue",
message: "The connection to the host was lost.")
DispatchQueue.main.async {
self.showError(title: "Connection Issue",
message: "The connection to the host was lost.")
}
return
}
start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ extension MenuView {
return
}

guard !promptGlobalRacesPopularity() else {
return
}

animateMenuOut {
self.listenerUpdate?(.presentGlobalConnect)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,26 @@ class MenuView: UIView {
return true
}

func promptGlobalRacesPopularity() -> Bool {
guard !UserDefaults.standard.bool(forKey: "PromptedGlobalRacesPopularity") else {
return false
}
UserDefaults.standard.set(true, forKey: "PromptedGlobalRacesPopularity")

//swiftlint:disable:next line_length
let message = "Most global races are started with invited friends. Invite a friend for the best chance at joining a race."
let alertController = UIAlertController(title: "Global Races", message: message, preferredStyle: .alert)

let action = UIAlertAction(title: "Ok", style: .default, handler: { _ in
PlayerAnonymousMetrics.log(event: .userAction("promptGlobalRacesPopularity:ok"))
self.animateMenuOut {
self.listenerUpdate?(.presentGlobalConnect)
}
})
alertController.addAction(action)

listenerUpdate?(.presentAlert(alertController))
return true
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ internal class MenuViewController: UIViewController {

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
PlayerAnonymousMetrics.log(event: .userAction("issue#119: menu viewDidAppear"))

UIApplication.shared.isIdleTimerDisabled = false

// adjusts views before animation if rotation occured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ internal class GameViewController: UIViewController {
}

deinit {
gameManager.alertView.removeFromSuperview()
let alertView = gameManager.alertView
DispatchQueue.main.async {
alertView.removeFromSuperview()
}
}

// MARK: - User Actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ internal class ResultsViewController: CenteredTableViewController {

var newIndexes = (0..<oldInfo.playerCount).map { $0 }
for (index, player) in previousPlayerOrder.enumerated() {
guard let newIndex = newPlayerOrder.firstIndex(of: player) else { fatalError() }
guard let newIndex = newPlayerOrder.firstIndex(of: player) else {
// unexpected state
tableView.reloadData()
return
}
newIndexes[index] = newIndex
}

Expand Down
2 changes: 1 addition & 1 deletion WikiRaces/WikiRaces (UI Catalog)/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ internal class ViewController: UIViewController {
random()
}

if self.players.filter ({$0.state == .racing }).isEmpty && !self.rendered {
if self.players.filter({$0.state == .racing }).isEmpty && !self.rendered {
self.rendered = true
for player in self.players {
ResultRenderer().render(with: controller.resultsInfo!,
Expand Down
4 changes: 2 additions & 2 deletions WikiRaces/WikiRaces.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.6.6;
MARKETING_VERSION = 2020.01;
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 Down Expand Up @@ -1774,7 +1774,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.6.6;
MARKETING_VERSION = 2020.01;
OTHER_LDFLAGS = " -ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.andrewfinke.wikiraces;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Loading

0 comments on commit 684f2e7

Please sign in to comment.