diff --git a/.gitignore b/.gitignore index 75018f4..5119f71 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,7 @@ WikiRaces/culprits.txt WikiRaces/fastlane/report.xml WikiRaces/fastlane/README.md + +WikiRaces/fastlane/Preview.html + +WikiRaces/fastlane/Appfile diff --git a/.travis.yml b/.travis.yml index 73f49ea..95e9e0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode10.2 +osx_image: xcode11 matrix: include: @@ -15,4 +15,4 @@ install: - ./install_swiftlint.sh script: - - "xcodebuild clean $TYPE -workspace WikiRaces.xcworkspace -scheme $SCHEME -destination 'platform=iOS Simulator,name=iPad Pro (12.9-inch),OS=12.2'" + - "xcodebuild clean $TYPE -workspace WikiRaces.xcworkspace -scheme $SCHEME -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=13.0'" diff --git a/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.pbxproj b/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.pbxproj index 9c3bd40..dbf1292 100644 --- a/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.pbxproj +++ b/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.pbxproj @@ -90,7 +90,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1020; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1100; ORGANIZATIONNAME = "Andrew Finke"; TargetAttributes = { 1434C24D22238E5C0099C53A = { @@ -277,6 +277,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = WKRArticlesPreviewer/WKRArticlesPreviewer.entitlements; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 72S993BNAV; @@ -296,6 +297,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = WKRArticlesPreviewer/WKRArticlesPreviewer.entitlements; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 72S993BNAV; diff --git a/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/WKRArticlesPreviewer/WKRArticlesPreviewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/WKRArticlesPreviewer/WKRArticlesPreviewer/ViewController.swift b/WKRArticlesPreviewer/WKRArticlesPreviewer/ViewController.swift index e095358..1e3e7e2 100644 --- a/WKRArticlesPreviewer/WKRArticlesPreviewer/ViewController.swift +++ b/WKRArticlesPreviewer/WKRArticlesPreviewer/ViewController.swift @@ -28,6 +28,20 @@ class ViewController: NSViewController { super.viewDidLoad() webView.load(URLRequest(url: URL(string: "https://en.m.wikipedia.org")!)) NSWorkspace.shared.openFile(NSTemporaryDirectory()) + + NSEvent.addLocalMonitorForEvents(matching: .keyUp) { + print($0.keyCode) + if $0.keyCode == 124 { + self.keepArticle(0) + } else if $0.keyCode == 126 { + self.removeArticle(0) + } else if $0.keyCode == 123 { + self.undoLastAction(0) + } else { + return nil + } + return $0 + } } func moveToNextArticle(keepCurrent: Bool) { diff --git a/WKRCloudStats/WKRCloudStats.xcodeproj/project.pbxproj b/WKRCloudStats/WKRCloudStats.xcodeproj/project.pbxproj index 7a43a7f..aae39c2 100644 --- a/WKRCloudStats/WKRCloudStats.xcodeproj/project.pbxproj +++ b/WKRCloudStats/WKRCloudStats.xcodeproj/project.pbxproj @@ -108,7 +108,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0900; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1100; ORGANIZATIONNAME = "Andrew Finke"; TargetAttributes = { 145623D31F8DE63C00B1ECAC = { @@ -300,6 +300,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = WKRCloudStats/WKRCloudStats.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 72S993BNAV; @@ -316,6 +317,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = WKRCloudStats/WKRCloudStats.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 72S993BNAV; diff --git a/WKRCloudStats/WKRCloudStats.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/WKRCloudStats/WKRCloudStats.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/WKRCloudStats/WKRCloudStats.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/WKRCloudStats/WKRCloudStats.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/WKRCloudStats/WKRCloudStats.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/WKRCloudStats/WKRCloudStats.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/WKRCloudStats/WKRCloudStats.xcodeproj/xcshareddata/xcschemes/WKRCloudStats.xcscheme b/WKRCloudStats/WKRCloudStats.xcodeproj/xcshareddata/xcschemes/WKRCloudStats.xcscheme index 9b1badd..b3b68ea 100644 --- a/WKRCloudStats/WKRCloudStats.xcodeproj/xcshareddata/xcschemes/WKRCloudStats.xcscheme +++ b/WKRCloudStats/WKRCloudStats.xcodeproj/xcshareddata/xcschemes/WKRCloudStats.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - - + - + @@ -620,7 +620,7 @@ - + @@ -685,7 +685,7 @@ - + @@ -712,26 +712,26 @@ - + - + + - - - + diff --git a/WikiRaces/WikiRaces/GoogleService-Info.plist b/WikiRaces/WikiRaces/GoogleService-Info.plist index 66081b2..7e3a6fc 100644 --- a/WikiRaces/WikiRaces/GoogleService-Info.plist +++ b/WikiRaces/WikiRaces/GoogleService-Info.plist @@ -2,10 +2,6 @@ - AD_UNIT_ID_FOR_BANNER_TEST - ca-app-pub-3940256099942544/2934735716 - AD_UNIT_ID_FOR_INTERSTITIAL_TEST - ca-app-pub-3940256099942544/4411468910 CLIENT_ID 955248951790-0aafc0j71bqk4k6475d35oc32m41rt12.apps.googleusercontent.com REVERSED_CLIENT_ID @@ -27,11 +23,11 @@ IS_ANALYTICS_ENABLED IS_APPINVITE_ENABLED - + IS_GCM_ENABLED - + IS_SIGNIN_ENABLED - + GOOGLE_APP_ID 1:955248951790:ios:b82db689d6855c14 DATABASE_URL diff --git a/WikiRaces/WikiRaces/Info.plist b/WikiRaces/WikiRaces/Info.plist index 3fcc5e9..63ccc19 100644 --- a/WikiRaces/WikiRaces/Info.plist +++ b/WikiRaces/WikiRaces/Info.plist @@ -15,11 +15,27 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.6.5 + $(MARKETING_VERSION) CFBundleVersion - 5652 + 6308 + Fabric + + APIKey + 80c3b2d37f1bca4e182e7fbf7976e6f069340b4d + Kits + + + KitInfo + + KitName + Crashlytics + + + ITSAppUsesNonExemptEncryption + LSApplicationCategoryType + public.app-category.trivia-games LSRequiresIPhoneOS NSPhotoLibraryAddUsageDescription diff --git a/WikiRaces/WikiRaces/WikiRaces.entitlements b/WikiRaces/WikiRaces/WikiRaces.entitlements index c97793b..d7c2876 100644 --- a/WikiRaces/WikiRaces/WikiRaces.entitlements +++ b/WikiRaces/WikiRaces/WikiRaces.entitlements @@ -6,7 +6,7 @@ development com.apple.developer.icloud-container-identifiers - iCloud.$(CFBundleIdentifier) + iCloud.com.andrewfinke.wikiraces com.apple.developer.icloud-services @@ -14,5 +14,13 @@ com.apple.developer.ubiquity-kvstore-identifier $(TeamIdentifierPrefix)$(CFBundleIdentifier) + com.apple.security.app-sandbox + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.personal-information.photos-library + diff --git a/WikiRaces/WikiRacesScreenshots/SnapshotHelper.swift b/WikiRaces/WikiRacesScreenshots/SnapshotHelper.swift index beec60b..11148d2 100755 --- a/WikiRaces/WikiRacesScreenshots/SnapshotHelper.swift +++ b/WikiRaces/WikiRacesScreenshots/SnapshotHelper.swift @@ -20,8 +20,8 @@ import XCTest var deviceLanguage = "" var locale = "" -func setupSnapshot(_ app: XCUIApplication) { - Snapshot.setupSnapshot(app) +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) } func snapshot(_ name: String, waitForLoadingIndicator: Bool) { @@ -65,14 +65,16 @@ enum SnapshotError: Error, CustomDebugStringConvertible { @objcMembers open class Snapshot: NSObject { static var app: XCUIApplication? + static var waitForAnimations = true static var cacheDirectory: URL? static var screenshotsDirectory: URL? { return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) } - open class func setupSnapshot(_ app: XCUIApplication) { + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations do { let cacheDir = try pathPrefix() @@ -81,13 +83,13 @@ open class Snapshot: NSObject { setLocale(app) setLaunchArguments(app) } catch let error { - print(error) + NSLog(error.localizedDescription) } } class func setLanguage(_ app: XCUIApplication) { guard let cacheDirectory = self.cacheDirectory else { - print("CacheDirectory is not set - probably running on a physical device?") + NSLog("CacheDirectory is not set - probably running on a physical device?") return } @@ -98,13 +100,13 @@ open class Snapshot: NSObject { deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"] } catch { - print("Couldn't detect/set language...") + NSLog("Couldn't detect/set language...") } } class func setLocale(_ app: XCUIApplication) { guard let cacheDirectory = self.cacheDirectory else { - print("CacheDirectory is not set - probably running on a physical device?") + NSLog("CacheDirectory is not set - probably running on a physical device?") return } @@ -114,10 +116,10 @@ open class Snapshot: NSObject { let trimCharacterSet = CharacterSet.whitespacesAndNewlines locale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) } catch { - print("Couldn't detect/set locale...") + NSLog("Couldn't detect/set locale...") } - if locale.isEmpty { + if locale.isEmpty && !deviceLanguage.isEmpty { locale = Locale(identifier: deviceLanguage).identifier } @@ -128,7 +130,7 @@ open class Snapshot: NSObject { class func setLaunchArguments(_ app: XCUIApplication) { guard let cacheDirectory = self.cacheDirectory else { - print("CacheDirectory is not set - probably running on a physical device?") + NSLog("CacheDirectory is not set - probably running on a physical device?") return } @@ -144,7 +146,7 @@ open class Snapshot: NSObject { } app.launchArguments += results } catch { - print("Couldn't detect/set launch_arguments...") + NSLog("Couldn't detect/set launch_arguments...") } } @@ -153,28 +155,40 @@ open class Snapshot: NSObject { waitForLoadingIndicatorToDisappear(within: timeout) } - print("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work + NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work - sleep(1) // Waiting for the animation to be finished (kind of) + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } #if os(OSX) - XCUIApplication().typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) #else - guard let app = self.app else { - print("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + guard self.app != nil else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") return } - let window = app.windows.firstMatch - let screenshot = window.screenshot() - guard let simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } - let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") + let screenshot = XCUIScreen.main.screenshot() + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } + do { + // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices + let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ") + let range = NSRange(location: 0, length: simulator.count) + simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") + + let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") try screenshot.pngRepresentation.write(to: path) } catch let error { - print("Problem writing screenshot: \(name) to \(path)") - print(error) + NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") + NSLog(error.localizedDescription) } #endif } @@ -184,7 +198,12 @@ open class Snapshot: NSObject { return #endif - let networkLoadingIndicator = XCUIApplication().otherElements.deviceStatusBars.networkLoadingIndicators.element + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) } @@ -259,7 +278,11 @@ private extension XCUIElementQuery { } var deviceStatusBars: XCUIElementQuery { - let deviceWidth = XCUIApplication().windows.firstMatch.frame.width + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width let isStatusBar = NSPredicate { (evaluatedObject, _) in guard let element = evaluatedObject as? XCUIElementAttributes else { return false } @@ -279,4 +302,6 @@ private extension CGFloat { // Please don't remove the lines below // They are used to detect outdated configuration files -// SnapshotHelperVersion [1.13] +// SnapshotHelperVersion [1.211] + +//swiftlint:enable line_length diff --git a/WikiRaces/WikiRacesScreenshots/WikiRacesScreenshots.swift b/WikiRaces/WikiRacesScreenshots/WikiRacesScreenshots.swift index f83bccb..2a59e2e 100644 --- a/WikiRaces/WikiRacesScreenshots/WikiRacesScreenshots.swift +++ b/WikiRaces/WikiRacesScreenshots/WikiRacesScreenshots.swift @@ -26,7 +26,7 @@ class WikiRacesScreenshots: XCTestCase { } func testExample() { - sleep(5) + sleep(2) XCUIDevice.shared.orientation = .landscapeLeft snapshot("1_portrait") XCUIApplication().buttons["GLOBAL RACE"].tap() diff --git a/WikiRaces/fabric.apikey b/WikiRaces/fabric.apikey deleted file mode 100644 index e69de29..0000000 diff --git a/WikiRaces/fabric.buildsecret b/WikiRaces/fabric.buildsecret deleted file mode 100644 index e69de29..0000000 diff --git a/WikiRaces/fastlane/Fastfile b/WikiRaces/fastlane/Fastfile index 01aeb4b..b4b1b49 100644 --- a/WikiRaces/fastlane/Fastfile +++ b/WikiRaces/fastlane/Fastfile @@ -1,25 +1,13 @@ -# This file contains the fastlane.tools configuration -# You can find the documentation at https://docs.fastlane.tools -# -# For a list of all available actions, check out -# -# https://docs.fastlane.tools/actions -# -# For a list of all available plugins, check out -# -# https://docs.fastlane.tools/plugins/available-plugins -# +fastlane_version "2.28.3" -# Uncomment the line if you want fastlane to automatically update itself -# update_fastlane - -default_platform(:ios) +default_platform :ios platform :ios do - desc "Push a new beta build to TestFlight" lane :beta do - build_app(scheme: "WikiRaces", analyze_build_time: true) + # match(type: "appstore") # more information: https://codesigning.guide + gym(scheme: "WikiRaces") # Build your app - more options available changelog_from_git_commits(pretty:"[%ad] %s", date_format:"short") - upload_to_testflight(distribute_external:true, notify_external_testers:false) + upload_to_testflight(distribute_external:true, notify_external_testers:false, groups: ["External Testers"]) end end + diff --git a/WikiRaces/fastlane/Snapfile b/WikiRaces/fastlane/Snapfile index 4b4d029..1696981 100644 --- a/WikiRaces/fastlane/Snapfile +++ b/WikiRaces/fastlane/Snapfile @@ -2,35 +2,18 @@ # A list of devices you want to take the screenshots from devices([ -"iPhone Xs Max", -"iPhone Xs", -"iPhone 8", -"iPhone 8 Plus", -"iPad Pro (9.7-inch)", -"iPad Pro (10.5-inch)", -"iPad Pro (11-inch)", -"iPad Pro (12.9-inch) (2nd generation)", -"iPad Pro (12.9-inch) (3rd generation)" +"iPad Pro", ]) languages([ "en-US" ]) -# The name of the scheme which contains the UI Tests - scheme "WikiRacesScreenshots" +scheme "WikiRacesScreenshots" -# Where should the resulting screenshots be stored? -# output_directory "./screenshots" +dark_mode false - clear_previous_screenshots true # remove the '#' to clear all previously generated screenshots before creating new ones +clear_previous_screenshots false -# Choose which project/workspace to use project "./WikiRaces.xcodeproj" -# workspace "./Project.xcworkspace" -# Arguments to pass to the app on launch. See https://github.com/fastlane/snapshot#launch-arguments -# launch_arguments(["-favColor red"]) - -# For more information about all available options run -# fastlane snapshot --help