-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADD - Event export possibility #17
base: master
Are you sure you want to change the base?
Conversation
Can export workout directly from the Workout view Settings menu to select the default calendar for the export Signed-off-by: Maxime Killinger <max.killinger@outlook.fr> modifié : Workout Core/Model/Preferences.swift modifié : Workout Core/Model/Workout/Workout.swift modifié : Workout.xcodeproj/project.pbxproj modifié : Workout/Base.lproj/Localizable.strings modifié : Workout/Controller/ListTVC.swift modifié : Workout/Controller/Settings/AboutVC.swift nouveau fichier : Workout/Controller/Settings/SelectCalendarTVC.swift modifié : Workout/Controller/WorkoutTVC.swift modifié : Workout/Support/Extensions.swift modifié : Workout/View/Base.lproj/Main.storyboard nouveau fichier : Workout/View/CalendarTableViewCell.swift
Fix typo Signed-off-by: Maxime Killinger <max.killinger@outlook.fr> modifié : Workout/Controller/Settings/SelectCalendarTVC.swift
Thank you. It'll be a while before I can fully review this as I'm busy with other stuff at the moment but I'll try to do so asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a first look just Github, I'll give you a more in depth response at a later date.
Also can you use tabs for indentation to keep things consistent?
private let typeRow = 0 | ||
private let startRow = 1 | ||
private let endRow = 2 | ||
private let durationRow = 3 | ||
private var distanceRow: Int? { | ||
guard self.totalDistance != nil else { | ||
return nil | ||
} | ||
|
||
return 1 + durationRow | ||
} | ||
private var avgHeartRow: Int? { | ||
guard self.avgHeart != nil else { | ||
return nil | ||
} | ||
|
||
return 1 + (distanceRow ?? durationRow) | ||
} | ||
private var maxHeartRow: Int? { | ||
guard self.maxHeart != nil else { | ||
return nil | ||
} | ||
|
||
let base = [avgHeartRow, distanceRow].lazy.compactMap { $0 }.first ?? durationRow | ||
return 1 + base | ||
} | ||
private var paceRow: Int? { | ||
guard self.pace != nil else { | ||
return nil | ||
} | ||
|
||
let base = [maxHeartRow, avgHeartRow, distanceRow].lazy.compactMap { $0 }.first ?? durationRow | ||
return 1 + base | ||
} | ||
private var speedRow: Int? { | ||
guard self.speed != nil else { | ||
return nil | ||
} | ||
|
||
let base = [paceRow, maxHeartRow, avgHeartRow, distanceRow].lazy.compactMap { $0 }.first ?? durationRow | ||
return 1 + base | ||
} | ||
private var energyRow: Int? { | ||
guard self.totalEnergy != nil else { | ||
return nil | ||
} | ||
|
||
let base = [speedRow, paceRow, maxHeartRow, avgHeartRow, distanceRow].lazy.compactMap { $0 }.first ?? durationRow | ||
return 1 + base | ||
} | ||
private var elevationRow: Int? { | ||
let (asc, desc) = self.elevationChange | ||
guard asc != nil || desc != nil else { | ||
return nil | ||
} | ||
|
||
let base = [energyRow, speedRow, paceRow, maxHeartRow, avgHeartRow, distanceRow].lazy.compactMap { $0 }.first ?? durationRow | ||
return 1 + base | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken these are just copied from what WorkoutTVC
uses to configure the first section. Instead of duplicating the code why not making these public and let WorkoutTVC
use these directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, but maybe I should create a new class for it like "WorkoutData", that will be used by the WorkoutTVC and Workout classes to access to theses data. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this since Workout
is already a wrapper for a HKWorkout
and the model for WorkoutTVC
.
A possible direction could be creating a sub-class for Workout
called something like Workout.DataIndex
(holding a weak reference to the workout in order to access what is now self.avgHeart
and the like) exposing this properties and maybe the count of how many are non nil.
We could make the init private so only the workout itself can initialize it.
} | ||
description.removeLast() | ||
|
||
eventStore.requestAccess(to: .event, completion: { (granted, error) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think authorization to use the calendar should be handled by the main app, not Workout Core
, like it's currently done for HealthKit. Also the string containing the reason we use the calendar should be updated to reflect the new functionality, the current value is just there to satisfy a requirement from Apple but never actually used
EKEventStore.authorizationStatus(for: EKEntityType.event) != EKAuthorizationStatus.denied, | ||
EKEventStore.authorizationStatus(for: EKEntityType.event) != EKAuthorizationStatus.restricted | ||
else { | ||
callback(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a real failure, we should prompt the user to update the authorization for calendar access
Signed-off-by: Maxime Killinger <max.killinger@outlook.fr> .git/MERGE_HEAD modifié : README.md modifié : Workout Core/Model/Workout/Additional Data/RunningHeartZones.swift modifié : Workout Core/Model/Workout/Additional Data/WorkoutRoute.swift modifié : Workout.xcodeproj/project.pbxproj modifié : Workout/Base.lproj/Localizable.strings modifié : Workout/Controller/ListTVC.swift modifié : Workout/Controller/Settings/AboutVC.swift modifié : Workout/Info.plist modifié : Workout/View/Base.lproj/Main.storyboard nouveau fichier : Workout/View/fr.lproj/Main.strings nouveau fichier : Workout/fr.lproj/InfoPlist.strings nouveau fichier : Workout/fr.lproj/Localizable.strings nouveau fichier : Workout/fr.lproj/Localizable.stringsdict nouveau fichier : WorkoutHelper/fr.lproj/LaunchScreen.strings
Pull new changes
Signed-off-by: Maxime Killinger <max.killinger@outlook.fr> Workout/Controller/ListTVC.swift Workout/View/Base.lproj/Main.storyboard git update-ref -d MERGE_HEAD modifié : Podfile.lock modifié : README.md modifié : Workout Core/Model/AdsManager.swift modifié : Workout Core/Model/Support/WorkoutUnit.swift modifié : Workout Core/Model/Workout/Additional Data/AdditionalDataProvider.swift modifié : Workout Core/Model/Workout/Additional Data/MinuteByMinuteBreakdown.swift modifié : Workout Core/Model/Workout/Additional Data/RunningHeartZones.swift modifié : Workout Core/Model/Workout/Additional Data/Support/MinuteByMinuteBreakdown/WorkoutMinute.swift modifié : Workout Core/Model/Workout/Additional Data/Support/Route/CSVWorkoutRouteExporter.swift modifié : Workout Core/Model/Workout/Additional Data/Support/Route/GPXWorkoutRouteExporter.swift modifié : Workout Core/Model/Workout/Additional Data/Support/Route/WorkoutRouteExporter.swift modifié : Workout Core/Model/Workout/Additional Data/WorkoutRoute.swift modifié : Workout Core/Model/Workout/Workout Types/RunningWorkout.swift modifié : Workout Core/Model/Workout/Workout.swift modifié : Workout Core/Model/WorkoutBulkExporter.swift modifié : Workout Core/Support/Extensions.swift modifié : Workout.xcodeproj/project.pbxproj modifié : Workout.xcodeproj/xcshareddata/xcschemes/Workout Core.xcscheme modifié : Workout.xcodeproj/xcshareddata/xcschemes/Workout.xcscheme modifié : Workout.xcodeproj/xcshareddata/xcschemes/WorkoutHelper.xcscheme modifié : Workout/Base.lproj/Localizable.strings modifié : Workout/Controller/ListTVC.swift modifié : Workout/Controller/WorkoutTVC.swift modifié : Workout/Info.plist modifié : Workout/View/Base.lproj/Main.storyboard modifié : Workout/fr.lproj/Localizable.strings
Signed-off-by: Maxime Killinger <max.killinger@outlook.fr> modifié : Workout/Controller/ListTVC.swift
Can export workout directly from the Workout view to the calendar
Settings menu to select the default calendar for the export
PR following #15