Skip to content

Commit

Permalink
- Fix HealthKit authorization request
Browse files Browse the repository at this point in the history
- Update tests
  • Loading branch information
piscoTech committed Feb 10, 2022
1 parent 1a20414 commit 39b3b62
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Gym Tracker Core/DataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ final public class WCObject: Equatable {

// MARK: - Delegate Protocol

@objc public protocol DataManagerDelegate: class {
@objc public protocol DataManagerDelegate: AnyObject {

func refreshData()
func cancelAndDisableEdit()
Expand Down
9 changes: 4 additions & 5 deletions Gym Tracker Tests/ExecuteWorkoutControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ class ExecuteWorkoutControllerTests: XCTestCase {
assertCall { $0 == .workoutHasStarted }
assertCall { c in
if case DelegateCalls.startTimer(let d) = c {
let now = Date()
XCTAssertEqual(d.timeIntervalSince1970, Date().timeIntervalSince1970, accuracy: 2)

return true
Expand Down Expand Up @@ -483,7 +482,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
}
assertCall { c in
if case DelegateCalls.setNextUpText(let str) = c {
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
assert(string: str, containsInOrder: [r.rest.formattedDuration])
return true
}
return false
Expand Down Expand Up @@ -561,7 +560,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
}
assertCall { c in
if case DelegateCalls.setNextUpText(let str) = c {
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
assert(string: str, containsInOrder: [r.rest.formattedDuration])
return true
}
return false
Expand Down Expand Up @@ -675,7 +674,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
}
assertCall { c in
if case DelegateCalls.setNextUpText(let str) = c {
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
assert(string: str, containsInOrder: [r.rest.formattedDuration])
return true
}
return false
Expand Down Expand Up @@ -1075,7 +1074,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
}
assertCall { c in
if case DelegateCalls.setNextUpText(let str) = c {
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
assert(string: str, containsInOrder: [r.rest.formattedDuration])
return true
}
return false
Expand Down
10 changes: 5 additions & 5 deletions Gym Tracker Tests/WorkoutIteratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class WorkoutIteratorTests: XCTestCase {
XCTAssertEqual(s1.rest, step3.rest)

if let next = step3.nextUpInfo?.string {
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
assert(string: next, containsInOrder: [n.rest.formattedDuration])
} else {
XCTFail("Unexpected nil")
}
Expand Down Expand Up @@ -325,7 +325,7 @@ class WorkoutIteratorTests: XCTestCase {
XCTAssertNil(step4.rest)

if let next = step4.nextUpInfo?.string {
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
assert(string: next, containsInOrder: [n.rest.formattedDuration])
} else {
XCTFail("Unexpected nil")
}
Expand Down Expand Up @@ -717,7 +717,7 @@ class WorkoutIteratorTests: XCTestCase {
XCTAssertNil(step6.rest)

if let next = step6.nextUpInfo?.string {
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
assert(string: next, containsInOrder: [n.rest.formattedDuration])
} else {
XCTFail("Unexpected nil")
}
Expand Down Expand Up @@ -1806,7 +1806,7 @@ class WorkoutIteratorTests: XCTestCase {
XCTAssertNil(step1.rest)

if let next = step1.nextUpInfo?.string {
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
assert(string: next, containsInOrder: [n.rest.formattedDuration])
} else {
XCTFail("Unexpected nil")
}
Expand Down Expand Up @@ -1846,7 +1846,7 @@ class WorkoutIteratorTests: XCTestCase {
XCTAssertNil(step2.rest)

if let next = step2.nextUpInfo?.string {
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
assert(string: next, containsInOrder: [n.rest.formattedDuration])
} else {
XCTFail("Unexpected nil")
}
Expand Down
4 changes: 3 additions & 1 deletion Gym Tracker iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func authorizeHealthAccess() {
let req = {
healthStore.requestAuthorization(toShare: healthWriteData, read: healthReadData) { _, _ in }
DispatchQueue.main.async {
healthStore.requestAuthorization(toShare: healthWriteData, read: healthReadData) { _, _ in }
}
}

if #available(iOS 12.0, *) {
Expand Down
14 changes: 7 additions & 7 deletions Gym Tracker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1000;
LastUpgradeCheck = 1200;
LastUpgradeCheck = 1320;
ORGANIZATIONNAME = "Marco Boschi";
TargetAttributes = {
7A2E10211FBDCC6F004767D7 = {
Expand Down Expand Up @@ -1684,7 +1684,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 24;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -1704,9 +1704,9 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEALTH_READ_DATA = "Monitor heart rate during workout and read data for creating a workout.";
HEALTH_WRITE_DATA = "Save completed gym workout.";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MARKETING_VERSION = 3.1.4;
MARKETING_VERSION = 3.1.5;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1751,7 +1751,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 24;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -1765,9 +1765,9 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEALTH_READ_DATA = "Monitor heart rate during workout and read data for creating a workout.";
HEALTH_WRITE_DATA = "Save completed gym workout.";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MARKETING_VERSION = 3.1.4;
MARKETING_VERSION = 3.1.5;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
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 = "1200"
LastUpgradeVersion = "1320"
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 = "1200"
LastUpgradeVersion = "1320"
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 = "1200"
LastUpgradeVersion = "1320"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
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 = "1200"
LastUpgradeVersion = "1320"
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 = "1200"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ At the end your workout is automatically saved inside the Health app, if you're

Backup and restore your workouts using iCloud Drive or export and share them with your friends. Backups and exported workout are in XML format and easily accessible from inside the iCloud Drive folder and app, you can manually edit them and import them again, before import data is validated against this [XSD grammar](https://github.com/piscoTech/GymTracker/blob/master/Gym%20Tracker%20Core/workout.xsd).

Support me by buying the app on the AppStore<br>
[![Download on the AppStore](https://marcoboschi.altervista.org/img/app_store_en.svg)](https://itunes.apple.com/us/app/gym-tracker-gym-workout-tracker/id1224155362?ls=1&mt=8)

## Project Setup
The framework `MBLibrary` referenced by this project is available [here](https://github.com/piscoTech/MBLibrary), version currently in use is [1.9](https://github.com/piscoTech/MBLibrary/releases/tag/v1.9(21)).
The framework `MBLibrary` referenced by this project is available [here](https://github.com/piscoTech/MBLibrary), version currently in use is [1.9.1](https://github.com/piscoTech/MBLibrary/releases/tag/v1.9.1(22)).

## Customization
General behaviour of the app can be configured via global and static variables:
Expand Down

0 comments on commit 39b3b62

Please sign in to comment.