Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OutRun/Controllers/Settings/DebugController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class DebugController: SettingsViewController {
subTitle: String(Config.hasMobileProvision)
),
TitleSubTitleSetting(
title: "hasSanboxReceipt",
subTitle: String(Config.hasSanboxReceipt)
title: "hasSandboxReceipt",
subTitle: String(Config.hasSandboxReceipt)
)
]
)
Expand Down
8 changes: 4 additions & 4 deletions OutRun/Controllers/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SettingsViewController: UITableViewController {

if var keyboardAvoidingSetting = setting as? KeyboardAvoidanceSetting {
keyboardAvoidingSetting.registerForKeyboardAvoidanceClosure = { cell in
self.cellShouldBeVisisble = cell
self.cellShouldBeVisible = cell
}
}

Expand Down Expand Up @@ -107,13 +107,13 @@ class SettingsViewController: UITableViewController {
}
}

public var cellShouldBeVisisble: UITableViewCell?
public var cellShouldBeVisible: UITableViewCell?
private var formerContentOffset: CGPoint?

@objc private func keyboardWillShow(_ notification: Notification) {
self.formerContentOffset = self.tableView.contentOffset

if let cell = self.cellShouldBeVisisble, let indexPath = self.tableView.indexPath(for: cell), let keyboardHeight = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height {
if let cell = self.cellShouldBeVisible, let indexPath = self.tableView.indexPath(for: cell), let keyboardHeight = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height {
let offsetHeight = keyboardHeight - self.view.safeAreaInsets.bottom
self.tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: offsetHeight, right: 0)
self.tableView.scrollToRow(at: indexPath, at: .bottom, animated: true)
Expand All @@ -133,7 +133,7 @@ class SettingsViewController: UITableViewController {
self.tableView.reloadData()
}

/// NOTE: This function is supposed to be overridded
/// NOTE: This function is supposed to be overridden
func notifyOfPresentation(_ settingsViewController: SettingsViewController) {}

}
6 changes: 3 additions & 3 deletions OutRun/Controllers/Workout/EditWorkoutController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class EditWorkoutController: SettingsViewController {
TextInputSetting(
title: LS["Workout.Distance"],
textFieldText: {
let value = UserPreferences.distanceMeasurementType.convert(fromValue: self.distance ?? 0, toPrefered: true)
let value = UserPreferences.distanceMeasurementType.convert(fromValue: self.distance ?? 0, toPreferred: true)
return CustomNumberFormatting.string(from: value, fractionDigits: 2)
}(),
keyboardType: .decimalPad,
Expand All @@ -88,7 +88,7 @@ class EditWorkoutController: SettingsViewController {
guard let distance = CustomNumberFormatting.number(from: newValue) else {
return
}
let newValue = UserPreferences.distanceMeasurementType.convert(fromValue: distance, toPrefered: false, rounded: false)
let newValue = UserPreferences.distanceMeasurementType.convert(fromValue: distance, toPreferred: false, rounded: false)
self.distance = newValue
self.validateData()
}
Expand Down Expand Up @@ -280,7 +280,7 @@ class EditWorkoutController: SettingsViewController {
func getWeightBeforeWorkout(for type: Workout.WorkoutType, with distance: Double) -> Double {
guard let weight = UserPreferences.weight.value else { return 0.0 }
let burnedCalories = BurnedEnergyCalculator.calculateBurnedCalories(for: type, distance: distance, weight: weight)
return BurnedEnergyCalculator.calculeWeightBeforeWorkout(for: type, distance: distance, burnedCal: burnedCalories.doubleValue)
return BurnedEnergyCalculator.calculateWeightBeforeWorkout(for: type, distance: distance, burnedCal: burnedCalories.doubleValue)
}

func showWorkoutController(workout: Workout) {
Expand Down
4 changes: 2 additions & 2 deletions OutRun/Extensions/Double.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Foundation
extension Double {

/**
Rounds this value to a specified decimal place using the specifed `FloatingPointRoundingRule`
Rounds this value to a specified decimal place using the specified `FloatingPointRoundingRule`
- parameter decimalPlaces: the maximum number of decimal places the value should have
- parameter rule: the rule by which the value will be rounded
*/
Expand All @@ -33,7 +33,7 @@ extension Double {
}

/**
Returns this value rounded to a specified decimal place using the specifed `FloatingPointRoundingRule`
Returns this value rounded to a specified decimal place using the specified `FloatingPointRoundingRule`
- parameter decimalPlaces: the maximum number of decimal places the value should have
- parameter rule: the rule by which the value will be rounded
- returns: the rounded value
Expand Down
2 changes: 1 addition & 1 deletion OutRun/Extensions/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension URL {

} catch {

print("Failed to calculate size of file at \(self.absoluteString) because an error occured:", error)
print("Failed to calculate size of file at \(self.absoluteString) because an error occurred:", error)
return nil

}
Expand Down
6 changes: 3 additions & 3 deletions OutRun/Models/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum Config {
static var releaseStatus: ReleaseStatus {
if Config.isDebug || Config.isRunOnSimulator {
return ReleaseStatus.debug
} else if /*Config.hasMobileProvision &&*/ Config.hasSanboxReceipt {
} else if /*Config.hasMobileProvision &&*/ Config.hasSandboxReceipt {
return ReleaseStatus.beta
} else {
return ReleaseStatus.release
Expand Down Expand Up @@ -75,13 +75,13 @@ enum Config {
#endif
}

/// A boolean indicating wheather the app bundle contains a certain file generated when building and packaging an App for App Store Connect
/// A boolean indicating whether the app bundle contains a certain file generated when building and packaging an App for App Store Connect
static var hasMobileProvision: Bool {
return (Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") != nil)
}

/// A boolean indicating whether or not the receipt provided through by the App Store was generated for a sandbox / non-release environment; in other words: it indicates if the app was downloaded through another way than the App Store
static var hasSanboxReceipt: Bool {
static var hasSandboxReceipt: Bool {
return Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
}

Expand Down
2 changes: 1 addition & 1 deletion OutRun/Models/Data/ShareManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import CoreGPX

enum ShareManager {

/// A funtion displaying the iOS share menu on top of the given controller for a file at the given directory (provided it exists); if `shouldDeleteFileAfter` is set to true, the file at the given path will get deleted once the menu is dismissed, this might be useful if the file is saved at the temporary directory
/// A function displaying the iOS share menu on top of the given controller for a file at the given directory (provided it exists); if `shouldDeleteFileAfter` is set to true, the file at the given path will get deleted once the menu is dismissed, this might be useful if the file is saved at the temporary directory
static func displayShareMenu(forFileAt url: URL?, on controller: UIViewController, shouldDeleteFileAfter shouldDelete: Bool = true) {

guard let url = url else {
Expand Down
4 changes: 2 additions & 2 deletions OutRun/Models/HealthKit/HealthObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ enum HealthObserver {
}
var count = 0
queryObjects.forEach { (queryObject) in
HealthQueryManager.getAndAttatchRoute(to: queryObject) {
HealthQueryManager.getAndAttatchSteps(to: queryObject) {
HealthQueryManager.getAndAttachRoute(to: queryObject) {
HealthQueryManager.getAndAttachSteps(to: queryObject) {
// not fully implemented yet
//HealthQueryManager.getAndAttachHeartRate(to: queryObject) {
count += 1
Expand Down
12 changes: 6 additions & 6 deletions OutRun/Models/HealthKit/HealthQueryManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ enum HealthQueryManager {
return
}
queryObjects.append(queryObject)
HealthQueryManager.getAndAttatchRoute(to: queryObject) {
HealthQueryManager.getAndAttatchSteps(to: queryObject) {
HealthQueryManager.getAndAttachRoute(to: queryObject) {
HealthQueryManager.getAndAttachSteps(to: queryObject) {
// not fully implemented
//HealthQueryManager.getAndAttachHeartRate(to: queryObject) {
count += 1
Expand All @@ -101,8 +101,8 @@ enum HealthQueryManager {
}
}

// MARK: Query Steps and Attatch to Query Object
static func getAndAttatchSteps(to queryObject: HKWorkoutQueryObject, completion: @escaping () -> Void) {
// MARK: Query Steps and Attach to Query Object
static func getAndAttachSteps(to queryObject: HKWorkoutQueryObject, completion: @escaping () -> Void) {

let predicate = HKAnchoredObjectQuery.predicateForObjects(from: queryObject.hkWorkout)
let stepsQuery = HKAnchoredObjectQuery(type: HealthStoreManager.objectTypeRouteType, predicate: predicate, anchor: nil, limit: HKObjectQueryNoLimit) { (query, stepsSamples, _, _, error) in
Expand All @@ -124,8 +124,8 @@ enum HealthQueryManager {

}

// MARK: Query Route and Attatch to Query Object
static func getAndAttatchRoute(to queryObject: HKWorkoutQueryObject, completion: @escaping () -> Void) {
// MARK: Query Route and Attach to Query Object
static func getAndAttachRoute(to queryObject: HKWorkoutQueryObject, completion: @escaping () -> Void) {

let predicate = HKAnchoredObjectQuery.predicateForObjects(from: queryObject.hkWorkout)
let routeObjectQuery = HKAnchoredObjectQuery(type: HealthStoreManager.objectTypeRouteType, predicate: predicate, anchor: nil, limit: 1) { (query, routeSamples, _, _, error) in
Expand Down
6 changes: 3 additions & 3 deletions OutRun/Models/HealthKit/HealthStoreManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ enum HealthStoreManager {
}
}

// MARK: Attatch Route To Health Workout
// MARK: Attach Route To Health Workout
static func attachRoute(to hkWorkout: HKWorkout, with workout: TempWorkout) {

let locations = workout.locations.compactMap { (sample) -> CLLocation? in
Expand All @@ -238,7 +238,7 @@ enum HealthStoreManager {

}

// MARK: Attatch Heart Rates To Health Workout
// MARK: Attach Heart Rates To Health Workout
static func attachHeartRates(to hkWorkout: HKWorkout, with workout: TempWorkout) {

func add(_ samples: [HKSample]) {
Expand Down Expand Up @@ -495,7 +495,7 @@ enum HealthStoreManager {

}

// MARK: Sync All Unsycned Workouts With Apple Health
// MARK: Sync All Unsynced Workouts With Apple Health
/// Function to sync all unsynced workouts with the health store, completion returning the success state and the state if all workouts have been synced already
static func syncAllUnsyncedWorkoutsWithAppleHealth(completion: @escaping (Bool, Bool?) -> Void) {

Expand Down
4 changes: 2 additions & 2 deletions OutRun/Models/LS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import Foundation

/// A struct containg only static subscripts and needed enumerations to enable easier localisation.
/// A struct containing only static subscripts and needed enumerations to enable easier localisation.
struct LS {

/**
Expand All @@ -34,7 +34,7 @@ struct LS {
let errorValue = "NIL"
var localizedString = Bundle.main.localizedString(forKey: key, value: errorValue, table: sourceType.tableName)

// falling back on base language if string for key is not availabe
// falling back on base language if string for key is not available
if localizedString == "NIL" {
localizedString = sourceType.fallbackBundle.localizedString(forKey: key, value: errorValue, table: sourceType.tableName)
}
Expand Down
4 changes: 2 additions & 2 deletions OutRun/Models/ORBanner/ORBannerQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class ORBannerQueue {
}

/**
Removes an `ORBaseBanner` from the queu
Removes an `ORBaseBanner` from the queue
- parameter banner: The banner being removed from the queue
*/
public func remove(_ banner: ORBaseBanner) {
Expand All @@ -83,7 +83,7 @@ public class ORBannerQueue {
}

/**
Displayes (or resumes) the next banner after removing the current banner from the queue
Displays (or resumes) the next banner after removing the current banner from the queue
*/
public func displayNext() {

Expand Down
8 changes: 4 additions & 4 deletions OutRun/Models/Preferences/MeasurementUserPreference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ class MeasurementUserPreference<UnitType> where UnitType: Unit {
}
}

func convert(fromValue value: Double, toPrefered: Bool, rounded: Bool = true) -> Double {
func convert(fromValue value: Double, toPreferred: Bool, rounded: Bool = true) -> Double {
guard let standardUnit = self.standardValue else {
return -1
}
let preferedUnit = self.safeValue
let sourceUnit = toPrefered ? standardUnit : preferedUnit
let targetUnit = toPrefered ? preferedUnit : standardUnit
let preferredUnit = self.safeValue
let sourceUnit = toPreferred ? standardUnit : preferredUnit
let targetUnit = toPreferred ? preferredUnit : standardUnit
let value = UnitConversion.conversion(of: value, from: sourceUnit, to: targetUnit)
return rounded ? ((value * 100).rounded() / 100) : value
}
Expand Down
4 changes: 2 additions & 2 deletions OutRun/Models/Settings/SettingsModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class SettingsModel {
guard let weight = UserPreferences.weight.value else {
return nil
}
let value = UserPreferences.weightMeasurementType.convert(fromValue: weight, toPrefered: true)
let value = UserPreferences.weightMeasurementType.convert(fromValue: weight, toPreferred: true)
return CustomNumberFormatting.string(from: value, fractionDigits: 2)
},
textFieldPlaceholder: { LS["Settings.Weight"] },
Expand All @@ -123,7 +123,7 @@ class SettingsModel {
setting.refresh()
return
}
let weightValue = UserPreferences.weightMeasurementType.convert(fromValue: newValue, toPrefered: false)
let weightValue = UserPreferences.weightMeasurementType.convert(fromValue: newValue, toPreferred: false)
UserPreferences.weight.value = weightValue
setting.refresh()

Expand Down
2 changes: 1 addition & 1 deletion OutRun/Models/Workout/BurnedEnergyCalculator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BurnedEnergyCalculator {
return measurement
}

static func calculeWeightBeforeWorkout(for type: Workout.WorkoutType, distance: Double, burnedCal: Double) -> Double {
static func calculateWeightBeforeWorkout(for type: Workout.WorkoutType, distance: Double, burnedCal: Double) -> Double {

/// burnedCal = kilometers * type.METSpeedMultiplier * weight
/// (kilometers * type.METSpeedMultiplier)weight = burnedCal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum WorkoutMapImageManager {
private static let processQueue = DispatchQueue(label: "processQueue", qos: .userInitiated)
private static let snapshotQueue = DispatchQueue(label: "snapshotQueue")

/// A funtion for the execution of a WorkoutMapImageRequest, adding it to the running WorkoutMapImageQueue. If cached this method directly executes the closure, not rendering the image again.
/// A function for the execution of a WorkoutMapImageRequest, adding it to the running WorkoutMapImageQueue. If cached this method directly executes the closure, not rendering the image again.
///
/// - Parameter request: An instance of WorkoutMapImageRequest indicating the type of image being requested
public static func execute(_ request: WorkoutMapImageRequest) {
Expand All @@ -58,7 +58,7 @@ enum WorkoutMapImageManager {
internalStatus = .suspended
}

/// A Funtion resuming the rendering process of new map images after it was suspended by `suspendRenderProcess()`.
/// A Function resuming the rendering process of new map images after it was suspended by `suspendRenderProcess()`.
public static func resumeRenderProcess() {
processQueue.resume()
snapshotQueue.resume()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ extension WorkoutBuilder {
/// the data collected by the altimeter consisting of an array of timestamps and their relative altitudes
private var altitudeData: [(timestamp: Date, relativeAltitude: Double)] = []

/// an instance of `CMAltimeter` to measure releative altitude changes
/// an instance of `CMAltimeter` to measure relative altitude changes
private let altimeter = CMAltimeter()

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension WorkoutBuilder {
/**
Updates the AutoPauseDetection instance with new values during a recording
- parameter timestamp: the exact date when the data provided was received
- parameter workoutType: the workout type of the current workout being recorded used for further analysis of the cenario and to discard auto pause detection when appropriate
- parameter workoutType: the workout type of the current workout being recorded used for further analysis of the scenario and to discard auto pause detection when appropriate
- parameter speed: the speed at the provided moment in meters per second
*/
public func update(timestamp: Date, workoutType: Workout.WorkoutType, speed: Double) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extension WorkoutBuilder {
}

/**
Initialises an `AutoPause` object with the provided datesif the start is earlier than the end
Initialises an `AutoPause` object with the provided dates if the start is earlier than the end
- parameter start: the start date of the automatic pause
- parameter end: the end date of the automatic pause
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import UIKit
extension WorkoutBuilder {

/**
Enumaration of the different kind of status the `WorkoutBuilder` can take on
Enumeration of the different kind of status the `WorkoutBuilder` can take on
*/
enum Status {

Expand Down
Loading