Skip to content

Commit 39b3b62

Browse files
committed
- Fix HealthKit authorization request
- Update tests
1 parent 1a20414 commit 39b3b62

11 files changed

+26
-26
lines changed

Gym Tracker Core/DataManager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ final public class WCObject: Equatable {
252252

253253
// MARK: - Delegate Protocol
254254

255-
@objc public protocol DataManagerDelegate: class {
255+
@objc public protocol DataManagerDelegate: AnyObject {
256256

257257
func refreshData()
258258
func cancelAndDisableEdit()

Gym Tracker Tests/ExecuteWorkoutControllerTests.swift

+4-5
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ class ExecuteWorkoutControllerTests: XCTestCase {
400400
assertCall { $0 == .workoutHasStarted }
401401
assertCall { c in
402402
if case DelegateCalls.startTimer(let d) = c {
403-
let now = Date()
404403
XCTAssertEqual(d.timeIntervalSince1970, Date().timeIntervalSince1970, accuracy: 2)
405404

406405
return true
@@ -483,7 +482,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
483482
}
484483
assertCall { c in
485484
if case DelegateCalls.setNextUpText(let str) = c {
486-
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
485+
assert(string: str, containsInOrder: [r.rest.formattedDuration])
487486
return true
488487
}
489488
return false
@@ -561,7 +560,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
561560
}
562561
assertCall { c in
563562
if case DelegateCalls.setNextUpText(let str) = c {
564-
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
563+
assert(string: str, containsInOrder: [r.rest.formattedDuration])
565564
return true
566565
}
567566
return false
@@ -675,7 +674,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
675674
}
676675
assertCall { c in
677676
if case DelegateCalls.setNextUpText(let str) = c {
678-
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
677+
assert(string: str, containsInOrder: [r.rest.formattedDuration])
679678
return true
680679
}
681680
return false
@@ -1075,7 +1074,7 @@ class ExecuteWorkoutControllerTests: XCTestCase {
10751074
}
10761075
assertCall { c in
10771076
if case DelegateCalls.setNextUpText(let str) = c {
1078-
assert(string: str, containsInOrder: [r.rest.getFormattedDuration()])
1077+
assert(string: str, containsInOrder: [r.rest.formattedDuration])
10791078
return true
10801079
}
10811080
return false

Gym Tracker Tests/WorkoutIteratorTests.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class WorkoutIteratorTests: XCTestCase {
285285
XCTAssertEqual(s1.rest, step3.rest)
286286

287287
if let next = step3.nextUpInfo?.string {
288-
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
288+
assert(string: next, containsInOrder: [n.rest.formattedDuration])
289289
} else {
290290
XCTFail("Unexpected nil")
291291
}
@@ -325,7 +325,7 @@ class WorkoutIteratorTests: XCTestCase {
325325
XCTAssertNil(step4.rest)
326326

327327
if let next = step4.nextUpInfo?.string {
328-
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
328+
assert(string: next, containsInOrder: [n.rest.formattedDuration])
329329
} else {
330330
XCTFail("Unexpected nil")
331331
}
@@ -717,7 +717,7 @@ class WorkoutIteratorTests: XCTestCase {
717717
XCTAssertNil(step6.rest)
718718

719719
if let next = step6.nextUpInfo?.string {
720-
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
720+
assert(string: next, containsInOrder: [n.rest.formattedDuration])
721721
} else {
722722
XCTFail("Unexpected nil")
723723
}
@@ -1806,7 +1806,7 @@ class WorkoutIteratorTests: XCTestCase {
18061806
XCTAssertNil(step1.rest)
18071807

18081808
if let next = step1.nextUpInfo?.string {
1809-
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
1809+
assert(string: next, containsInOrder: [n.rest.formattedDuration])
18101810
} else {
18111811
XCTFail("Unexpected nil")
18121812
}
@@ -1846,7 +1846,7 @@ class WorkoutIteratorTests: XCTestCase {
18461846
XCTAssertNil(step2.rest)
18471847

18481848
if let next = step2.nextUpInfo?.string {
1849-
assert(string: next, containsInOrder: [n.rest.getFormattedDuration()])
1849+
assert(string: next, containsInOrder: [n.rest.formattedDuration])
18501850
} else {
18511851
XCTFail("Unexpected nil")
18521852
}

Gym Tracker iOS/AppDelegate.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
223223

224224
func authorizeHealthAccess() {
225225
let req = {
226-
healthStore.requestAuthorization(toShare: healthWriteData, read: healthReadData) { _, _ in }
226+
DispatchQueue.main.async {
227+
healthStore.requestAuthorization(toShare: healthWriteData, read: healthReadData) { _, _ in }
228+
}
227229
}
228230

229231
if #available(iOS 12.0, *) {

Gym Tracker.xcodeproj/project.pbxproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@
11331133
isa = PBXProject;
11341134
attributes = {
11351135
LastSwiftUpdateCheck = 1000;
1136-
LastUpgradeCheck = 1200;
1136+
LastUpgradeCheck = 1320;
11371137
ORGANIZATIONNAME = "Marco Boschi";
11381138
TargetAttributes = {
11391139
7A2E10211FBDCC6F004767D7 = {
@@ -1684,7 +1684,7 @@
16841684
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
16851685
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
16861686
COPY_PHASE_STRIP = NO;
1687-
CURRENT_PROJECT_VERSION = 23;
1687+
CURRENT_PROJECT_VERSION = 24;
16881688
DEBUG_INFORMATION_FORMAT = dwarf;
16891689
ENABLE_STRICT_OBJC_MSGSEND = YES;
16901690
ENABLE_TESTABILITY = YES;
@@ -1704,9 +1704,9 @@
17041704
GCC_WARN_UNUSED_VARIABLE = YES;
17051705
HEALTH_READ_DATA = "Monitor heart rate during workout and read data for creating a workout.";
17061706
HEALTH_WRITE_DATA = "Save completed gym workout.";
1707-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1707+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
17081708
MACOSX_DEPLOYMENT_TARGET = 10.10;
1709-
MARKETING_VERSION = 3.1.4;
1709+
MARKETING_VERSION = 3.1.5;
17101710
MTL_ENABLE_DEBUG_INFO = YES;
17111711
ONLY_ACTIVE_ARCH = YES;
17121712
SDKROOT = iphoneos;
@@ -1751,7 +1751,7 @@
17511751
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
17521752
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
17531753
COPY_PHASE_STRIP = NO;
1754-
CURRENT_PROJECT_VERSION = 23;
1754+
CURRENT_PROJECT_VERSION = 24;
17551755
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
17561756
ENABLE_NS_ASSERTIONS = NO;
17571757
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -1765,9 +1765,9 @@
17651765
GCC_WARN_UNUSED_VARIABLE = YES;
17661766
HEALTH_READ_DATA = "Monitor heart rate during workout and read data for creating a workout.";
17671767
HEALTH_WRITE_DATA = "Save completed gym workout.";
1768-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1768+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
17691769
MACOSX_DEPLOYMENT_TARGET = 10.10;
1770-
MARKETING_VERSION = 3.1.4;
1770+
MARKETING_VERSION = 3.1.5;
17711771
MTL_ENABLE_DEBUG_INFO = NO;
17721772
SDKROOT = iphoneos;
17731773
SWIFT_COMPILATION_MODE = wholemodule;

Gym Tracker.xcodeproj/xcshareddata/xcschemes/Gym Tracker Core iOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1320"
44
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"

Gym Tracker.xcodeproj/xcshareddata/xcschemes/Gym Tracker Core watchOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1320"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Gym Tracker.xcodeproj/xcshareddata/xcschemes/Gym Tracker Notifications.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1320"
44
wasCreatedForAppExtension = "YES"
55
version = "2.0">
66
<BuildAction

Gym Tracker.xcodeproj/xcshareddata/xcschemes/Gym Tracker watchOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1320"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Gym Tracker.xcodeproj/xcshareddata/xcschemes/Gym Tracker.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1320"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ At the end your workout is automatically saved inside the Health app, if you're
1111

1212
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).
1313

14-
Support me by buying the app on the AppStore<br>
1514
[![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)
1615

1716
## Project Setup
18-
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)).
17+
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)).
1918

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

0 commit comments

Comments
 (0)